Mercurial > libavcodec.hg
comparison h264.c @ 5172:60a4f209838b libavcodec
Decouple bit context from h264 context in decode_ref_pic_marking()
(done in order to implement slice-level parallel decoding)
Patch by Andreas ªÓman % andreas olebyn nu %
Original thread:
Date: Jun 15, 2007 10:10 PM
Subject: [FFmpeg-devel] [PATCH] h264 parallelized, (was: Parallelized h264 proof-of-concept)
author | gpoirier |
---|---|
date | Tue, 19 Jun 2007 21:34:04 +0000 |
parents | 0f6a38c1b63c |
children | 2e038003cdfb |
comparison
equal
deleted
inserted
replaced
5171:b3fd384aaa28 | 5172:60a4f209838b |
---|---|
4004 print_short_term(h); | 4004 print_short_term(h); |
4005 print_long_term(h); | 4005 print_long_term(h); |
4006 return 0; | 4006 return 0; |
4007 } | 4007 } |
4008 | 4008 |
4009 static int decode_ref_pic_marking(H264Context *h){ | 4009 static int decode_ref_pic_marking(H264Context *h, GetBitContext *gb){ |
4010 MpegEncContext * const s = &h->s; | 4010 MpegEncContext * const s = &h->s; |
4011 int i; | 4011 int i; |
4012 | 4012 |
4013 if(h->nal_unit_type == NAL_IDR_SLICE){ //FIXME fields | 4013 if(h->nal_unit_type == NAL_IDR_SLICE){ //FIXME fields |
4014 s->broken_link= get_bits1(&s->gb) -1; | 4014 s->broken_link= get_bits1(gb) -1; |
4015 h->mmco[0].long_index= get_bits1(&s->gb) - 1; // current_long_term_idx | 4015 h->mmco[0].long_index= get_bits1(gb) - 1; // current_long_term_idx |
4016 if(h->mmco[0].long_index == -1) | 4016 if(h->mmco[0].long_index == -1) |
4017 h->mmco_index= 0; | 4017 h->mmco_index= 0; |
4018 else{ | 4018 else{ |
4019 h->mmco[0].opcode= MMCO_LONG; | 4019 h->mmco[0].opcode= MMCO_LONG; |
4020 h->mmco_index= 1; | 4020 h->mmco_index= 1; |
4021 } | 4021 } |
4022 }else{ | 4022 }else{ |
4023 if(get_bits1(&s->gb)){ // adaptive_ref_pic_marking_mode_flag | 4023 if(get_bits1(gb)){ // adaptive_ref_pic_marking_mode_flag |
4024 for(i= 0; i<MAX_MMCO_COUNT; i++) { | 4024 for(i= 0; i<MAX_MMCO_COUNT; i++) { |
4025 MMCOOpcode opcode= get_ue_golomb(&s->gb);; | 4025 MMCOOpcode opcode= get_ue_golomb(gb); |
4026 | 4026 |
4027 h->mmco[i].opcode= opcode; | 4027 h->mmco[i].opcode= opcode; |
4028 if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){ | 4028 if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){ |
4029 h->mmco[i].short_frame_num= (h->frame_num - get_ue_golomb(&s->gb) - 1) & ((1<<h->sps.log2_max_frame_num)-1); //FIXME fields | 4029 h->mmco[i].short_frame_num= (h->frame_num - get_ue_golomb(gb) - 1) & ((1<<h->sps.log2_max_frame_num)-1); //FIXME fields |
4030 /* if(h->mmco[i].short_frame_num >= h->short_ref_count || h->short_ref[ h->mmco[i].short_frame_num ] == NULL){ | 4030 /* if(h->mmco[i].short_frame_num >= h->short_ref_count || h->short_ref[ h->mmco[i].short_frame_num ] == NULL){ |
4031 av_log(s->avctx, AV_LOG_ERROR, "illegal short ref in memory management control operation %d\n", mmco); | 4031 av_log(s->avctx, AV_LOG_ERROR, "illegal short ref in memory management control operation %d\n", mmco); |
4032 return -1; | 4032 return -1; |
4033 }*/ | 4033 }*/ |
4034 } | 4034 } |
4035 if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){ | 4035 if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){ |
4036 unsigned int long_index= get_ue_golomb(&s->gb); | 4036 unsigned int long_index= get_ue_golomb(gb); |
4037 if(/*h->mmco[i].long_index >= h->long_ref_count || h->long_ref[ h->mmco[i].long_index ] == NULL*/ long_index >= 16){ | 4037 if(/*h->mmco[i].long_index >= h->long_ref_count || h->long_ref[ h->mmco[i].long_index ] == NULL*/ long_index >= 16){ |
4038 av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode); | 4038 av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode); |
4039 return -1; | 4039 return -1; |
4040 } | 4040 } |
4041 h->mmco[i].long_index= long_index; | 4041 h->mmco[i].long_index= long_index; |
4414 implicit_weight_table(h); | 4414 implicit_weight_table(h); |
4415 else | 4415 else |
4416 h->use_weight = 0; | 4416 h->use_weight = 0; |
4417 | 4417 |
4418 if(s->current_picture.reference) | 4418 if(s->current_picture.reference) |
4419 decode_ref_pic_marking(h); | 4419 decode_ref_pic_marking(h, &s->gb); |
4420 | 4420 |
4421 if(FRAME_MBAFF) | 4421 if(FRAME_MBAFF) |
4422 fill_mbaff_ref_list(h); | 4422 fill_mbaff_ref_list(h); |
4423 | 4423 |
4424 if( h->slice_type != I_TYPE && h->slice_type != SI_TYPE && h->pps.cabac ){ | 4424 if( h->slice_type != I_TYPE && h->slice_type != SI_TYPE && h->pps.cabac ){ |