comparison h264.c @ 7385:617eababb511 libavcodec

Clear long_ref when a frame is no longer a long_ref.
author michael
date Fri, 25 Jul 2008 11:52:40 +0000
parents 8b9a02536781
children 00b1f0ecb386
comparison
equal deleted inserted replaced
7384:8b9a02536781 7385:617eababb511
59 59
60 static void svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp); 60 static void svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp);
61 static void svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc); 61 static void svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc);
62 static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize); 62 static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize);
63 static void filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize); 63 static void filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize);
64 static void remove_long_at_index(H264Context *h, int i);
64 65
65 static av_always_inline uint32_t pack16to32(int a, int b){ 66 static av_always_inline uint32_t pack16to32(int a, int b){
66 #ifdef WORDS_BIGENDIAN 67 #ifdef WORDS_BIGENDIAN
67 return (b&0xFFFF) + (a<<16); 68 return (b&0xFFFF) + (a<<16);
68 #else 69 #else
3295 int i; 3296 int i;
3296 3297
3297 for(i=0; i<16; i++){ 3298 for(i=0; i<16; i++){
3298 if (h->long_ref[i] != NULL) { 3299 if (h->long_ref[i] != NULL) {
3299 unreference_pic(h, h->long_ref[i], 0); 3300 unreference_pic(h, h->long_ref[i], 0);
3300 h->long_ref[i]= NULL; 3301 remove_long_at_index(h, i);
3301 } 3302 }
3302 } 3303 }
3303 h->long_ref_count=0; 3304 assert(h->long_ref_count==0);
3304 3305
3305 for(i=0; i<h->short_ref_count; i++){ 3306 for(i=0; i<h->short_ref_count; i++){
3306 unreference_pic(h, h->short_ref[i], 0); 3307 unreference_pic(h, h->short_ref[i], 0);
3307 h->short_ref[i]= NULL; 3308 h->short_ref[i]= NULL;
3308 } 3309 }
3391 * that list. This does no checking on the provided index; it is assumed 3392 * that list. This does no checking on the provided index; it is assumed
3392 * to be valid. The removed entry is set to NULL. Other entries are unaffected. 3393 * to be valid. The removed entry is set to NULL. Other entries are unaffected.
3393 * @param i index into h->long_ref of picture to remove. 3394 * @param i index into h->long_ref of picture to remove.
3394 */ 3395 */
3395 static void remove_long_at_index(H264Context *h, int i){ 3396 static void remove_long_at_index(H264Context *h, int i){
3397 assert(h->long_ref[i]->long_ref == 1);
3398 h->long_ref[i]->long_ref= 0;
3396 h->long_ref[i]= NULL; 3399 h->long_ref[i]= NULL;
3397 h->long_ref_count--; 3400 h->long_ref_count--;
3398 } 3401 }
3399 3402
3400 /** 3403 /**