comparison h264.c @ 5685:070a376d496b libavcodec

fix image corruption when with multi-threaded decoding. dequant-tables were not correctly reinitialized in the slave contexts when a PPS came with updated matrices. Patch by Andreas ªÓman %andreas A olebyn P nu% Original thread: date: Sep 16, 2007 6:14 AM subject: [FFmpeg-devel] Parallelized h264 image corruption bug
author gpoirier
date Sun, 16 Sep 2007 10:37:07 +0000
parents 7c139ea9065e
children 7c2ce28a0314
comparison
equal deleted inserted replaced
5684:1eb243819e08 5685:070a376d496b
2162 dst->chroma_pred_mode_table = src->chroma_pred_mode_table; 2162 dst->chroma_pred_mode_table = src->chroma_pred_mode_table;
2163 dst->mvd_table[0] = src->mvd_table[0]; 2163 dst->mvd_table[0] = src->mvd_table[0];
2164 dst->mvd_table[1] = src->mvd_table[1]; 2164 dst->mvd_table[1] = src->mvd_table[1];
2165 dst->direct_table = src->direct_table; 2165 dst->direct_table = src->direct_table;
2166 2166
2167 if(!dst->dequant4_coeff[0])
2168 init_dequant_tables(dst);
2169 dst->s.obmc_scratchpad = NULL; 2167 dst->s.obmc_scratchpad = NULL;
2170 ff_h264_pred_init(&dst->hpc, src->s.codec_id); 2168 ff_h264_pred_init(&dst->hpc, src->s.codec_id);
2171 dst->dequant_coeff_pps= -1;
2172 } 2169 }
2173 2170
2174 /** 2171 /**
2175 * Init context 2172 * Init context
2176 * Allocate buffers which are not shared amongst multiple threads. 2173 * Allocate buffers which are not shared amongst multiple threads.
3520 3517
3521 memcpy(dst->short_ref, src->short_ref, sizeof(dst->short_ref)); 3518 memcpy(dst->short_ref, src->short_ref, sizeof(dst->short_ref));
3522 memcpy(dst->long_ref, src->long_ref, sizeof(dst->long_ref)); 3519 memcpy(dst->long_ref, src->long_ref, sizeof(dst->long_ref));
3523 memcpy(dst->default_ref_list, src->default_ref_list, sizeof(dst->default_ref_list)); 3520 memcpy(dst->default_ref_list, src->default_ref_list, sizeof(dst->default_ref_list));
3524 memcpy(dst->ref_list, src->ref_list, sizeof(dst->ref_list)); 3521 memcpy(dst->ref_list, src->ref_list, sizeof(dst->ref_list));
3522
3523 memcpy(dst->dequant4_coeff, src->dequant4_coeff, sizeof(src->dequant4_coeff));
3524 memcpy(dst->dequant8_coeff, src->dequant8_coeff, sizeof(src->dequant8_coeff));
3525 } 3525 }
3526 3526
3527 /** 3527 /**
3528 * decodes a slice header. 3528 * decodes a slice header.
3529 * this will allso call MPV_common_init() and frame_start() as needed 3529 * this will allso call MPV_common_init() and frame_start() as needed
3587 av_log(h->s.avctx, AV_LOG_ERROR, "non existing SPS referenced\n"); 3587 av_log(h->s.avctx, AV_LOG_ERROR, "non existing SPS referenced\n");
3588 return -1; 3588 return -1;
3589 } 3589 }
3590 h->sps = *h0->sps_buffers[h->pps.sps_id]; 3590 h->sps = *h0->sps_buffers[h->pps.sps_id];
3591 3591
3592 if(h->dequant_coeff_pps != pps_id){ 3592 if(h == h0 && h->dequant_coeff_pps != pps_id){
3593 h->dequant_coeff_pps = pps_id; 3593 h->dequant_coeff_pps = pps_id;
3594 init_dequant_tables(h); 3594 init_dequant_tables(h);
3595 } 3595 }
3596 3596
3597 s->mb_width= h->sps.mb_width; 3597 s->mb_width= h->sps.mb_width;