Commit d8a7c495 authored by Michael Niedermayer's avatar Michael Niedermayer

mpegvideo_enc: factor expression out

Fixes "warning: dc[0..5] may be used uninitialized in this function"
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent afb4bc3d
...@@ -2844,6 +2844,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ ...@@ -2844,6 +2844,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
int16_t ac[6][16]; int16_t ac[6][16];
const int mvdir= (best_s.mv_dir&MV_DIR_BACKWARD) ? 1 : 0; const int mvdir= (best_s.mv_dir&MV_DIR_BACKWARD) ? 1 : 0;
static const int dquant_tab[4]={-1,1,-2,2}; static const int dquant_tab[4]={-1,1,-2,2};
int storecoefs = s->mb_intra && s->dc_val[0];
av_assert2(backup_s.dquant == 0); av_assert2(backup_s.dquant == 0);
...@@ -2863,7 +2864,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ ...@@ -2863,7 +2864,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
if(qp < s->avctx->qmin || qp > s->avctx->qmax) if(qp < s->avctx->qmin || qp > s->avctx->qmax)
continue; continue;
backup_s.dquant= dquant; backup_s.dquant= dquant;
if(s->mb_intra && s->dc_val[0]){ if(storecoefs){
for(i=0; i<6; i++){ for(i=0; i<6; i++){
dc[i]= s->dc_val[0][ s->block_index[i] ]; dc[i]= s->dc_val[0][ s->block_index[i] ];
memcpy(ac[i], s->ac_val[0][s->block_index[i]], sizeof(int16_t)*16); memcpy(ac[i], s->ac_val[0][s->block_index[i]], sizeof(int16_t)*16);
...@@ -2873,7 +2874,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ ...@@ -2873,7 +2874,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER /* wrong but unused */, pb, pb2, tex_pb, encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER /* wrong but unused */, pb, pb2, tex_pb,
&dmin, &next_block, s->mv[mvdir][0][0], s->mv[mvdir][0][1]); &dmin, &next_block, s->mv[mvdir][0][0], s->mv[mvdir][0][1]);
if(best_s.qscale != qp){ if(best_s.qscale != qp){
if(s->mb_intra && s->dc_val[0]){ if(storecoefs){
for(i=0; i<6; i++){ for(i=0; i<6; i++){
s->dc_val[0][ s->block_index[i] ]= dc[i]; s->dc_val[0][ s->block_index[i] ]= dc[i];
memcpy(s->ac_val[0][s->block_index[i]], ac[i], sizeof(int16_t)*16); memcpy(s->ac_val[0][s->block_index[i]], ac[i], sizeof(int16_t)*16);
......
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