mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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. Originally committed as revision 21406 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
6231d0983b
commit
0c32e19d58
@ -225,8 +225,8 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice,
|
||||
slice->num_ref_idx_l0_active_minus1 = h->ref_count[0] - 1;
|
||||
if (h->list_count > 1)
|
||||
slice->num_ref_idx_l1_active_minus1 = h->ref_count[1] - 1;
|
||||
slice->slice_alpha_c0_offset_div2 = h->slice_alpha_c0_offset / 2;
|
||||
slice->slice_beta_offset_div2 = h->slice_beta_offset / 2;
|
||||
slice->slice_alpha_c0_offset_div2 = h->slice_alpha_c0_offset / 2 - 26;
|
||||
slice->slice_beta_offset_div2 = h->slice_beta_offset / 2 - 26;
|
||||
slice->Reserved8Bits = 0;
|
||||
|
||||
for (list = 0; list < 2; list++) {
|
||||
|
@ -2032,8 +2032,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
}
|
||||
|
||||
h->deblocking_filter = 1;
|
||||
h->slice_alpha_c0_offset = 0;
|
||||
h->slice_beta_offset = 0;
|
||||
h->slice_alpha_c0_offset = 52;
|
||||
h->slice_beta_offset = 52;
|
||||
if( h->pps.deblocking_filter_parameters_present ) {
|
||||
tmp= get_ue_golomb_31(&s->gb);
|
||||
if(tmp > 2){
|
||||
@ -2045,8 +2045,13 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
h->deblocking_filter^= 1; // 1<->0
|
||||
|
||||
if( h->deblocking_filter ) {
|
||||
h->slice_alpha_c0_offset = get_se_golomb(&s->gb) << 1;
|
||||
h->slice_beta_offset = get_se_golomb(&s->gb) << 1;
|
||||
h->slice_alpha_c0_offset += get_se_golomb(&s->gb) << 1;
|
||||
h->slice_beta_offset += get_se_golomb(&s->gb) << 1;
|
||||
if( h->slice_alpha_c0_offset > 104U
|
||||
|| h->slice_beta_offset > 104U){
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2071,7 +2076,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
return 1; // deblocking switched inside frame
|
||||
}
|
||||
}
|
||||
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]);
|
||||
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]);
|
||||
|
||||
#if 0 //FMO
|
||||
if( h->pps.num_slice_groups > 1 && h->pps.mb_slice_group_map_type >= 3 && h->pps.mb_slice_group_map_type <= 5)
|
||||
@ -2132,7 +2137,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
||||
s->current_picture_ptr->field_poc[0], s->current_picture_ptr->field_poc[1],
|
||||
h->ref_count[0], h->ref_count[1],
|
||||
s->qscale,
|
||||
h->deblocking_filter, h->slice_alpha_c0_offset/2, h->slice_beta_offset/2,
|
||||
h->deblocking_filter, h->slice_alpha_c0_offset/2-26, h->slice_beta_offset/2-26,
|
||||
h->use_weight,
|
||||
h->use_weight==1 && h->use_weight_chroma ? "c" : "",
|
||||
h->slice_type == FF_B_TYPE ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""
|
||||
|
@ -100,9 +100,9 @@ static const uint8_t tc0_table[52*3][4] = {
|
||||
};
|
||||
|
||||
static void av_noinline filter_mb_edgev( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h) {
|
||||
const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset;
|
||||
const unsigned int index_a = qp + h->slice_alpha_c0_offset;
|
||||
const int alpha = alpha_table[index_a];
|
||||
const int beta = (beta_table+52)[qp + h->slice_beta_offset];
|
||||
const int beta = beta_table[qp + h->slice_beta_offset];
|
||||
if (alpha ==0 || beta == 0) return;
|
||||
|
||||
if( bS[0] < 4 ) {
|
||||
@ -117,9 +117,9 @@ static void av_noinline filter_mb_edgev( uint8_t *pix, int stride, int16_t bS[4]
|
||||
}
|
||||
}
|
||||
static void av_noinline filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
|
||||
const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset;
|
||||
const unsigned int index_a = qp + h->slice_alpha_c0_offset;
|
||||
const int alpha = alpha_table[index_a];
|
||||
const int beta = (beta_table+52)[qp + h->slice_beta_offset];
|
||||
const int beta = beta_table[qp + h->slice_beta_offset];
|
||||
if (alpha ==0 || beta == 0) return;
|
||||
|
||||
if( bS[0] < 4 ) {
|
||||
@ -137,8 +137,8 @@ static void av_noinline filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4
|
||||
static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) {
|
||||
int i;
|
||||
int index_a = qp + h->slice_alpha_c0_offset;
|
||||
int alpha = (alpha_table+52)[index_a];
|
||||
int beta = (beta_table+52)[qp + h->slice_beta_offset];
|
||||
int alpha = alpha_table[index_a];
|
||||
int beta = beta_table[qp + h->slice_beta_offset];
|
||||
for( i = 0; i < 8; i++, pix += stride) {
|
||||
const int bS_index = (i >> 1) * bsi;
|
||||
|
||||
@ -147,7 +147,7 @@ static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int
|
||||
}
|
||||
|
||||
if( bS[bS_index] < 4 ) {
|
||||
const int tc0 = (tc0_table+52)[index_a][bS[bS_index]];
|
||||
const int tc0 = tc0_table[index_a][bS[bS_index]];
|
||||
const int p0 = pix[-1];
|
||||
const int p1 = pix[-2];
|
||||
const int p2 = pix[-3];
|
||||
@ -226,8 +226,8 @@ static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int
|
||||
static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) {
|
||||
int i;
|
||||
int index_a = qp + h->slice_alpha_c0_offset;
|
||||
int alpha = (alpha_table+52)[index_a];
|
||||
int beta = (beta_table+52)[qp + h->slice_beta_offset];
|
||||
int alpha = alpha_table[index_a];
|
||||
int beta = beta_table[qp + h->slice_beta_offset];
|
||||
for( i = 0; i < 4; i++, pix += stride) {
|
||||
const int bS_index = i*bsi;
|
||||
|
||||
@ -236,7 +236,7 @@ static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, in
|
||||
}
|
||||
|
||||
if( bS[bS_index] < 4 ) {
|
||||
const int tc = (tc0_table+52)[index_a][bS[bS_index]] + 1;
|
||||
const int tc = tc0_table[index_a][bS[bS_index]] + 1;
|
||||
const int p0 = pix[-1];
|
||||
const int p1 = pix[-2];
|
||||
const int q0 = pix[0];
|
||||
@ -270,9 +270,9 @@ static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, in
|
||||
}
|
||||
|
||||
static void av_noinline filter_mb_edgeh( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
|
||||
const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset;
|
||||
const unsigned int index_a = qp + h->slice_alpha_c0_offset;
|
||||
const int alpha = alpha_table[index_a];
|
||||
const int beta = (beta_table+52)[qp + h->slice_beta_offset];
|
||||
const int beta = beta_table[qp + h->slice_beta_offset];
|
||||
if (alpha ==0 || beta == 0) return;
|
||||
|
||||
if( bS[0] < 4 ) {
|
||||
@ -288,9 +288,9 @@ static void av_noinline filter_mb_edgeh( uint8_t *pix, int stride, int16_t bS[4]
|
||||
}
|
||||
|
||||
static void av_noinline filter_mb_edgech( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
|
||||
const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset;
|
||||
const unsigned int index_a = qp + h->slice_alpha_c0_offset;
|
||||
const int alpha = alpha_table[index_a];
|
||||
const int beta = (beta_table+52)[qp + h->slice_beta_offset];
|
||||
const int beta = beta_table[qp + h->slice_beta_offset];
|
||||
if (alpha ==0 || beta == 0) return;
|
||||
|
||||
if( bS[0] < 4 ) {
|
||||
@ -332,7 +332,7 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
|
||||
qp1 = (qp + qp1 + 1) >> 1;
|
||||
qpc0 = (qpc + qpc0 + 1) >> 1;
|
||||
qpc1 = (qpc + qpc1 + 1) >> 1;
|
||||
qp_thresh = 15 - h->slice_alpha_c0_offset;
|
||||
qp_thresh = 15+52 - h->slice_alpha_c0_offset;
|
||||
if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh &&
|
||||
qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh)
|
||||
return;
|
||||
|
@ -317,8 +317,8 @@ static int decode_slice(AVCodecContext *avctx,
|
||||
slice_param->cabac_init_idc = h->cabac_init_idc;
|
||||
slice_param->slice_qp_delta = s->qscale - h->pps.init_qp;
|
||||
slice_param->disable_deblocking_filter_idc = h->deblocking_filter < 2 ? !h->deblocking_filter : h->deblocking_filter;
|
||||
slice_param->slice_alpha_c0_offset_div2 = h->slice_alpha_c0_offset / 2;
|
||||
slice_param->slice_beta_offset_div2 = h->slice_beta_offset / 2;
|
||||
slice_param->slice_alpha_c0_offset_div2 = h->slice_alpha_c0_offset / 2 - 26;
|
||||
slice_param->slice_beta_offset_div2 = h->slice_beta_offset / 2 - 26;
|
||||
slice_param->luma_log2_weight_denom = h->luma_log2_weight_denom;
|
||||
slice_param->chroma_log2_weight_denom = h->chroma_log2_weight_denom;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user