Skip to content

fix: default to YUV_400 format for .raw files#664

Open
for13to1 wants to merge 1 commit into
IENT:developfrom
for13to1:fix-raw-format-guess
Open

fix: default to YUV_400 format for .raw files#664
for13to1 wants to merge 1 commit into
IENT:developfrom
for13to1:fix-raw-format-guess

Conversation

@for13to1

Copy link
Copy Markdown
Contributor

Summary of Changes

As the author who originally contributed the RAW file support feature, this PR fixes a format fallback inconsistency for .raw (RAW Bayer / CFA patterns) files and resolves a potential empty optional dereference crash.

Background & Rationale

YUView uses YUV_400 (luma-only) internally to read and display single-channel raw sensor files (such as Bayer raw, defined in RAW_BAYER_EXTENSIONS).

Previously, if a .raw file had no resolution in its filename, it would bypass format guessing and fallback to the default YUV_420 format from videoHandlerYUV's constructor. This required users to manually select 400 (YUV 4:0:0) in the properties GUI.

This PR sets the default format to YUV_400 for files matching RAW_BAYER_EXTENSIONS right at construction, so they default to the correct single-channel interpretation.

Detailed Changes

  1. Fallback Consistency: Set the default format for RAW_BAYER_EXTENSIONS to YUV_400 in the playlistItemRawFile constructor.
  2. Robustness: Added a safety check in checkSpecificFileExtensions (PixelFormatYUVGuess.cpp) to prevent undefined behavior when frameSize is empty.

Verification

  • Built successfully and verified that opened .raw files now default to YUV 4:0:0 in the properties GUI.
  • Passed all 1860 unit tests.

- Initialize YUV video handler to YUV_400 for .raw extension files

- Guard against empty frameSize optional in checkSpecificFileExtensions
@for13to1

Copy link
Copy Markdown
Contributor Author

#663

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant