mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
add vlc for cbp=0 that is valid in 422,444
Originally committed as revision 2838 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
50c93f74a6
commit
461cd5bfb5
@ -596,7 +596,7 @@ void mpeg1_encode_mb(MpegEncContext *s,
|
|||||||
s->mv_bits+= get_bits_diff(s);
|
s->mv_bits+= get_bits_diff(s);
|
||||||
}
|
}
|
||||||
if(cbp)
|
if(cbp)
|
||||||
put_bits(&s->pb, mbPatTable[cbp - 1][1], mbPatTable[cbp - 1][0]);
|
put_bits(&s->pb, mbPatTable[cbp][1], mbPatTable[cbp][0]);
|
||||||
s->f_count++;
|
s->f_count++;
|
||||||
} else{
|
} else{
|
||||||
static const int mb_type_len[4]={0,3,4,2}; //bak,for,bi
|
static const int mb_type_len[4]={0,3,4,2}; //bak,for,bi
|
||||||
@ -675,7 +675,7 @@ void mpeg1_encode_mb(MpegEncContext *s,
|
|||||||
}
|
}
|
||||||
s->mv_bits += get_bits_diff(s);
|
s->mv_bits += get_bits_diff(s);
|
||||||
if(cbp)
|
if(cbp)
|
||||||
put_bits(&s->pb, mbPatTable[cbp - 1][1], mbPatTable[cbp - 1][0]);
|
put_bits(&s->pb, mbPatTable[cbp][1], mbPatTable[cbp][0]);
|
||||||
}
|
}
|
||||||
for(i=0;i<6;i++) {
|
for(i=0;i<6;i++) {
|
||||||
if (cbp & (1 << (5 - i))) {
|
if (cbp & (1 << (5 - i))) {
|
||||||
@ -967,7 +967,7 @@ static void init_vlcs()
|
|||||||
init_vlc(&mbincr_vlc, MBINCR_VLC_BITS, 36,
|
init_vlc(&mbincr_vlc, MBINCR_VLC_BITS, 36,
|
||||||
&mbAddrIncrTable[0][1], 2, 1,
|
&mbAddrIncrTable[0][1], 2, 1,
|
||||||
&mbAddrIncrTable[0][0], 2, 1);
|
&mbAddrIncrTable[0][0], 2, 1);
|
||||||
init_vlc(&mb_pat_vlc, MB_PAT_VLC_BITS, 63,
|
init_vlc(&mb_pat_vlc, MB_PAT_VLC_BITS, 64,
|
||||||
&mbPatTable[0][1], 2, 1,
|
&mbPatTable[0][1], 2, 1,
|
||||||
&mbPatTable[0][0], 2, 1);
|
&mbPatTable[0][0], 2, 1);
|
||||||
|
|
||||||
@ -1306,11 +1306,10 @@ static int mpeg_decode_mb(MpegEncContext *s,
|
|||||||
|
|
||||||
if (HAS_CBP(mb_type)) {
|
if (HAS_CBP(mb_type)) {
|
||||||
cbp = get_vlc2(&s->gb, mb_pat_vlc.table, MB_PAT_VLC_BITS, 1);
|
cbp = get_vlc2(&s->gb, mb_pat_vlc.table, MB_PAT_VLC_BITS, 1);
|
||||||
if (cbp < 0){
|
if (cbp < 0 || (cbp == 0) && (s->chroma_format < 2) ){
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "invalid cbp at %d %d\n", s->mb_x, s->mb_y);
|
av_log(s->avctx, AV_LOG_ERROR, "invalid cbp at %d %d\n", s->mb_x, s->mb_y);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
cbp++;
|
|
||||||
if(s->chroma_format == 2){//CHROMA422
|
if(s->chroma_format == 2){//CHROMA422
|
||||||
cbp|= ( get_bits(&s->gb,2) ) << 6;
|
cbp|= ( get_bits(&s->gb,2) ) << 6;
|
||||||
}else
|
}else
|
||||||
|
@ -217,7 +217,8 @@ static const uint8_t mbAddrIncrTable[36][2] = {
|
|||||||
{0x0, 8}, /* end (and 15 more 0 bits should follow) */
|
{0x0, 8}, /* end (and 15 more 0 bits should follow) */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t mbPatTable[63][2] = {
|
static const uint8_t mbPatTable[64][2] = {
|
||||||
|
{0x1, 9},
|
||||||
{0xb, 5},
|
{0xb, 5},
|
||||||
{0x9, 5},
|
{0x9, 5},
|
||||||
{0xd, 6},
|
{0xd, 6},
|
||||||
|
Loading…
Reference in New Issue
Block a user