AkBKukU / braw-decode

BRAW decoder to allow unattended, headless, conversion of *.braw files into other file formats.
MIT License
39 stars 6 forks source link

Fixed problem with outputting extra buffer bytes for certain resolutions #5

Closed andaleebroomy closed 1 year ago

andaleebroomy commented 1 year ago

Fixed problem with outputting extra buffer bytes for certain resolutions (2864x1512) that cause incorrect overlapping artifacts when FFmpeg transcodes it. It looks like the Blackmagick RAW SDK may have aligned the buffer to a 1024-byte boundary, which cause an extra 512 bytes at the end of returned image buffer from GetResource for 2864x1512 videos. Actual image buffer size for rgba should be 2864x1512x4 = 17321472, which is 512 bytes less than what GetResourceSizeBytes was returning (17321984).

The problem is reproducible (and the fix verifiable) with the 2.8K samples found in the Blackmagic website e.g.: https://downloads.blackmagicdesign.com/products/blackmagicpocketcinemacamera/originals/the-chase/Empty-Wave-Spits.zip

Here is an example of the problematic overlap during playback of the FFmpeg transcoded output: image