Revision 0c32e19d

View differences:

libavcodec/dxva2_h264.c
225 225
        slice->num_ref_idx_l0_active_minus1 = h->ref_count[0] - 1;
226 226
    if (h->list_count > 1)
227 227
        slice->num_ref_idx_l1_active_minus1 = h->ref_count[1] - 1;
228
    slice->slice_alpha_c0_offset_div2   = h->slice_alpha_c0_offset / 2;
229
    slice->slice_beta_offset_div2       = h->slice_beta_offset / 2;
228
    slice->slice_alpha_c0_offset_div2   = h->slice_alpha_c0_offset / 2 - 26;
229
    slice->slice_beta_offset_div2       = h->slice_beta_offset     / 2 - 26;
230 230
    slice->Reserved8Bits                = 0;
231 231

  
232 232
    for (list = 0; list < 2; list++) {
libavcodec/h264.c
2032 2032
    }
2033 2033

  
2034 2034
    h->deblocking_filter = 1;
2035
    h->slice_alpha_c0_offset = 0;
2036
    h->slice_beta_offset = 0;
2035
    h->slice_alpha_c0_offset = 52;
2036
    h->slice_beta_offset = 52;
2037 2037
    if( h->pps.deblocking_filter_parameters_present ) {
2038 2038
        tmp= get_ue_golomb_31(&s->gb);
2039 2039
        if(tmp > 2){
......
2045 2045
            h->deblocking_filter^= 1; // 1<->0
2046 2046

  
2047 2047
        if( h->deblocking_filter ) {
2048
            h->slice_alpha_c0_offset = get_se_golomb(&s->gb) << 1;
2049
            h->slice_beta_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;
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

  
......
2071 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 2081
#if 0 //FMO
2077 2082
    if( h->pps.num_slice_groups > 1  && h->pps.mb_slice_group_map_type >= 3 && h->pps.mb_slice_group_map_type <= 5)
......
2132 2137
               s->current_picture_ptr->field_poc[0], s->current_picture_ptr->field_poc[1],
2133 2138
               h->ref_count[0], h->ref_count[1],
2134 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 2141
               h->use_weight,
2137 2142
               h->use_weight==1 && h->use_weight_chroma ? "c" : "",
2138 2143
               h->slice_type == FF_B_TYPE ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""
libavcodec/h264_loopfilter.c
100 100
};
101 101

  
102 102
static void av_noinline filter_mb_edgev( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h) {
103
    const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset;
103
    const unsigned int index_a = qp + h->slice_alpha_c0_offset;
104 104
    const int alpha = alpha_table[index_a];
105
    const int beta  = (beta_table+52)[qp + h->slice_beta_offset];
105
    const int beta  = beta_table[qp + h->slice_beta_offset];
106 106
    if (alpha ==0 || beta == 0) return;
107 107

  
108 108
    if( bS[0] < 4 ) {
......
117 117
    }
118 118
}
119 119
static void av_noinline filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
120
    const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset;
120
    const unsigned int index_a = qp + h->slice_alpha_c0_offset;
121 121
    const int alpha = alpha_table[index_a];
122
    const int beta  = (beta_table+52)[qp + h->slice_beta_offset];
122
    const int beta  = beta_table[qp + h->slice_beta_offset];
123 123
    if (alpha ==0 || beta == 0) return;
124 124

  
125 125
    if( bS[0] < 4 ) {
......
137 137
static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) {
138 138
    int i;
139 139
    int index_a = qp + h->slice_alpha_c0_offset;
140
    int alpha = (alpha_table+52)[index_a];
141
    int beta  = (beta_table+52)[qp + h->slice_beta_offset];
140
    int alpha = alpha_table[index_a];
141
    int beta  = beta_table[qp + h->slice_beta_offset];
142 142
    for( i = 0; i < 8; i++, pix += stride) {
143 143
        const int bS_index = (i >> 1) * bsi;
144 144

  
......
147 147
        }
148 148

  
149 149
        if( bS[bS_index] < 4 ) {
150
            const int tc0 = (tc0_table+52)[index_a][bS[bS_index]];
150
            const int tc0 = tc0_table[index_a][bS[bS_index]];
151 151
            const int p0 = pix[-1];
152 152
            const int p1 = pix[-2];
153 153
            const int p2 = pix[-3];
......
226 226
static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) {
227 227
    int i;
228 228
    int index_a = qp + h->slice_alpha_c0_offset;
229
    int alpha = (alpha_table+52)[index_a];
230
    int beta  = (beta_table+52)[qp + h->slice_beta_offset];
229
    int alpha = alpha_table[index_a];
230
    int beta  = beta_table[qp + h->slice_beta_offset];
231 231
    for( i = 0; i < 4; i++, pix += stride) {
232 232
        const int bS_index = i*bsi;
233 233

  
......
236 236
        }
237 237

  
238 238
        if( bS[bS_index] < 4 ) {
239
            const int tc = (tc0_table+52)[index_a][bS[bS_index]] + 1;
239
            const int tc = tc0_table[index_a][bS[bS_index]] + 1;
240 240
            const int p0 = pix[-1];
241 241
            const int p1 = pix[-2];
242 242
            const int q0 = pix[0];
......
270 270
}
271 271

  
272 272
static void av_noinline filter_mb_edgeh( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
273
    const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset;
273
    const unsigned int index_a = qp + h->slice_alpha_c0_offset;
274 274
    const int alpha = alpha_table[index_a];
275
    const int beta  = (beta_table+52)[qp + h->slice_beta_offset];
275
    const int beta  = beta_table[qp + h->slice_beta_offset];
276 276
    if (alpha ==0 || beta == 0) return;
277 277

  
278 278
    if( bS[0] < 4 ) {
......
288 288
}
289 289

  
290 290
static void av_noinline filter_mb_edgech( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
291
    const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset;
291
    const unsigned int index_a = qp + h->slice_alpha_c0_offset;
292 292
    const int alpha = alpha_table[index_a];
293
    const int beta  = (beta_table+52)[qp + h->slice_beta_offset];
293
    const int beta  = beta_table[qp + h->slice_beta_offset];
294 294
    if (alpha ==0 || beta == 0) return;
295 295

  
296 296
    if( bS[0] < 4 ) {
......
332 332
    qp1 = (qp + qp1 + 1) >> 1;
333 333
    qpc0 = (qpc + qpc0 + 1) >> 1;
334 334
    qpc1 = (qpc + qpc1 + 1) >> 1;
335
    qp_thresh = 15 - h->slice_alpha_c0_offset;
335
    qp_thresh = 15+52 - h->slice_alpha_c0_offset;
336 336
    if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh &&
337 337
       qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh)
338 338
        return;
libavcodec/vaapi_h264.c
317 317
    slice_param->cabac_init_idc                 = h->cabac_init_idc;
318 318
    slice_param->slice_qp_delta                 = s->qscale - h->pps.init_qp;
319 319
    slice_param->disable_deblocking_filter_idc  = h->deblocking_filter < 2 ? !h->deblocking_filter : h->deblocking_filter;
320
    slice_param->slice_alpha_c0_offset_div2     = h->slice_alpha_c0_offset / 2;
321
    slice_param->slice_beta_offset_div2         = h->slice_beta_offset / 2;
320
    slice_param->slice_alpha_c0_offset_div2     = h->slice_alpha_c0_offset / 2 - 26;
321
    slice_param->slice_beta_offset_div2         = h->slice_beta_offset     / 2 - 26;
322 322
    slice_param->luma_log2_weight_denom         = h->luma_log2_weight_denom;
323 323
    slice_param->chroma_log2_weight_denom       = h->chroma_log2_weight_denom;
324 324

  

Also available in: Unified diff