Mercurial > libavcodec.hg
comparison h264.c @ 10979:776dba50775c libavcodec
Move +52 from the loop filter to the alpha/beta offsets in the context.
This should fix a segfault, also it might be faster on systems where the
+52 wasnt free.
author | michael |
---|---|
date | Sat, 23 Jan 2010 18:05:30 +0000 |
parents | b4e6b2d301ad |
children | 541acd292c48 |
comparison
equal
deleted
inserted
replaced
10978:8754b8361dc9 | 10979:776dba50775c |
---|---|
2030 if(h->slice_type==FF_SP_TYPE || h->slice_type == FF_SI_TYPE){ | 2030 if(h->slice_type==FF_SP_TYPE || h->slice_type == FF_SI_TYPE){ |
2031 get_se_golomb(&s->gb); /* slice_qs_delta */ | 2031 get_se_golomb(&s->gb); /* slice_qs_delta */ |
2032 } | 2032 } |
2033 | 2033 |
2034 h->deblocking_filter = 1; | 2034 h->deblocking_filter = 1; |
2035 h->slice_alpha_c0_offset = 0; | 2035 h->slice_alpha_c0_offset = 52; |
2036 h->slice_beta_offset = 0; | 2036 h->slice_beta_offset = 52; |
2037 if( h->pps.deblocking_filter_parameters_present ) { | 2037 if( h->pps.deblocking_filter_parameters_present ) { |
2038 tmp= get_ue_golomb_31(&s->gb); | 2038 tmp= get_ue_golomb_31(&s->gb); |
2039 if(tmp > 2){ | 2039 if(tmp > 2){ |
2040 av_log(s->avctx, AV_LOG_ERROR, "deblocking_filter_idc %u out of range\n", tmp); | 2040 av_log(s->avctx, AV_LOG_ERROR, "deblocking_filter_idc %u out of range\n", tmp); |
2041 return -1; | 2041 return -1; |
2043 h->deblocking_filter= tmp; | 2043 h->deblocking_filter= tmp; |
2044 if(h->deblocking_filter < 2) | 2044 if(h->deblocking_filter < 2) |
2045 h->deblocking_filter^= 1; // 1<->0 | 2045 h->deblocking_filter^= 1; // 1<->0 |
2046 | 2046 |
2047 if( h->deblocking_filter ) { | 2047 if( h->deblocking_filter ) { |
2048 h->slice_alpha_c0_offset = get_se_golomb(&s->gb) << 1; | 2048 h->slice_alpha_c0_offset += get_se_golomb(&s->gb) << 1; |
2049 h->slice_beta_offset = get_se_golomb(&s->gb) << 1; | 2049 h->slice_beta_offset += get_se_golomb(&s->gb) << 1; |
2050 if( h->slice_alpha_c0_offset > 104U | |
2051 || h->slice_beta_offset > 104U){ | |
2052 av_log(s->avctx, AV_LOG_ERROR, "deblocking filter parameters %d %d out of range\n", h->slice_alpha_c0_offset, h->slice_beta_offset); | |
2053 return -1; | |
2054 } | |
2050 } | 2055 } |
2051 } | 2056 } |
2052 | 2057 |
2053 if( s->avctx->skip_loop_filter >= AVDISCARD_ALL | 2058 if( s->avctx->skip_loop_filter >= AVDISCARD_ALL |
2054 ||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type_nos != FF_I_TYPE) | 2059 ||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type_nos != FF_I_TYPE) |
2069 } | 2074 } |
2070 if(h != h0) | 2075 if(h != h0) |
2071 return 1; // deblocking switched inside frame | 2076 return 1; // deblocking switched inside frame |
2072 } | 2077 } |
2073 } | 2078 } |
2074 h->qp_thresh= 15 - FFMIN(h->slice_alpha_c0_offset, h->slice_beta_offset) - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]); | 2079 h->qp_thresh= 15 + 52 - FFMIN(h->slice_alpha_c0_offset, h->slice_beta_offset) - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]); |
2075 | 2080 |
2076 #if 0 //FMO | 2081 #if 0 //FMO |
2077 if( h->pps.num_slice_groups > 1 && h->pps.mb_slice_group_map_type >= 3 && h->pps.mb_slice_group_map_type <= 5) | 2082 if( h->pps.num_slice_groups > 1 && h->pps.mb_slice_group_map_type >= 3 && h->pps.mb_slice_group_map_type <= 5) |
2078 slice_group_change_cycle= get_bits(&s->gb, ?); | 2083 slice_group_change_cycle= get_bits(&s->gb, ?); |
2079 #endif | 2084 #endif |
2130 av_get_pict_type_char(h->slice_type), h->slice_type_fixed ? " fix" : "", h->nal_unit_type == NAL_IDR_SLICE ? " IDR" : "", | 2135 av_get_pict_type_char(h->slice_type), h->slice_type_fixed ? " fix" : "", h->nal_unit_type == NAL_IDR_SLICE ? " IDR" : "", |
2131 pps_id, h->frame_num, | 2136 pps_id, h->frame_num, |
2132 s->current_picture_ptr->field_poc[0], s->current_picture_ptr->field_poc[1], | 2137 s->current_picture_ptr->field_poc[0], s->current_picture_ptr->field_poc[1], |
2133 h->ref_count[0], h->ref_count[1], | 2138 h->ref_count[0], h->ref_count[1], |
2134 s->qscale, | 2139 s->qscale, |
2135 h->deblocking_filter, h->slice_alpha_c0_offset/2, h->slice_beta_offset/2, | 2140 h->deblocking_filter, h->slice_alpha_c0_offset/2-26, h->slice_beta_offset/2-26, |
2136 h->use_weight, | 2141 h->use_weight, |
2137 h->use_weight==1 && h->use_weight_chroma ? "c" : "", | 2142 h->use_weight==1 && h->use_weight_chroma ? "c" : "", |
2138 h->slice_type == FF_B_TYPE ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : "" | 2143 h->slice_type == FF_B_TYPE ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : "" |
2139 ); | 2144 ); |
2140 } | 2145 } |