Showing the changes to libavcodec (2 of 2 files). Show all
Unified · Split
| @@ -52,11 +52,6 @@ · 51 unmodified lines | |||
| 52 | */ | 52 | */ |
| 53 | static uint8_t mv_penalty[MAX_FCODE+1][MAX_DMV*2+1]; | 53 | static uint8_t mv_penalty[MAX_FCODE+1][MAX_DMV*2+1]; |
| 54 | 54 | ||
| 55 | /** | ||
| 56 | * Minimal fcode that a motion vector component would need. | ||
| 57 | */ | ||
| 58 | static uint8_t fcode_tab[MAX_MV*2+1]; | ||
| 59 | |||
| 60 | /** | 55 | /** |
| 61 | * Minimal fcode that a motion vector component would need in umv. | 56 | * Minimal fcode that a motion vector component would need in umv. |
| 62 | * All entries in this table are 1. | 57 | * All entries in this table are 1. |
| @@ -762,12 +757,6 @@ static av_cold void init_mv_penalty_and_fcode(void) · 699 unmodified lines | |||
| 762 | } | 757 | } |
| 763 | } | 758 | } |
| 764 | 759 | ||
| 765 | for(f_code=MAX_FCODE; f_code>0; f_code--){ | ||
| 766 | for(mv=-(16<<f_code); mv<(16<<f_code); mv++){ | ||
| 767 | fcode_tab[mv+MAX_MV]= f_code; | ||
| 768 | } | ||
| 769 | } | ||
| 770 | |||
| 771 | for(mv=0; mv<MAX_MV*2+1; mv++){ | 760 | for(mv=0; mv<MAX_MV*2+1; mv++){ |
| 772 | umv_fcode_tab[mv]= 1; | 761 | umv_fcode_tab[mv]= 1; |
| 773 | } | 762 | } |
| @@ -844,7 +833,6 @@ av_cold void ff_h263_encode_init(MpegEncContext *s) · 70 unmodified lines | |||
| 844 | // use fcodes >1 only for MPEG-4 & H.263 & H.263+ FIXME | 833 | // use fcodes >1 only for MPEG-4 & H.263 & H.263+ FIXME |
| 845 | switch(s->codec_id){ | 834 | switch(s->codec_id){ |
| 846 | case AV_CODEC_ID_MPEG4: | 835 | case AV_CODEC_ID_MPEG4: |
| 847 | s->fcode_tab= fcode_tab; | ||
| 848 | break; | 836 | break; |
| 849 | case AV_CODEC_ID_H263P: | 837 | case AV_CODEC_ID_H263P: |
| 850 | if(s->umvplus) | 838 | if(s->umvplus) |
| @@ -37,6 +37,11 @@ · 36 unmodified lines | |||
| 37 | #include "profiles.h" | 37 | #include "profiles.h" |
| 38 | #include "version.h" | 38 | #include "version.h" |
| 39 | 39 | ||
| 40 | /** | ||
| 41 | * Minimal fcode that a motion vector component would need. | ||
| 42 | */ | ||
| 43 | static uint8_t fcode_tab[MAX_MV*2+1]; | ||
| 44 | |||
| 40 | /* The uni_DCtab_* tables below contain unified bits+length tables to encode DC | 45 | /* The uni_DCtab_* tables below contain unified bits+length tables to encode DC |
| 41 | * differences in MPEG-4. Unified in the sense that the specification specifies | 46 | * differences in MPEG-4. Unified in the sense that the specification specifies |
| 42 | * this encoding in several steps. */ | 47 | * this encoding in several steps. */ |
| @@ -1255,6 +1260,11 @@ static av_cold void mpeg4_encode_init_static(void) · 1212 unmodified lines | |||
| 1255 | 1260 | ||
| 1256 | init_uni_mpeg4_rl_tab(&ff_mpeg4_rl_intra, uni_mpeg4_intra_rl_bits, uni_mpeg4_intra_rl_len); | 1261 | init_uni_mpeg4_rl_tab(&ff_mpeg4_rl_intra, uni_mpeg4_intra_rl_bits, uni_mpeg4_intra_rl_len); |
| 1257 | init_uni_mpeg4_rl_tab(&ff_h263_rl_inter, uni_mpeg4_inter_rl_bits, uni_mpeg4_inter_rl_len); | 1262 | init_uni_mpeg4_rl_tab(&ff_h263_rl_inter, uni_mpeg4_inter_rl_bits, uni_mpeg4_inter_rl_len); |
| 1263 | |||
| 1264 | for (int f_code = MAX_FCODE; f_code > 0; f_code--) { | ||
| 1265 | for (int mv = -(16 << f_code); mv < (16 << f_code); mv++) | ||
| 1266 | fcode_tab[mv + MAX_MV] = f_code; | ||
| 1267 | } | ||
| 1258 | } | 1268 | } |
| 1259 | 1269 | ||
| 1260 | static av_cold int encode_init(AVCodecContext *avctx) | 1270 | static av_cold int encode_init(AVCodecContext *avctx) |
| @@ -1274,6 +1284,7 @@ static av_cold int encode_init(AVCodecContext *avctx) · 13 unmodified lines | |||
| 1274 | 1284 | ||
| 1275 | ff_thread_once(&init_static_once, mpeg4_encode_init_static); | 1285 | ff_thread_once(&init_static_once, mpeg4_encode_init_static); |
| 1276 | 1286 | ||
| 1287 | s->fcode_tab = fcode_tab; | ||
| 1277 | s->min_qcoeff = -2048; | 1288 | s->min_qcoeff = -2048; |
| 1278 | s->max_qcoeff = 2047; | 1289 | s->max_qcoeff = 2047; |
| 1279 | s->intra_ac_vlc_length = uni_mpeg4_intra_rl_len; | 1290 | s->intra_ac_vlc_length = uni_mpeg4_intra_rl_len; |