Commit 101ada9a authored by Michael Niedermayer's avatar Michael Niedermayer

Rename most non static h263 tables so their name contains h263.

Originally committed as revision 21098 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent fef59a5b
...@@ -505,7 +505,7 @@ static void h263_encode_block(MpegEncContext * s, DCTELEM * block, int n) ...@@ -505,7 +505,7 @@ static void h263_encode_block(MpegEncContext * s, DCTELEM * block, int n)
int level, run, last, i, j, last_index, last_non_zero, sign, slevel, code; int level, run, last, i, j, last_index, last_non_zero, sign, slevel, code;
RLTable *rl; RLTable *rl;
rl = &rl_inter; rl = &ff_h263_rl_inter;
if (s->mb_intra && !s->h263_aic) { if (s->mb_intra && !s->h263_aic) {
/* DC coef */ /* DC coef */
level = block[0]; level = block[0];
...@@ -723,10 +723,10 @@ void h263_encode_mb(MpegEncContext * s, ...@@ -723,10 +723,10 @@ void h263_encode_mb(MpegEncContext * s,
if(s->dquant) cbpc+= 8; if(s->dquant) cbpc+= 8;
if(s->mv_type==MV_TYPE_16X16){ if(s->mv_type==MV_TYPE_16X16){
put_bits(&s->pb, put_bits(&s->pb,
inter_MCBPC_bits[cbpc], ff_h263_inter_MCBPC_bits[cbpc],
inter_MCBPC_code[cbpc]); ff_h263_inter_MCBPC_code[cbpc]);
put_bits(&s->pb, cbpy_tab[cbpy][1], cbpy_tab[cbpy][0]); put_bits(&s->pb, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
if(s->dquant) if(s->dquant)
put_bits(&s->pb, 2, dquant_code[s->dquant+2]); put_bits(&s->pb, 2, dquant_code[s->dquant+2]);
...@@ -750,9 +750,9 @@ void h263_encode_mb(MpegEncContext * s, ...@@ -750,9 +750,9 @@ void h263_encode_mb(MpegEncContext * s,
} }
}else{ }else{
put_bits(&s->pb, put_bits(&s->pb,
inter_MCBPC_bits[cbpc+16], ff_h263_inter_MCBPC_bits[cbpc+16],
inter_MCBPC_code[cbpc+16]); ff_h263_inter_MCBPC_code[cbpc+16]);
put_bits(&s->pb, cbpy_tab[cbpy][1], cbpy_tab[cbpy][0]); put_bits(&s->pb, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
if(s->dquant) if(s->dquant)
put_bits(&s->pb, 2, dquant_code[s->dquant+2]); put_bits(&s->pb, 2, dquant_code[s->dquant+2]);
...@@ -845,21 +845,21 @@ void h263_encode_mb(MpegEncContext * s, ...@@ -845,21 +845,21 @@ void h263_encode_mb(MpegEncContext * s,
if (s->pict_type == FF_I_TYPE) { if (s->pict_type == FF_I_TYPE) {
if(s->dquant) cbpc+=4; if(s->dquant) cbpc+=4;
put_bits(&s->pb, put_bits(&s->pb,
intra_MCBPC_bits[cbpc], ff_h263_intra_MCBPC_bits[cbpc],
intra_MCBPC_code[cbpc]); ff_h263_intra_MCBPC_code[cbpc]);
} else { } else {
if(s->dquant) cbpc+=8; if(s->dquant) cbpc+=8;
put_bits(&s->pb, 1, 0); /* mb coded */ put_bits(&s->pb, 1, 0); /* mb coded */
put_bits(&s->pb, put_bits(&s->pb,
inter_MCBPC_bits[cbpc + 4], ff_h263_inter_MCBPC_bits[cbpc + 4],
inter_MCBPC_code[cbpc + 4]); ff_h263_inter_MCBPC_code[cbpc + 4]);
} }
if (s->h263_aic) { if (s->h263_aic) {
/* XXX: currently, we do not try to use ac prediction */ /* XXX: currently, we do not try to use ac prediction */
put_bits(&s->pb, 1, 0); /* no AC prediction */ put_bits(&s->pb, 1, 0); /* no AC prediction */
} }
cbpy = cbp >> 2; cbpy = cbp >> 2;
put_bits(&s->pb, cbpy_tab[cbpy][1], cbpy_tab[cbpy][0]); put_bits(&s->pb, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
if(s->dquant) if(s->dquant)
put_bits(&s->pb, 2, dquant_code[s->dquant+2]); put_bits(&s->pb, 2, dquant_code[s->dquant+2]);
...@@ -1247,11 +1247,11 @@ void h263_encode_init(MpegEncContext *s) ...@@ -1247,11 +1247,11 @@ void h263_encode_init(MpegEncContext *s)
if (!done) { if (!done) {
done = 1; done = 1;
init_rl(&rl_inter, static_rl_table_store[0]); init_rl(&ff_h263_rl_inter, static_rl_table_store[0]);
init_rl(&rl_intra_aic, static_rl_table_store[1]); init_rl(&rl_intra_aic, static_rl_table_store[1]);
init_uni_h263_rl_tab(&rl_intra_aic, NULL, uni_h263_intra_aic_rl_len); init_uni_h263_rl_tab(&rl_intra_aic, NULL, uni_h263_intra_aic_rl_len);
init_uni_h263_rl_tab(&rl_inter , NULL, uni_h263_inter_rl_len); init_uni_h263_rl_tab(&ff_h263_rl_inter , NULL, uni_h263_inter_rl_len);
init_mv_penalty_and_fcode(s); init_mv_penalty_and_fcode(s);
} }
...@@ -1305,9 +1305,9 @@ void h263_encode_init(MpegEncContext *s) ...@@ -1305,9 +1305,9 @@ void h263_encode_init(MpegEncContext *s)
/***********************************************/ /***********************************************/
/* decoding */ /* decoding */
VLC intra_MCBPC_vlc; VLC ff_h263_intra_MCBPC_vlc;
VLC inter_MCBPC_vlc; VLC ff_h263_inter_MCBPC_vlc;
VLC cbpy_vlc; VLC ff_h263_cbpy_vlc;
static VLC mv_vlc; static VLC mv_vlc;
static VLC h263_mbtype_b_vlc; static VLC h263_mbtype_b_vlc;
static VLC cbpc_b_vlc; static VLC cbpc_b_vlc;
...@@ -1322,21 +1322,21 @@ void h263_decode_init_vlc(MpegEncContext *s) ...@@ -1322,21 +1322,21 @@ void h263_decode_init_vlc(MpegEncContext *s)
if (!done) { if (!done) {
done = 1; done = 1;
INIT_VLC_STATIC(&intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 9, INIT_VLC_STATIC(&ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 9,
intra_MCBPC_bits, 1, 1, ff_h263_intra_MCBPC_bits, 1, 1,
intra_MCBPC_code, 1, 1, 72); ff_h263_intra_MCBPC_code, 1, 1, 72);
INIT_VLC_STATIC(&inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 28, INIT_VLC_STATIC(&ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 28,
inter_MCBPC_bits, 1, 1, ff_h263_inter_MCBPC_bits, 1, 1,
inter_MCBPC_code, 1, 1, 198); ff_h263_inter_MCBPC_code, 1, 1, 198);
INIT_VLC_STATIC(&cbpy_vlc, CBPY_VLC_BITS, 16, INIT_VLC_STATIC(&ff_h263_cbpy_vlc, CBPY_VLC_BITS, 16,
&cbpy_tab[0][1], 2, 1, &ff_h263_cbpy_tab[0][1], 2, 1,
&cbpy_tab[0][0], 2, 1, 64); &ff_h263_cbpy_tab[0][0], 2, 1, 64);
INIT_VLC_STATIC(&mv_vlc, MV_VLC_BITS, 33, INIT_VLC_STATIC(&mv_vlc, MV_VLC_BITS, 33,
&mvtab[0][1], 2, 1, &mvtab[0][1], 2, 1,
&mvtab[0][0], 2, 1, 538); &mvtab[0][0], 2, 1, 538);
init_rl(&rl_inter, static_rl_table_store[0]); init_rl(&ff_h263_rl_inter, static_rl_table_store[0]);
init_rl(&rl_intra_aic, static_rl_table_store[1]); init_rl(&rl_intra_aic, static_rl_table_store[1]);
INIT_VLC_RL(rl_inter, 554); INIT_VLC_RL(ff_h263_rl_inter, 554);
INIT_VLC_RL(rl_intra_aic, 554); INIT_VLC_RL(rl_intra_aic, 554);
INIT_VLC_STATIC(&h263_mbtype_b_vlc, H263_MBTYPE_B_VLC_BITS, 15, INIT_VLC_STATIC(&h263_mbtype_b_vlc, H263_MBTYPE_B_VLC_BITS, 15,
&h263_mbtype_b_tab[0][1], 2, 1, &h263_mbtype_b_tab[0][1], 2, 1,
...@@ -1606,13 +1606,13 @@ static void preview_obmc(MpegEncContext *s){ ...@@ -1606,13 +1606,13 @@ static void preview_obmc(MpegEncContext *s){
s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
goto end; goto end;
} }
cbpc = get_vlc2(&s->gb, inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2); cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
}while(cbpc == 20); }while(cbpc == 20);
if(cbpc & 4){ if(cbpc & 4){
s->current_picture.mb_type[xy]= MB_TYPE_INTRA; s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
}else{ }else{
get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1); get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
if (cbpc & 8) { if (cbpc & 8) {
if(s->modified_quant){ if(s->modified_quant){
if(get_bits1(&s->gb)) skip_bits(&s->gb, 1); if(get_bits1(&s->gb)) skip_bits(&s->gb, 1);
...@@ -1687,7 +1687,7 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block, ...@@ -1687,7 +1687,7 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block,
int n, int coded) int n, int coded)
{ {
int code, level, i, j, last, run; int code, level, i, j, last, run;
RLTable *rl = &rl_inter; RLTable *rl = &ff_h263_rl_inter;
const uint8_t *scan_table; const uint8_t *scan_table;
GetBitContext gb= s->gb; GetBitContext gb= s->gb;
...@@ -1780,7 +1780,7 @@ retry: ...@@ -1780,7 +1780,7 @@ retry:
} }
i += run; i += run;
if (i >= 64){ if (i >= 64){
if(s->alt_inter_vlc && rl == &rl_inter && !s->mb_intra){ if(s->alt_inter_vlc && rl == &ff_h263_rl_inter && !s->mb_intra){
//Looks like a hack but no, it's the way it is supposed to work ... //Looks like a hack but no, it's the way it is supposed to work ...
rl = &rl_intra_aic; rl = &rl_intra_aic;
i = 0; i = 0;
...@@ -1868,7 +1868,7 @@ int ff_h263_decode_mb(MpegEncContext *s, ...@@ -1868,7 +1868,7 @@ int ff_h263_decode_mb(MpegEncContext *s,
s->mb_skipped = !(s->obmc | s->loop_filter); s->mb_skipped = !(s->obmc | s->loop_filter);
goto end; goto end;
} }
cbpc = get_vlc2(&s->gb, inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2); cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
if (cbpc < 0){ if (cbpc < 0){
av_log(s->avctx, AV_LOG_ERROR, "cbpc damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
...@@ -1883,7 +1883,7 @@ int ff_h263_decode_mb(MpegEncContext *s, ...@@ -1883,7 +1883,7 @@ int ff_h263_decode_mb(MpegEncContext *s,
if(s->pb_frame && get_bits1(&s->gb)) if(s->pb_frame && get_bits1(&s->gb))
pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb); pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb);
cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1); cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
if(s->alt_inter_vlc==0 || (cbpc & 3)!=3) if(s->alt_inter_vlc==0 || (cbpc & 3)!=3)
cbpy ^= 0xF; cbpy ^= 0xF;
...@@ -1977,7 +1977,7 @@ int ff_h263_decode_mb(MpegEncContext *s, ...@@ -1977,7 +1977,7 @@ int ff_h263_decode_mb(MpegEncContext *s,
goto intra; goto intra;
} }
cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1); cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
if (cbpy < 0){ if (cbpy < 0){
av_log(s->avctx, AV_LOG_ERROR, "b cbpy damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "b cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
...@@ -2035,7 +2035,7 @@ int ff_h263_decode_mb(MpegEncContext *s, ...@@ -2035,7 +2035,7 @@ int ff_h263_decode_mb(MpegEncContext *s,
s->current_picture.mb_type[xy]= mb_type; s->current_picture.mb_type[xy]= mb_type;
} else { /* I-Frame */ } else { /* I-Frame */
do{ do{
cbpc = get_vlc2(&s->gb, intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2); cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
if (cbpc < 0){ if (cbpc < 0){
av_log(s->avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
...@@ -2060,7 +2060,7 @@ intra: ...@@ -2060,7 +2060,7 @@ intra:
if(s->pb_frame && get_bits1(&s->gb)) if(s->pb_frame && get_bits1(&s->gb))
pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb); pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb);
cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1); cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
if(cbpy<0){ if(cbpy<0){
av_log(s->avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
......
...@@ -30,21 +30,21 @@ ...@@ -30,21 +30,21 @@
#define TEX_VLC_BITS 9 #define TEX_VLC_BITS 9
extern const AVRational ff_h263_pixel_aspect[16]; extern const AVRational ff_h263_pixel_aspect[16];
extern const uint8_t cbpy_tab[16][2]; extern const uint8_t ff_h263_cbpy_tab[16][2];
extern const uint8_t mvtab[33][2]; extern const uint8_t mvtab[33][2];
extern const uint8_t intra_MCBPC_code[9]; extern const uint8_t ff_h263_intra_MCBPC_code[9];
extern const uint8_t intra_MCBPC_bits[9]; extern const uint8_t ff_h263_intra_MCBPC_bits[9];
extern const uint8_t inter_MCBPC_code[28]; extern const uint8_t ff_h263_inter_MCBPC_code[28];
extern const uint8_t inter_MCBPC_bits[28]; extern const uint8_t ff_h263_inter_MCBPC_bits[28];
extern VLC intra_MCBPC_vlc; extern VLC ff_h263_intra_MCBPC_vlc;
extern VLC inter_MCBPC_vlc; extern VLC ff_h263_inter_MCBPC_vlc;
extern VLC cbpy_vlc; extern VLC ff_h263_cbpy_vlc;
extern RLTable rl_inter; extern RLTable ff_h263_rl_inter;
int h263_decode_motion(MpegEncContext * s, int pred, int f_code); int h263_decode_motion(MpegEncContext * s, int pred, int f_code);
av_const int ff_h263_aspect_to_info(AVRational aspect); av_const int ff_h263_aspect_to_info(AVRational aspect);
...@@ -90,7 +90,7 @@ static inline int get_p_cbp(MpegEncContext * s, ...@@ -90,7 +90,7 @@ static inline int get_p_cbp(MpegEncContext * s,
const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6); const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
for(i=0; i<4; i++){ for(i=0; i<4; i++){
int score= inter_MCBPC_bits[i + offset] * lambda; int score= ff_h263_inter_MCBPC_bits[i + offset] * lambda;
if(i&1) score += s->coded_score[5]; if(i&1) score += s->coded_score[5];
if(i&2) score += s->coded_score[4]; if(i&2) score += s->coded_score[4];
...@@ -101,7 +101,7 @@ static inline int get_p_cbp(MpegEncContext * s, ...@@ -101,7 +101,7 @@ static inline int get_p_cbp(MpegEncContext * s,
} }
for(i=0; i<16; i++){ for(i=0; i<16; i++){
int score= cbpy_tab[i ^ 0xF][1] * lambda; int score= ff_h263_cbpy_tab[i ^ 0xF][1] * lambda;
if(i&1) score += s->coded_score[3]; if(i&1) score += s->coded_score[3];
if(i&2) score += s->coded_score[2]; if(i&2) score += s->coded_score[2];
if(i&4) score += s->coded_score[1]; if(i&4) score += s->coded_score[1];
......
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
#include "mpegvideo.h" #include "mpegvideo.h"
/* intra MCBPC, mb_type = (intra), then (intraq) */ /* intra MCBPC, mb_type = (intra), then (intraq) */
const uint8_t intra_MCBPC_code[9] = { 1, 1, 2, 3, 1, 1, 2, 3, 1 }; const uint8_t ff_h263_intra_MCBPC_code[9] = { 1, 1, 2, 3, 1, 1, 2, 3, 1 };
const uint8_t intra_MCBPC_bits[9] = { 1, 3, 3, 3, 4, 6, 6, 6, 9 }; const uint8_t ff_h263_intra_MCBPC_bits[9] = { 1, 3, 3, 3, 4, 6, 6, 6, 9 };
/* inter MCBPC, mb_type = (inter), (intra), (interq), (intraq), (inter4v) */ /* inter MCBPC, mb_type = (inter), (intra), (interq), (intraq), (inter4v) */
/* Changed the tables for interq and inter4v+q, following the standard ** Juanjo ** */ /* Changed the tables for interq and inter4v+q, following the standard ** Juanjo ** */
const uint8_t inter_MCBPC_code[28] = { const uint8_t ff_h263_inter_MCBPC_code[28] = {
1, 3, 2, 5, 1, 3, 2, 5,
3, 4, 3, 3, 3, 4, 3, 3,
3, 7, 6, 5, 3, 7, 6, 5,
...@@ -47,7 +47,7 @@ const uint8_t inter_MCBPC_code[28] = { ...@@ -47,7 +47,7 @@ const uint8_t inter_MCBPC_code[28] = {
1, 0, 0, 0, /* Stuffing */ 1, 0, 0, 0, /* Stuffing */
2, 12, 14, 15, 2, 12, 14, 15,
}; };
const uint8_t inter_MCBPC_bits[28] = { const uint8_t ff_h263_inter_MCBPC_bits[28] = {
1, 4, 4, 6, /* inter */ 1, 4, 4, 6, /* inter */
5, 8, 8, 7, /* intra */ 5, 8, 8, 7, /* intra */
3, 7, 7, 9, /* interQ */ 3, 7, 7, 9, /* interQ */
...@@ -100,7 +100,7 @@ static const uint8_t cbpc_b_tab[4][2] = { ...@@ -100,7 +100,7 @@ static const uint8_t cbpc_b_tab[4][2] = {
{6, 3}, {6, 3},
}; };
const uint8_t cbpy_tab[16][2] = const uint8_t ff_h263_cbpy_tab[16][2] =
{ {
{3,4}, {5,5}, {4,5}, {9,4}, {3,5}, {7,4}, {2,6}, {11,4}, {3,4}, {5,5}, {4,5}, {9,4}, {3,5}, {7,4}, {2,6}, {11,4},
{2,5}, {3,6}, {5,4}, {10,4}, {4,4}, {8,4}, {6,4}, {3,2} {2,5}, {3,6}, {5,4}, {10,4}, {4,4}, {8,4}, {6,4}, {3,2}
...@@ -177,7 +177,7 @@ const int8_t inter_run[102] = { ...@@ -177,7 +177,7 @@ const int8_t inter_run[102] = {
35, 36, 37, 38, 39, 40, 35, 36, 37, 38, 39, 40,
}; };
RLTable rl_inter = { RLTable ff_h263_rl_inter = {
102, 102,
58, 58,
inter_vlc, inter_vlc,
......
...@@ -556,7 +556,7 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){ ...@@ -556,7 +556,7 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){
return mb_num-1; return mb_num-1;
} }
cbpc = get_vlc2(&s->gb, intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2); cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
if (cbpc < 0){ if (cbpc < 0){
av_log(s->avctx, AV_LOG_ERROR, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
...@@ -615,7 +615,7 @@ try_again: ...@@ -615,7 +615,7 @@ try_again:
continue; continue;
} }
cbpc = get_vlc2(&s->gb, inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2); cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
if (cbpc < 0){ if (cbpc < 0){
av_log(s->avctx, AV_LOG_ERROR, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
...@@ -712,7 +712,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){ ...@@ -712,7 +712,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){
if(s->pict_type==FF_I_TYPE){ if(s->pict_type==FF_I_TYPE){
int ac_pred= get_bits1(&s->gb); int ac_pred= get_bits1(&s->gb);
int cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1); int cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
if(cbpy<0){ if(cbpy<0){
av_log(s->avctx, AV_LOG_ERROR, "cbpy corrupted at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
...@@ -724,7 +724,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){ ...@@ -724,7 +724,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){
if(IS_INTRA(s->current_picture.mb_type[xy])){ if(IS_INTRA(s->current_picture.mb_type[xy])){
int dir=0,i; int dir=0,i;
int ac_pred = get_bits1(&s->gb); int ac_pred = get_bits1(&s->gb);
int cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1); int cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
if(cbpy<0){ if(cbpy<0){
av_log(s->avctx, AV_LOG_ERROR, "I cbpy corrupted at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "I cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
...@@ -754,7 +754,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){ ...@@ -754,7 +754,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){
s->current_picture.qscale_table[xy]= s->qscale; s->current_picture.qscale_table[xy]= s->qscale;
s->cbp_table[xy]= 0; s->cbp_table[xy]= 0;
}else{ }else{
int cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1); int cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
if(cbpy<0){ if(cbpy<0){
av_log(s->avctx, AV_LOG_ERROR, "P cbpy corrupted at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "P cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
...@@ -892,7 +892,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, ...@@ -892,7 +892,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
return 0; return 0;
} }
if(rvlc) rl = &rvlc_rl_inter; if(rvlc) rl = &rvlc_rl_inter;
else rl = &rl_inter; else rl = &ff_h263_rl_inter;
scan_table = s->intra_scantable.permutated; scan_table = s->intra_scantable.permutated;
...@@ -902,7 +902,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, ...@@ -902,7 +902,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
if(rvlc){ if(rvlc){
rl_vlc = rvlc_rl_inter.rl_vlc[0]; rl_vlc = rvlc_rl_inter.rl_vlc[0];
}else{ }else{
rl_vlc = rl_inter.rl_vlc[0]; rl_vlc = ff_h263_rl_inter.rl_vlc[0];
} }
}else{ }else{
qmul = s->qscale << 1; qmul = s->qscale << 1;
...@@ -910,7 +910,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, ...@@ -910,7 +910,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
if(rvlc){ if(rvlc){
rl_vlc = rvlc_rl_inter.rl_vlc[s->qscale]; rl_vlc = rvlc_rl_inter.rl_vlc[s->qscale];
}else{ }else{
rl_vlc = rl_inter.rl_vlc[s->qscale]; rl_vlc = ff_h263_rl_inter.rl_vlc[s->qscale];
} }
} }
} }
...@@ -1207,7 +1207,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, ...@@ -1207,7 +1207,7 @@ static int mpeg4_decode_mb(MpegEncContext *s,
} }
goto end; goto end;
} }
cbpc = get_vlc2(&s->gb, inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2); cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
if (cbpc < 0){ if (cbpc < 0){
av_log(s->avctx, AV_LOG_ERROR, "cbpc damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
...@@ -1222,7 +1222,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, ...@@ -1222,7 +1222,7 @@ static int mpeg4_decode_mb(MpegEncContext *s,
if(s->pict_type==FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE && (cbpc & 16) == 0) if(s->pict_type==FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE && (cbpc & 16) == 0)
s->mcsel= get_bits1(&s->gb); s->mcsel= get_bits1(&s->gb);
else s->mcsel= 0; else s->mcsel= 0;
cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1) ^ 0x0F; cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1) ^ 0x0F;
cbp = (cbpc & 3) | (cbpy << 2); cbp = (cbpc & 3) | (cbpy << 2);
if (dquant) { if (dquant) {
...@@ -1438,7 +1438,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, ...@@ -1438,7 +1438,7 @@ static int mpeg4_decode_mb(MpegEncContext *s,
s->current_picture.mb_type[xy]= mb_type; s->current_picture.mb_type[xy]= mb_type;
} else { /* I-Frame */ } else { /* I-Frame */
do{ do{
cbpc = get_vlc2(&s->gb, intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2); cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
if (cbpc < 0){ if (cbpc < 0){
av_log(s->avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
...@@ -1454,7 +1454,7 @@ intra: ...@@ -1454,7 +1454,7 @@ intra:
else else
s->current_picture.mb_type[xy]= MB_TYPE_INTRA; s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
cbpy = get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1); cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
if(cbpy<0){ if(cbpy<0){
av_log(s->avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
......
...@@ -315,7 +315,7 @@ static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n ...@@ -315,7 +315,7 @@ static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n
} else { } else {
if(last_index<0) return; if(last_index<0) return;
i = 0; i = 0;
rl = &rl_inter; rl = &ff_h263_rl_inter;
bits_tab= uni_mpeg4_inter_rl_bits; bits_tab= uni_mpeg4_inter_rl_bits;
len_tab = uni_mpeg4_inter_rl_len; len_tab = uni_mpeg4_inter_rl_len;
} }
...@@ -697,10 +697,10 @@ void mpeg4_encode_mb(MpegEncContext * s, ...@@ -697,10 +697,10 @@ void mpeg4_encode_mb(MpegEncContext * s,
if(s->mv_type==MV_TYPE_16X16){ if(s->mv_type==MV_TYPE_16X16){
if(s->dquant) cbpc+= 8; if(s->dquant) cbpc+= 8;
put_bits(&s->pb, put_bits(&s->pb,
inter_MCBPC_bits[cbpc], ff_h263_inter_MCBPC_bits[cbpc],
inter_MCBPC_code[cbpc]); ff_h263_inter_MCBPC_code[cbpc]);
put_bits(pb2, cbpy_tab[cbpy][1], cbpy_tab[cbpy][0]); put_bits(pb2, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
if(s->dquant) if(s->dquant)
put_bits(pb2, 2, dquant_code[s->dquant+2]); put_bits(pb2, 2, dquant_code[s->dquant+2]);
...@@ -722,10 +722,10 @@ void mpeg4_encode_mb(MpegEncContext * s, ...@@ -722,10 +722,10 @@ void mpeg4_encode_mb(MpegEncContext * s,
}else if(s->mv_type==MV_TYPE_FIELD){ }else if(s->mv_type==MV_TYPE_FIELD){
if(s->dquant) cbpc+= 8; if(s->dquant) cbpc+= 8;
put_bits(&s->pb, put_bits(&s->pb,
inter_MCBPC_bits[cbpc], ff_h263_inter_MCBPC_bits[cbpc],
inter_MCBPC_code[cbpc]); ff_h263_inter_MCBPC_code[cbpc]);
put_bits(pb2, cbpy_tab[cbpy][1], cbpy_tab[cbpy][0]); put_bits(pb2, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
if(s->dquant) if(s->dquant)
put_bits(pb2, 2, dquant_code[s->dquant+2]); put_bits(pb2, 2, dquant_code[s->dquant+2]);
...@@ -752,9 +752,9 @@ void mpeg4_encode_mb(MpegEncContext * s, ...@@ -752,9 +752,9 @@ void mpeg4_encode_mb(MpegEncContext * s,
}else{ }else{
assert(s->mv_type==MV_TYPE_8X8); assert(s->mv_type==MV_TYPE_8X8);
put_bits(&s->pb, put_bits(&s->pb,
inter_MCBPC_bits[cbpc+16], ff_h263_inter_MCBPC_bits[cbpc+16],
inter_MCBPC_code[cbpc+16]); ff_h263_inter_MCBPC_code[cbpc+16]);
put_bits(pb2, cbpy_tab[cbpy][1], cbpy_tab[cbpy][0]); put_bits(pb2, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
if(!s->progressive_sequence){ if(!s->progressive_sequence){
if(cbp) if(cbp)
...@@ -815,18 +815,18 @@ void mpeg4_encode_mb(MpegEncContext * s, ...@@ -815,18 +815,18 @@ void mpeg4_encode_mb(MpegEncContext * s,
if (s->pict_type == FF_I_TYPE) { if (s->pict_type == FF_I_TYPE) {
if(s->dquant) cbpc+=4; if(s->dquant) cbpc+=4;
put_bits(&s->pb, put_bits(&s->pb,
intra_MCBPC_bits[cbpc], ff_h263_intra_MCBPC_bits[cbpc],
intra_MCBPC_code[cbpc]); ff_h263_intra_MCBPC_code[cbpc]);
} else { } else {
if(s->dquant) cbpc+=8; if(s->dquant) cbpc+=8;
put_bits(&s->pb, 1, 0); /* mb coded */ put_bits(&s->pb, 1, 0); /* mb coded */
put_bits(&s->pb, put_bits(&s->pb,
inter_MCBPC_bits[cbpc + 4], ff_h263_inter_MCBPC_bits[cbpc + 4],
inter_MCBPC_code[cbpc + 4]); ff_h263_inter_MCBPC_code[cbpc + 4]);
} }
put_bits(pb2, 1, s->ac_pred); put_bits(pb2, 1, s->ac_pred);
cbpy = cbp >> 2; cbpy = cbp >> 2;
put_bits(pb2, cbpy_tab[cbpy][1], cbpy_tab[cbpy][0]); put_bits(pb2, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
if(s->dquant) if(s->dquant)
put_bits(dc_pb, 2, dquant_code[s->dquant+2]); put_bits(dc_pb, 2, dquant_code[s->dquant+2]);
...@@ -1255,7 +1255,7 @@ static av_cold int encode_init(AVCodecContext *avctx) ...@@ -1255,7 +1255,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
init_rl(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]); init_rl(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]);
init_uni_mpeg4_rl_tab(&ff_mpeg4_rl_intra, uni_mpeg4_intra_rl_bits, uni_mpeg4_intra_rl_len); init_uni_mpeg4_rl_tab(&ff_mpeg4_rl_intra, uni_mpeg4_intra_rl_bits, uni_mpeg4_intra_rl_len);
init_uni_mpeg4_rl_tab(&rl_inter, uni_mpeg4_inter_rl_bits, uni_mpeg4_inter_rl_len); init_uni_mpeg4_rl_tab(&ff_h263_rl_inter, uni_mpeg4_inter_rl_bits, uni_mpeg4_inter_rl_len);
} }
s->min_qcoeff= -2048; s->min_qcoeff= -2048;
......
...@@ -576,8 +576,8 @@ void msmpeg4_encode_mb(MpegEncContext * s, ...@@ -576,8 +576,8 @@ void msmpeg4_encode_mb(MpegEncContext * s,
else coded_cbp= cbp; else coded_cbp= cbp;
put_bits(&s->pb, put_bits(&s->pb,
cbpy_tab[coded_cbp>>2][1], ff_h263_cbpy_tab[coded_cbp>>2][1],
cbpy_tab[coded_cbp>>2][0]); ff_h263_cbpy_tab[coded_cbp>>2][0]);
s->misc_bits += get_bits_diff(s); s->misc_bits += get_bits_diff(s);
...@@ -637,8 +637,8 @@ void msmpeg4_encode_mb(MpegEncContext * s, ...@@ -637,8 +637,8 @@ void msmpeg4_encode_mb(MpegEncContext * s,
} }
put_bits(&s->pb, 1, 0); /* no AC prediction yet */ put_bits(&s->pb, 1, 0); /* no AC prediction yet */
put_bits(&s->pb, put_bits(&s->pb,
cbpy_tab[cbp>>2][1], ff_h263_cbpy_tab[cbp>>2][1],
cbpy_tab[cbp>>2][0]); ff_h263_cbpy_tab[cbp>>2][0]);
}else{ }else{
if (s->pict_type == FF_I_TYPE) { if (s->pict_type == FF_I_TYPE) {
put_bits(&s->pb, put_bits(&s->pb,
...@@ -1146,7 +1146,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) ...@@ -1146,7 +1146,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
if (!s->mb_intra) { if (!s->mb_intra) {
int mx, my, cbpy; int mx, my, cbpy;
cbpy= get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1); cbpy= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
if(cbpy<0){ if(cbpy<0){
av_log(s->avctx, AV_LOG_ERROR, "cbpy %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpy %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
return -1; return -1;
...@@ -1166,10 +1166,10 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) ...@@ -1166,10 +1166,10 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
} else { } else {
if(s->msmpeg4_version==2){ if(s->msmpeg4_version==2){
s->ac_pred = get_bits1(&s->gb); s->ac_pred = get_bits1(&s->gb);
cbp|= get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; //FIXME check errors cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; //FIXME check errors
} else{ } else{
s->ac_pred = 0; s->ac_pred = 0;
cbp|= get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; //FIXME check errors cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; //FIXME check errors
if(s->pict_type==FF_P_TYPE) cbp^=0x3C; if(s->pict_type==FF_P_TYPE) cbp^=0x3C;
} }
} }
...@@ -1326,9 +1326,9 @@ av_cold int ff_msmpeg4_decode_init(MpegEncContext *s) ...@@ -1326,9 +1326,9 @@ av_cold int ff_msmpeg4_decode_init(MpegEncContext *s)
&v2_dc_chroma_table[0][1], 8, 4, &v2_dc_chroma_table[0][1], 8, 4,
&v2_dc_chroma_table[0][0], 8, 4, 1506); &v2_dc_chroma_table[0][0], 8, 4, 1506);
INIT_VLC_STATIC(&cbpy_vlc, CBPY_VLC_BITS, 16, INIT_VLC_STATIC(&ff_h263_cbpy_vlc, CBPY_VLC_BITS, 16,
&cbpy_tab[0][1], 2, 1, &ff_h263_cbpy_tab[0][1], 2, 1,
&cbpy_tab[0][0], 2, 1, 64); &ff_h263_cbpy_tab[0][0], 2, 1, 64);
INIT_VLC_STATIC(&v2_intra_cbpc_vlc, V2_INTRA_CBPC_VLC_BITS, 4, INIT_VLC_STATIC(&v2_intra_cbpc_vlc, V2_INTRA_CBPC_VLC_BITS, 4,
&v2_intra_cbpc[0][1], 2, 1, &v2_intra_cbpc[0][1], 2, 1,
&v2_intra_cbpc[0][0], 2, 1, 8); &v2_intra_cbpc[0][0], 2, 1, 8);
...@@ -1357,11 +1357,11 @@ av_cold int ff_msmpeg4_decode_init(MpegEncContext *s) ...@@ -1357,11 +1357,11 @@ av_cold int ff_msmpeg4_decode_init(MpegEncContext *s)
&ff_msmp4_mb_i_table[0][0], 4, 2, 536); &ff_msmp4_mb_i_table[0][0], 4, 2, 536);
INIT_VLC_STATIC(&v1_intra_cbpc_vlc, V1_INTRA_CBPC_VLC_BITS, 8, INIT_VLC_STATIC(&v1_intra_cbpc_vlc, V1_INTRA_CBPC_VLC_BITS, 8,
intra_MCBPC_bits, 1, 1, ff_h263_intra_MCBPC_bits, 1, 1,
intra_MCBPC_code, 1, 1, 64); ff_h263_intra_MCBPC_code, 1, 1, 64);
INIT_VLC_STATIC(&v1_inter_cbpc_vlc, V1_INTER_CBPC_VLC_BITS, 25, INIT_VLC_STATIC(&v1_inter_cbpc_vlc, V1_INTER_CBPC_VLC_BITS, 25,
inter_MCBPC_bits, 1, 1, ff_h263_inter_MCBPC_bits, 1, 1,
inter_MCBPC_code, 1, 1, 104); ff_h263_inter_MCBPC_code, 1, 1, 104);
INIT_VLC_STATIC(&ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 4, INIT_VLC_STATIC(&ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 4,
&table_inter_intra[0][1], 2, 1, &table_inter_intra[0][1], 2, 1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment