[FFmpeg-devel] [PATCH v7] lavc/rawdec: Remove monowhite switching code for 1 bpp AVI without a palette

Mats Peterson matsp888 at yahoo.com
Thu Feb 11 00:07:12 CET 2016


Moved the nut palette copying code to a more logical location.

The stride will be calculated incorrectly for the attached 3 x 3 pixel 
pal8 nut file, since there is some padding in the packet after the video 
data and before the palette. It will be properly rounded down to the 
real width of the video data for larger sizes, but this one will be 4 
instead of 3. I've tried a 1x1 file, but that one wouldn't play at all. 
Anyway, run ffplay with "-v debug" to output the packet size and the stride.

If you have a better solution, feel free to change the stride 
calculation code. I suppose it's not that bad after all, since there 
aren't too many users who use 3 x 3 pixel videos out there. But it's a 
bit irritating nevertheless. Life would be easier if there were no 
padding between the video data and the palette, but I guess it's done 
for memory alignment purposes.

Just remember this: When using "-vcodec copy" with nut as the output, 
FFmpeg will happily copy the video to the file without ever considering 
the stride of it. Therefore, it's not possible to base the stride on 
avctx->width for nut. It would of course be much easier. One will have 
to divide the packet size (minus the palette size, 1024 bytes, in the 
case of pal8 nut) with the height, in the same way as the stride is 
calculated for AVI and QuickTime. They don't contain any palette in the 
packets, of course.

Original description follows:

This patch removes the monowhite switching code for 1 bpp raw AVI 
without a palette. I don't see any reason to keep it, since it's 
semantically incorrect to use monowhite for palettized data in my book, 
it adds unnecessary noise to the code, and it's inconsistent with the 
rest of the code in FFmpeg.

For black & white AVI or QuickTime files, in order to produce a 
monochrome nut file, force the pixel format with "-pix_fmt monow" or 
"-pix_fmt monob".

Unfortunately, there is a problem with converting from pal8 to monow, 
and I know what it is now. There seems to be some weird dithering going 
on of the white color, so there will be black pixels here and there in 
the monow output. A better way is to use "ffmpeg -i 1bpp.avi -vcodec 
copy -vtag B1W0 1bpp.nut". The "-vtag" option is currently needed, 
otherwise FFmpeg will use a RGB[15] codec tag for some reason.

I have also updated the 1 bpp FATE test files (once again).

Mats
-- 
Mats Peterson
http://matsp888.no-ip.org/~mats/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3x3.nut
Type: application/octet-stream
Size: 1331 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160211/a705651c/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavc-rawdec-Remove-monowhite-switching-code-for-1-bp.patch
Type: text/x-patch
Size: 7293 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160211/a705651c/attachment.bin>


More information about the ffmpeg-devel mailing list