[Ffmpeg-devel] Re: [RFC] mpeg2 422 encoding.
Michael Niedermayer
michaelni
Sat Apr 1 23:25:16 CEST 2006
Hi
On Sat, Apr 01, 2006 at 03:03:37AM +0200, Baptiste COUDURIER wrote:
[...]
> @@ -616,8 +636,12 @@ void mpeg1_encode_mb(MpegEncContext *s,
> }
> s->mv_bits+= get_bits_diff(s);
> }
> - if(cbp)
> - put_bits(&s->pb, mbPatTable[cbp][1], mbPatTable[cbp][0]);
> + if(cbp) {
> + put_bits(&s->pb, mbPatTable[cbp & 0x3f][1], mbPatTable[cbp & 0x3f][0]);
> + if (!s->chroma_y_shift) {
> + put_bits(&s->pb, 2, (cbp >> 6) & 3);
> + }
> + }
> s->f_count++;
> } else{
> static const int mb_type_len[4]={0,3,4,2}; //bak,for,bi
> @@ -695,11 +719,15 @@ void mpeg1_encode_mb(MpegEncContext *s,
> }
> }
> s->mv_bits += get_bits_diff(s);
> - if(cbp)
> - put_bits(&s->pb, mbPatTable[cbp][1], mbPatTable[cbp][0]);
> + if(cbp) {
> + put_bits(&s->pb, mbPatTable[cbp & 0x3f][1], mbPatTable[cbp & 0x3f][0]);
> + if (!s->chroma_y_shift) {
> + put_bits(&s->pb, 2, (cbp >> 6) & 3);
> + }
> + }
these are wrong, the following is correct
if (!s->chroma_y_shift) {
put_bits(&s->pb, mbPatTable[cbp>>2][1], mbPatTable[cbp>>2][0]);
put_bits(&s->pb, 2, cbp & 3);
}else
put_bits(&s->pb, mbPatTable[cbp][1], mbPatTable[cbp][0]);
also note that the whole 422 encoding support must not slow the much more
common 420 down by a "meassureable" amount
[...]
--
Michael
More information about the ffmpeg-devel
mailing list