Revision ce5e49b0 libavcodec/h264.c
libavcodec/h264.c | ||
---|---|---|
918 | 918 |
else if((out_of_order && pics-1 == s->avctx->has_b_frames && s->avctx->has_b_frames < MAX_DELAYED_PIC_COUNT) |
919 | 919 |
|| (s->low_delay && |
920 | 920 |
((h->next_outputed_poc != INT_MIN && out->poc > h->next_outputed_poc + 2) |
921 |
|| cur->pict_type == FF_B_TYPE)))
|
|
921 |
|| cur->pict_type == AV_PICTURE_TYPE_B)))
|
|
922 | 922 |
{ |
923 | 923 |
s->low_delay = 0; |
924 | 924 |
s->avctx->has_b_frames++; |
... | ... | |
1449 | 1449 |
} |
1450 | 1450 |
} |
1451 | 1451 |
} |
1452 |
if(h->slice_type_nos != FF_B_TYPE) break;
|
|
1452 |
if(h->slice_type_nos != AV_PICTURE_TYPE_B) break;
|
|
1453 | 1453 |
} |
1454 | 1454 |
h->use_weight= h->use_weight || h->use_weight_chroma; |
1455 | 1455 |
return 0; |
... | ... | |
1817 | 1817 |
h->slice_type_fixed=0; |
1818 | 1818 |
|
1819 | 1819 |
slice_type= golomb_to_pict_type[ slice_type ]; |
1820 |
if (slice_type == FF_I_TYPE
|
|
1820 |
if (slice_type == AV_PICTURE_TYPE_I
|
|
1821 | 1821 |
|| (h0->current_slice != 0 && slice_type == h0->last_slice_type) ) { |
1822 | 1822 |
default_ref_list_done = 1; |
1823 | 1823 |
} |
... | ... | |
2110 | 2110 |
h->ref_count[0]= h->pps.ref_count[0]; |
2111 | 2111 |
h->ref_count[1]= h->pps.ref_count[1]; |
2112 | 2112 |
|
2113 |
if(h->slice_type_nos != FF_I_TYPE){
|
|
2114 |
if(h->slice_type_nos == FF_B_TYPE){
|
|
2113 |
if(h->slice_type_nos != AV_PICTURE_TYPE_I){
|
|
2114 |
if(h->slice_type_nos == AV_PICTURE_TYPE_B){
|
|
2115 | 2115 |
h->direct_spatial_mv_pred= get_bits1(&s->gb); |
2116 | 2116 |
} |
2117 | 2117 |
num_ref_idx_active_override_flag= get_bits1(&s->gb); |
2118 | 2118 |
|
2119 | 2119 |
if(num_ref_idx_active_override_flag){ |
2120 | 2120 |
h->ref_count[0]= get_ue_golomb(&s->gb) + 1; |
2121 |
if(h->slice_type_nos==FF_B_TYPE)
|
|
2121 |
if(h->slice_type_nos==AV_PICTURE_TYPE_B)
|
|
2122 | 2122 |
h->ref_count[1]= get_ue_golomb(&s->gb) + 1; |
2123 | 2123 |
|
2124 | 2124 |
if(h->ref_count[0]-1 > 32-1 || h->ref_count[1]-1 > 32-1){ |
... | ... | |
2127 | 2127 |
return -1; |
2128 | 2128 |
} |
2129 | 2129 |
} |
2130 |
if(h->slice_type_nos == FF_B_TYPE)
|
|
2130 |
if(h->slice_type_nos == AV_PICTURE_TYPE_B)
|
|
2131 | 2131 |
h->list_count= 2; |
2132 | 2132 |
else |
2133 | 2133 |
h->list_count= 1; |
... | ... | |
2138 | 2138 |
ff_h264_fill_default_ref_list(h); |
2139 | 2139 |
} |
2140 | 2140 |
|
2141 |
if(h->slice_type_nos!=FF_I_TYPE && ff_h264_decode_ref_pic_list_reordering(h) < 0)
|
|
2141 |
if(h->slice_type_nos!=AV_PICTURE_TYPE_I && ff_h264_decode_ref_pic_list_reordering(h) < 0)
|
|
2142 | 2142 |
return -1; |
2143 | 2143 |
|
2144 |
if(h->slice_type_nos!=FF_I_TYPE){
|
|
2144 |
if(h->slice_type_nos!=AV_PICTURE_TYPE_I){
|
|
2145 | 2145 |
s->last_picture_ptr= &h->ref_list[0][0]; |
2146 | 2146 |
ff_copy_picture(&s->last_picture, s->last_picture_ptr); |
2147 | 2147 |
} |
2148 |
if(h->slice_type_nos==FF_B_TYPE){
|
|
2148 |
if(h->slice_type_nos==AV_PICTURE_TYPE_B){
|
|
2149 | 2149 |
s->next_picture_ptr= &h->ref_list[1][0]; |
2150 | 2150 |
ff_copy_picture(&s->next_picture, s->next_picture_ptr); |
2151 | 2151 |
} |
2152 | 2152 |
|
2153 |
if( (h->pps.weighted_pred && h->slice_type_nos == FF_P_TYPE )
|
|
2154 |
|| (h->pps.weighted_bipred_idc==1 && h->slice_type_nos== FF_B_TYPE ) )
|
|
2153 |
if( (h->pps.weighted_pred && h->slice_type_nos == AV_PICTURE_TYPE_P )
|
|
2154 |
|| (h->pps.weighted_bipred_idc==1 && h->slice_type_nos== AV_PICTURE_TYPE_B ) )
|
|
2155 | 2155 |
pred_weight_table(h); |
2156 |
else if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== FF_B_TYPE){
|
|
2156 |
else if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== AV_PICTURE_TYPE_B){
|
|
2157 | 2157 |
implicit_weight_table(h, -1); |
2158 | 2158 |
}else { |
2159 | 2159 |
h->use_weight = 0; |
... | ... | |
2169 | 2169 |
if(FRAME_MBAFF){ |
2170 | 2170 |
ff_h264_fill_mbaff_ref_list(h); |
2171 | 2171 |
|
2172 |
if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== FF_B_TYPE){
|
|
2172 |
if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== AV_PICTURE_TYPE_B){
|
|
2173 | 2173 |
implicit_weight_table(h, 0); |
2174 | 2174 |
implicit_weight_table(h, 1); |
2175 | 2175 |
} |
2176 | 2176 |
} |
2177 | 2177 |
|
2178 |
if(h->slice_type_nos==FF_B_TYPE && !h->direct_spatial_mv_pred)
|
|
2178 |
if(h->slice_type_nos==AV_PICTURE_TYPE_B && !h->direct_spatial_mv_pred)
|
|
2179 | 2179 |
ff_h264_direct_dist_scale_factor(h); |
2180 | 2180 |
ff_h264_direct_ref_list_init(h); |
2181 | 2181 |
|
2182 |
if( h->slice_type_nos != FF_I_TYPE && h->pps.cabac ){
|
|
2182 |
if( h->slice_type_nos != AV_PICTURE_TYPE_I && h->pps.cabac ){
|
|
2183 | 2183 |
tmp = get_ue_golomb_31(&s->gb); |
2184 | 2184 |
if(tmp > 2){ |
2185 | 2185 |
av_log(s->avctx, AV_LOG_ERROR, "cabac_init_idc overflow\n"); |
... | ... | |
2198 | 2198 |
h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale); |
2199 | 2199 |
h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale); |
2200 | 2200 |
//FIXME qscale / qp ... stuff |
2201 |
if(h->slice_type == FF_SP_TYPE){
|
|
2201 |
if(h->slice_type == AV_PICTURE_TYPE_SP){
|
|
2202 | 2202 |
get_bits1(&s->gb); /* sp_for_switch_flag */ |
2203 | 2203 |
} |
2204 |
if(h->slice_type==FF_SP_TYPE || h->slice_type == FF_SI_TYPE){
|
|
2204 |
if(h->slice_type==AV_PICTURE_TYPE_SP || h->slice_type == AV_PICTURE_TYPE_SI){
|
|
2205 | 2205 |
get_se_golomb(&s->gb); /* slice_qs_delta */ |
2206 | 2206 |
} |
2207 | 2207 |
|
... | ... | |
2230 | 2230 |
} |
2231 | 2231 |
|
2232 | 2232 |
if( s->avctx->skip_loop_filter >= AVDISCARD_ALL |
2233 |
||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type_nos != FF_I_TYPE)
|
|
2234 |
||(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type_nos == FF_B_TYPE)
|
|
2233 |
||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type_nos != AV_PICTURE_TYPE_I)
|
|
2234 |
||(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type_nos == AV_PICTURE_TYPE_B)
|
|
2235 | 2235 |
||(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && h->nal_ref_idc == 0)) |
2236 | 2236 |
h->deblocking_filter= 0; |
2237 | 2237 |
|
... | ... | |
2315 | 2315 |
h->deblocking_filter, h->slice_alpha_c0_offset/2-26, h->slice_beta_offset/2-26, |
2316 | 2316 |
h->use_weight, |
2317 | 2317 |
h->use_weight==1 && h->use_weight_chroma ? "c" : "", |
2318 |
h->slice_type == FF_B_TYPE ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""
|
|
2318 |
h->slice_type == AV_PICTURE_TYPE_B ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""
|
|
2319 | 2319 |
); |
2320 | 2320 |
} |
2321 | 2321 |
|
... | ... | |
2325 | 2325 |
int ff_h264_get_slice_type(const H264Context *h) |
2326 | 2326 |
{ |
2327 | 2327 |
switch (h->slice_type) { |
2328 |
case FF_P_TYPE: return 0;
|
|
2329 |
case FF_B_TYPE: return 1;
|
|
2330 |
case FF_I_TYPE: return 2;
|
|
2331 |
case FF_SP_TYPE: return 3;
|
|
2332 |
case FF_SI_TYPE: return 4;
|
|
2328 |
case AV_PICTURE_TYPE_P: return 0;
|
|
2329 |
case AV_PICTURE_TYPE_B: return 1;
|
|
2330 |
case AV_PICTURE_TYPE_I: return 2;
|
|
2331 |
case AV_PICTURE_TYPE_SP: return 3;
|
|
2332 |
case AV_PICTURE_TYPE_SI: return 4;
|
|
2333 | 2333 |
default: return -1; |
2334 | 2334 |
} |
2335 | 2335 |
} |
... | ... | |
3000 | 3000 |
|
3001 | 3001 |
if(hx->redundant_pic_count==0 |
3002 | 3002 |
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) |
3003 |
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE)
|
|
3004 |
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
|
|
3003 |
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B)
|
|
3004 |
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==AV_PICTURE_TYPE_I)
|
|
3005 | 3005 |
&& avctx->skip_frame < AVDISCARD_ALL){ |
3006 | 3006 |
if(avctx->hwaccel) { |
3007 | 3007 |
if (avctx->hwaccel->decode_slice(avctx, &buf[buf_index - consumed], consumed) < 0) |
... | ... | |
3037 | 3037 |
if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning |
3038 | 3038 |
&& s->context_initialized |
3039 | 3039 |
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) |
3040 |
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE)
|
|
3041 |
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
|
|
3040 |
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B)
|
|
3041 |
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==AV_PICTURE_TYPE_I)
|
|
3042 | 3042 |
&& avctx->skip_frame < AVDISCARD_ALL) |
3043 | 3043 |
context_count++; |
3044 | 3044 |
break; |
Also available in: Unified diff