[FFmpeg-devel] [PATCH]v308 and yuv4 encoders and decoders

Derek Buitenhuis derek.buitenhuis at gmail.com
Fri Dec 30 20:30:17 CET 2011


On 30/12/2011 1:50 PM, Carl Eugen Hoyos wrote:
> Derek Buitenhuis<derek.buitenhuis<at>  gmail.com>  writes:
>
>> So I checked libquicktime's source code. The part you copied the ^0x80
>> from is yuv2.
>
> I copied it from libavcodec/rawdec.c, the only thing I used the libquicktime
> source for was to confirm that Y is 2x2. (Theoretically, it could be 4x1, or am
> I misunderstanding?)
>
>> yuv2 can have signed chroma (i.e. can have a negative
>> value), and that's why it xors with 0x80. yuv4 has unsigned chroma, so
>> I do not think you should be xoring with 0x80.
>
> Did you test?

No, but no I have.

>
>> Can you, say, compare output of libquicktime with your
>> decoder/encoder?
>
> I may be misunderstanding "compare" but without "^ 0x80", output looks very
> broken to me.

Ok, so after, testing, you are indeed correct. yuv4.c is anything but
nice read, however I found yuv4toyuv.c, which has:

>                 *u_out1++ = (int)*input_row++ + 0x80;
>                 *v_out1++ = (int)*input_row++ + 0x80;

Which would be equivalent to what you do, if all values
read in only use the lower 7 bits. I think.

I think it SHOULD be fine, since we do the same thing for
yuv2, which needs this as well.

- Derek


More information about the ffmpeg-devel mailing list