diff options
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/h263.c | 4 | ||||
-rw-r--r-- | libavcodec/motion_est.c | 16 | ||||
-rw-r--r-- | libavcodec/motion_est_template.c | 22 | ||||
-rw-r--r-- | libavcodec/mpeg12.c | 4 | ||||
-rw-r--r-- | libavcodec/mpegvideo.c | 6 | ||||
-rw-r--r-- | libavcodec/mpegvideo.h | 10 |
6 files changed, 32 insertions, 30 deletions
diff --git a/libavcodec/h263.c b/libavcodec/h263.c index a054ebf..2e7e19e 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -87,7 +87,7 @@ static uint8_t uni_DCtab_chrom_len[512]; static uint16_t uni_DCtab_lum_bits[512]; static uint16_t uni_DCtab_chrom_bits[512]; -static uint16_t (*mv_penalty)[MAX_MV*2+1]= NULL; +static uint8_t (*mv_penalty)[MAX_MV*2+1]= NULL; static uint8_t fcode_tab[MAX_MV*2+1]; static uint8_t umv_fcode_tab[MAX_MV*2+1]; @@ -1255,7 +1255,7 @@ static void init_mv_penalty_and_fcode(MpegEncContext *s) int mv; if(mv_penalty==NULL) - mv_penalty= av_mallocz( sizeof(uint16_t)*(MAX_FCODE+1)*(2*MAX_MV+1) ); + mv_penalty= av_mallocz( sizeof(uint8_t)*(MAX_FCODE+1)*(2*MAX_MV+1) ); for(f_code=1; f_code<=MAX_FCODE; f_code++){ for(mv=-MAX_MV; mv<=MAX_MV; mv++){ diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 5bc37fa..e0c0cc9 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -47,7 +47,7 @@ static inline int sad_hpel_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr, int dmin, int xmin, int ymin, int xmax, int ymax, int pred_x, int pred_y, Picture *picture, - int n, int size, uint16_t * const mv_penalty); + int n, int size, uint8_t * const mv_penalty); static inline int update_map_generation(MpegEncContext * s) { @@ -657,7 +657,7 @@ static inline int sad_hpel_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr, int dmin, int xmin, int ymin, int xmax, int ymax, int pred_x, int pred_y, Picture *picture, - int n, int size, uint16_t * const mv_penalty) + int n, int size, uint8_t * const mv_penalty) { uint8_t *ref_picture= picture->data[0]; uint32_t *score_map= s->me.score_map; @@ -831,7 +831,7 @@ static inline int h263_mv4_search(MpegEncContext *s, int xmin, int ymin, int xma int block; int P[10][2]; int dmin_sum=0, mx4_sum=0, my4_sum=0; - uint16_t * const mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV; + uint8_t * const mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV; for(block=0; block<4; block++){ int mx4, my4; @@ -982,7 +982,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, int mb_type=0; uint8_t *ref_picture= s->last_picture.data[0]; Picture * const pic= &s->current_picture; - uint16_t * const mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV; + uint8_t * const mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV; assert(s->quarter_sample==0 || s->quarter_sample==1); @@ -1151,7 +1151,7 @@ int ff_pre_estimate_p_frame_motion(MpegEncContext * s, int pred_x=0, pred_y=0; int P[10][2]; const int shift= 1+s->quarter_sample; - uint16_t * const mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV; + uint8_t * const mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV; const int mv_stride= s->mb_width + 2; const int xy= mb_x + 1 + (mb_y + 1)*mv_stride; @@ -1213,7 +1213,7 @@ static int ff_estimate_motion_b(MpegEncContext * s, const int mot_stride = s->mb_width + 2; const int mot_xy = (mb_y + 1)*mot_stride + mb_x + 1; uint8_t * const ref_picture= picture->data[0]; - uint16_t * const mv_penalty= s->me.mv_penalty[f_code] + MAX_MV; + uint8_t * const mv_penalty= s->me.mv_penalty[f_code] + MAX_MV; int mv_scale; s->me.penalty_factor = get_penalty_factor(s, s->avctx->me_cmp); @@ -1310,7 +1310,7 @@ static inline int check_bidir_mv(MpegEncContext * s, //FIXME optimize? //FIXME move into template? //FIXME better f_code prediction (max mv & distance) - uint16_t *mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV; // f_code of the prev frame + uint8_t * const mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV; // f_code of the prev frame uint8_t *dest_y = s->me.scratchpad; uint8_t *ptr; int dxy; @@ -1405,7 +1405,7 @@ static inline int direct_search(MpegEncContext * s, const int time_pb= s->pb_time; int mx, my, xmin, xmax, ymin, ymax; int16_t (*mv_table)[2]= s->b_direct_mv_table; - uint16_t * const mv_penalty= s->me.mv_penalty[1] + MAX_MV; + uint8_t * const mv_penalty= s->me.mv_penalty[1] + MAX_MV; ymin= xmin=(-32)>>shift; ymax= xmax= 31>>shift; diff --git a/libavcodec/motion_est_template.c b/libavcodec/motion_est_template.c index f393fd8..31a42d6 100644 --- a/libavcodec/motion_est_template.c +++ b/libavcodec/motion_est_template.c @@ -72,7 +72,7 @@ static int RENAME(hpel_motion_search)(MpegEncContext * s, int *mx_ptr, int *my_ptr, int dmin, int xmin, int ymin, int xmax, int ymax, int pred_x, int pred_y, Picture *ref_picture, - int n, int size, uint16_t * const mv_penalty) + int n, int size, uint8_t * const mv_penalty) { const int xx = 16 * s->mb_x + 8*(n&1); const int yy = 16 * s->mb_y + 8*(n>>1); @@ -141,7 +141,7 @@ static int RENAME(hpel_motion_search)(MpegEncContext * s, int *mx_ptr, int *my_ptr, int dmin, int xmin, int ymin, int xmax, int ymax, int pred_x, int pred_y, Picture *ref_picture, - int n, int size, uint16_t * const mv_penalty) + int n, int size, uint8_t * const mv_penalty) { const int xx = 16 * s->mb_x + 8*(n&1); const int yy = 16 * s->mb_y + 8*(n>>1); @@ -246,7 +246,7 @@ static int RENAME(hpel_motion_search)(MpegEncContext * s, #endif static int RENAME(hpel_get_mb_score)(MpegEncContext * s, int mx, int my, int pred_x, int pred_y, Picture *ref_picture, - uint16_t * const mv_penalty) + uint8_t * const mv_penalty) { // const int check_luma= s->dsp.me_sub_cmp != s->dsp.mb_cmp; const int size= 0; @@ -295,7 +295,7 @@ static int RENAME(qpel_motion_search)(MpegEncContext * s, int *mx_ptr, int *my_ptr, int dmin, int xmin, int ymin, int xmax, int ymax, int pred_x, int pred_y, Picture *ref_picture, - int n, int size, uint16_t * const mv_penalty) + int n, int size, uint8_t * const mv_penalty) { const int xx = 16 * s->mb_x + 8*(n&1); const int yy = 16 * s->mb_y + 8*(n>>1); @@ -513,7 +513,7 @@ static int RENAME(qpel_motion_search)(MpegEncContext * s, } static int RENAME(qpel_get_mb_score)(MpegEncContext * s, int mx, int my, int pred_x, int pred_y, Picture *ref_picture, - uint16_t * const mv_penalty) + uint8_t * const mv_penalty) { const int size= 0; const int xx = 16 * s->mb_x; @@ -598,7 +598,7 @@ static inline int RENAME(small_diamond_search)(MpegEncContext * s, int *best, in Picture *ref_picture, int const pred_x, int const pred_y, int const penalty_factor, int const xmin, int const ymin, int const xmax, int const ymax, int const shift, - uint32_t *map, int map_generation, int size, uint16_t * const mv_penalty + uint32_t *map, int map_generation, int size, uint8_t * const mv_penalty ) { me_cmp_func cmp, chroma_cmp; @@ -640,7 +640,7 @@ static inline int RENAME(funny_diamond_search)(MpegEncContext * s, int *best, in Picture *ref_picture, int const pred_x, int const pred_y, int const penalty_factor, int const xmin, int const ymin, int const xmax, int const ymax, int const shift, - uint32_t *map, int map_generation, int size, uint16_t * const mv_penalty + uint32_t *map, int map_generation, int size, uint8_t * const mv_penalty ) { me_cmp_func cmp, chroma_cmp; @@ -731,7 +731,7 @@ static inline int RENAME(sab_diamond_search)(MpegEncContext * s, int *best, int Picture *ref_picture, int const pred_x, int const pred_y, int const penalty_factor, int const xmin, int const ymin, int const xmax, int const ymax, int const shift, - uint32_t *map, int map_generation, int size, uint16_t * const mv_penalty + uint32_t *map, int map_generation, int size, uint8_t * const mv_penalty ) { me_cmp_func cmp, chroma_cmp; @@ -811,7 +811,7 @@ static inline int RENAME(var_diamond_search)(MpegEncContext * s, int *best, int Picture *ref_picture, int const pred_x, int const pred_y, int const penalty_factor, int const xmin, int const ymin, int const xmax, int const ymax, int const shift, - uint32_t *map, int map_generation, int size, uint16_t * const mv_penalty + uint32_t *map, int map_generation, int size, uint8_t * const mv_penalty ) { me_cmp_func cmp, chroma_cmp; @@ -888,7 +888,7 @@ static int RENAME(epzs_motion_search)(MpegEncContext * s, int block, int *mx_ptr, int *my_ptr, int P[10][2], int pred_x, int pred_y, int xmin, int ymin, int xmax, int ymax, Picture *ref_picture, int16_t (*last_mv)[2], - int ref_mv_scale, uint16_t * const mv_penalty) + int ref_mv_scale, uint8_t * const mv_penalty) { int best[2]={0, 0}; int d, dmin; @@ -1000,7 +1000,7 @@ static int RENAME(epzs_motion_search4)(MpegEncContext * s, int block, int *mx_ptr, int *my_ptr, int P[10][2], int pred_x, int pred_y, int xmin, int ymin, int xmax, int ymax, Picture *ref_picture, int16_t (*last_mv)[2], - int ref_mv_scale, uint16_t * const mv_penalty) + int ref_mv_scale, uint8_t * const mv_penalty) { int best[2]={0, 0}; int d, dmin; diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index a25d7c0..95ce87e 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -73,7 +73,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s, static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred); #ifdef CONFIG_ENCODERS -static uint16_t mv_penalty[MAX_FCODE+1][MAX_MV*2+1]; +static uint8_t (*mv_penalty)[MAX_MV*2+1]= NULL; static uint8_t fcode_tab[MAX_MV*2+1]; static uint32_t uni_mpeg1_ac_vlc_bits[64*64*2]; @@ -670,6 +670,8 @@ void ff_mpeg1_encode_init(MpegEncContext *s) mpeg1_chr_dc_uni[i+255]= bits + (code<<8); } + mv_penalty= av_mallocz( sizeof(uint8_t)*(MAX_FCODE+1)*(2*MAX_MV+1) ); + for(f_code=1; f_code<=MAX_FCODE; f_code++){ for(mv=-MAX_MV; mv<=MAX_MV; mv++){ int len; diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 53c2d50..867f423 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -82,7 +82,7 @@ static const uint8_t h263_chroma_roundtab[16] = { }; #ifdef CONFIG_ENCODERS -static uint16_t (*default_mv_penalty)[MAX_MV*2+1]=NULL; +static uint8_t (*default_mv_penalty)[MAX_MV*2+1]=NULL; static uint8_t default_fcode_tab[MAX_MV*2+1]; enum PixelFormat ff_yuv420p_list[2]= {PIX_FMT_YUV420P, -1}; @@ -680,8 +680,8 @@ int MPV_encode_init(AVCodecContext *avctx) int i; done=1; - default_mv_penalty= av_mallocz( sizeof(uint16_t)*(MAX_FCODE+1)*(2*MAX_MV+1) ); - memset(default_mv_penalty, 0, sizeof(uint16_t)*(MAX_FCODE+1)*(2*MAX_MV+1)); + default_mv_penalty= av_mallocz( sizeof(uint8_t)*(MAX_FCODE+1)*(2*MAX_MV+1) ); + memset(default_mv_penalty, 0, sizeof(uint8_t)*(MAX_FCODE+1)*(2*MAX_MV+1)); memset(default_fcode_tab , 0, sizeof(uint8_t)*(2*MAX_MV+1)); for(i=-16; i<16; i++){ diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 7d47545..050d991 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -164,24 +164,24 @@ typedef struct MotionEstContext{ int mb_penalty_factor; int pre_pass; ///< = 1 for the pre pass int dia_size; - uint16_t (*mv_penalty)[MAX_MV*2+1]; ///< amount of bits needed to encode a MV + uint8_t (*mv_penalty)[MAX_MV*2+1]; ///< amount of bits needed to encode a MV int (*sub_motion_search)(struct MpegEncContext * s, int *mx_ptr, int *my_ptr, int dmin, int xmin, int ymin, int xmax, int ymax, int pred_x, int pred_y, Picture *ref_picture, - int n, int size, uint16_t * const mv_penalty); + int n, int size, uint8_t * const mv_penalty); int (*motion_search[7])(struct MpegEncContext * s, int block, int *mx_ptr, int *my_ptr, int P[10][2], int pred_x, int pred_y, int xmin, int ymin, int xmax, int ymax, Picture *ref_picture, int16_t (*last_mv)[2], - int ref_mv_scale, uint16_t * const mv_penalty); + int ref_mv_scale, uint8_t * const mv_penalty); int (*pre_motion_search)(struct MpegEncContext * s, int block, int *mx_ptr, int *my_ptr, int P[10][2], int pred_x, int pred_y, int xmin, int ymin, int xmax, int ymax, Picture *ref_picture, int16_t (*last_mv)[2], - int ref_mv_scale, uint16_t * const mv_penalty); + int ref_mv_scale, uint8_t * const mv_penalty); int (*get_mb_score)(struct MpegEncContext * s, int mx, int my, int pred_x, int pred_y, Picture *ref_picture, - uint16_t * const mv_penalty); + uint8_t * const mv_penalty); }MotionEstContext; /** |