diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2007-01-27 12:35:12 +0000 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2007-01-27 12:35:12 +0000 |
commit | 994fd8500d1c1798e437b09e416c98ba3afe07cc (patch) | |
tree | eb1ff1a75067b2beb2757a5bfb292eb6b5a9a1f2 /libavcodec | |
parent | de3ae9596bfd6878e9fccde8fcece9afee563c52 (diff) | |
download | ffmpeg-994fd8500d1c1798e437b09e416c98ba3afe07cc.tar.gz |
Fix warnings and simplify/reorder the code
Originally committed as revision 7726 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mpegvideo.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 2984b324d1..8daf2098f7 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -2260,15 +2260,6 @@ static int estimate_best_b_count(MpegEncContext *s){ int csize= (c->width/2)*(c->height/2); Picture pre_input, *pre_input_ptr= i ? s->input_picture[i-1] : s->next_picture_ptr; - if(pre_input_ptr) - pre_input= *pre_input_ptr; - - if(pre_input.type != FF_BUFFER_TYPE_SHARED && i){ - pre_input.data[0]+=INPLACE_OFFSET; - pre_input.data[1]+=INPLACE_OFFSET; - pre_input.data[2]+=INPLACE_OFFSET; - } - avcodec_get_frame_defaults(&input[i]); input[i].data[0]= av_malloc(ysize + 2*csize); input[i].data[1]= input[i].data[0] + ysize; @@ -2277,7 +2268,15 @@ static int estimate_best_b_count(MpegEncContext *s){ input[i].linesize[1]= input[i].linesize[2]= c->width/2; - if(!i || s->input_picture[i-1]){ + if(pre_input_ptr && (!i || s->input_picture[i-1])) { + pre_input= *pre_input_ptr; + + if(pre_input.type != FF_BUFFER_TYPE_SHARED && i) { + pre_input.data[0]+=INPLACE_OFFSET; + pre_input.data[1]+=INPLACE_OFFSET; + pre_input.data[2]+=INPLACE_OFFSET; + } + s->dsp.shrink[scale](input[i].data[0], input[i].linesize[0], pre_input.data[0], pre_input.linesize[0], c->width, c->height); s->dsp.shrink[scale](input[i].data[1], input[i].linesize[1], pre_input.data[1], pre_input.linesize[1], c->width>>1, c->height>>1); s->dsp.shrink[scale](input[i].data[2], input[i].linesize[2], pre_input.data[2], pre_input.linesize[2], c->width>>1, c->height>>1); @@ -5358,7 +5357,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ if(s->avctx->mb_decision == FF_MB_DECISION_BITS) MPV_decode_mb(s, s->block); } else { - int motion_x, motion_y; + int motion_x = 0, motion_y = 0; s->mv_type=MV_TYPE_16X16; // only one MB-Type possible @@ -5384,7 +5383,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0]; s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1]; } - motion_x = motion_y = 0; break; case CANDIDATE_MB_TYPE_INTER4V: s->mv_dir = MV_DIR_FORWARD; @@ -5394,7 +5392,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0]; s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1]; } - motion_x= motion_y= 0; break; case CANDIDATE_MB_TYPE_DIRECT: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; @@ -5411,8 +5408,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ case CANDIDATE_MB_TYPE_BIDIR: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mb_intra= 0; - motion_x=0; - motion_y=0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; @@ -5440,7 +5435,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0]; s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1]; } - motion_x=motion_y=0; break; case CANDIDATE_MB_TYPE_BACKWARD_I: s->mv_dir = MV_DIR_BACKWARD; @@ -5451,7 +5445,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0]; s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1]; } - motion_x=motion_y=0; break; case CANDIDATE_MB_TYPE_BIDIR_I: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; @@ -5464,10 +5457,8 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1]; } } - motion_x=motion_y=0; break; default: - motion_x=motion_y=0; //gcc warning fix av_log(s->avctx, AV_LOG_ERROR, "illegal MB type\n"); } @@ -6170,7 +6161,7 @@ static int dct_quantize_refine(MpegEncContext *s, //FIXME breaks denoise? uint8_t * length; uint8_t * last_length; int lambda; - int rle_index, run, q, sum; + int rle_index, run, q = 1, sum; //q is only used when s->mb_intra is true #ifdef REFINE_STATS static int count=0; static int after_last=0; |