Merge commit '5f390eef8ee2b8adab00c5d2923a52aa261eb999'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 21 Mar 2015 13:16:29 +0000 (14:16 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 21 Mar 2015 13:16:29 +0000 (14:16 +0100)
* commit '5f390eef8ee2b8adab00c5d2923a52aa261eb999':
  h264: move mb_[uv]linesize into the per-slice context

Conflicts:
libavcodec/h264.h
libavcodec/h264_mb.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/h264.h
libavcodec/h264_mb.c
libavcodec/h264_mb_template.c
libavcodec/h264_mc_template.c
libavcodec/h264_slice.c

@@@ -452,10 -416,6 +455,8 @@@ typedef struct H264Context 
      uint32_t *mb2br_xy;
      int b_stride;       // FIXME use s->b4_stride
  
-     ptrdiff_t mb_linesize;  ///< may be equal to s->linesize or s->linesize * 2, for mbaff
-     ptrdiff_t mb_uvlinesize;
 +
 +    unsigned current_sps_id; ///< id of the current SPS
      SPS sps; ///< current sps
      PPS pps; ///< current pps
  
@@@ -216,7 -216,7 +216,7 @@@ static av_always_inline void mc_dir_par
      const int mx      = sl->mv_cache[list][scan8[n]][0] + src_x_offset * 8;
      int my            = sl->mv_cache[list][scan8[n]][1] + src_y_offset * 8;
      const int luma_xy = (mx & 3) + ((my & 3) << 2);
-     ptrdiff_t offset  = (mx >> 2) * (1 << pixel_shift) + (my >> 2) * h->mb_linesize;
 -    ptrdiff_t offset  = ((mx >> 2) << pixel_shift) + (my >> 2) * sl->mb_linesize;
++    ptrdiff_t offset  = (mx >> 2) * (1 << pixel_shift) + (my >> 2) * sl->mb_linesize;
      uint8_t *src_y    = pic->f.data[0] + offset;
      uint8_t *src_cb, *src_cr;
      int extra_width  = 0;
          emu |= (my >> 3) < 0 || (my >> 3) + 8 >= (pic_height >> 1);
      }
  
 -    src_cb = pic->f.data[1] + ((mx >> 3) << pixel_shift) +
 +    src_cb = pic->f.data[1] + ((mx >> 3) * (1 << pixel_shift)) +
-              (my >> ysh) * h->mb_uvlinesize;
+              (my >> ysh) * sl->mb_uvlinesize;
 -    src_cr = pic->f.data[2] + ((mx >> 3) << pixel_shift) +
 +    src_cr = pic->f.data[2] + ((mx >> 3) * (1 << pixel_shift)) +
-              (my >> ysh) * h->mb_uvlinesize;
+              (my >> ysh) * sl->mb_uvlinesize;
  
      if (emu) {
          h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src_cb,
                                   pic_width >> 1, pic_height >> (chroma_idc == 1 /* yuv420 */));
          src_cb = h->edge_emu_buffer;
      }
-     chroma_op(dest_cb, src_cb, h->mb_uvlinesize,
+     chroma_op(dest_cb, src_cb, sl->mb_uvlinesize,
                height >> (chroma_idc == 1 /* yuv420 */),
 -              mx & 7, (my << (chroma_idc == 2 /* yuv422 */)) & 7);
 +              mx & 7, ((unsigned)my << (chroma_idc == 2 /* yuv422 */)) & 7);
  
      if (emu) {
          h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src_cr,
                                   pic_width >> 1, pic_height >> (chroma_idc == 1 /* yuv420 */));
          src_cr = h->edge_emu_buffer;
      }
-     chroma_op(dest_cr, src_cr, h->mb_uvlinesize, height >> (chroma_idc == 1 /* yuv420 */),
+     chroma_op(dest_cr, src_cr, sl->mb_uvlinesize, height >> (chroma_idc == 1 /* yuv420 */),
 -              mx & 7, (my << (chroma_idc == 2 /* yuv422 */)) & 7);
 +              mx & 7, ((unsigned)my << (chroma_idc == 2 /* yuv422 */)) & 7);
  }
  
  static av_always_inline void mc_part_std(H264Context *h, H264SliceContext *sl,
@@@ -423,35 -423,31 +423,35 @@@ static av_always_inline void mc_part_we
          if (sl->use_weight == 2) {
              int weight0 = sl->implicit_weight[refn0][refn1][h->mb_y & 1];
              int weight1 = 64 - weight0;
-             luma_weight_avg(dest_y, tmp_y, h->mb_linesize,
+             luma_weight_avg(dest_y, tmp_y, sl->mb_linesize,
                              height, 5, weight0, weight1, 0);
 -            chroma_weight_avg(dest_cb, tmp_cb, sl->mb_uvlinesize,
 -                              chroma_height, 5, weight0, weight1, 0);
 -            chroma_weight_avg(dest_cr, tmp_cr, sl->mb_uvlinesize,
 -                              chroma_height, 5, weight0, weight1, 0);
 +            if (!CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {
-                 chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize,
++                chroma_weight_avg(dest_cb, tmp_cb, sl->mb_uvlinesize,
 +                                  chroma_height, 5, weight0, weight1, 0);
-                 chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize,
++                chroma_weight_avg(dest_cr, tmp_cr, sl->mb_uvlinesize,
 +                                  chroma_height, 5, weight0, weight1, 0);
 +            }
          } else {
-             luma_weight_avg(dest_y, tmp_y, h->mb_linesize, height,
+             luma_weight_avg(dest_y, tmp_y, sl->mb_linesize, height,
                              sl->luma_log2_weight_denom,
                              sl->luma_weight[refn0][0][0],
                              sl->luma_weight[refn1][1][0],
                              sl->luma_weight[refn0][0][1] +
                              sl->luma_weight[refn1][1][1]);
 -            chroma_weight_avg(dest_cb, tmp_cb, sl->mb_uvlinesize, chroma_height,
 -                              sl->chroma_log2_weight_denom,
 -                              sl->chroma_weight[refn0][0][0][0],
 -                              sl->chroma_weight[refn1][1][0][0],
 -                              sl->chroma_weight[refn0][0][0][1] +
 -                              sl->chroma_weight[refn1][1][0][1]);
 -            chroma_weight_avg(dest_cr, tmp_cr, sl->mb_uvlinesize, chroma_height,
 -                              sl->chroma_log2_weight_denom,
 -                              sl->chroma_weight[refn0][0][1][0],
 -                              sl->chroma_weight[refn1][1][1][0],
 -                              sl->chroma_weight[refn0][0][1][1] +
 -                              sl->chroma_weight[refn1][1][1][1]);
 +            if (!CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {
-                 chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, chroma_height,
++                chroma_weight_avg(dest_cb, tmp_cb, sl->mb_uvlinesize, chroma_height,
 +                                  sl->chroma_log2_weight_denom,
 +                                  sl->chroma_weight[refn0][0][0][0],
 +                                  sl->chroma_weight[refn1][1][0][0],
 +                                  sl->chroma_weight[refn0][0][0][1] +
 +                                  sl->chroma_weight[refn1][1][0][1]);
-                 chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, chroma_height,
++                chroma_weight_avg(dest_cr, tmp_cr, sl->mb_uvlinesize, chroma_height,
 +                                  sl->chroma_log2_weight_denom,
 +                                  sl->chroma_weight[refn0][0][1][0],
 +                                  sl->chroma_weight[refn1][1][1][0],
 +                                  sl->chroma_weight[refn0][0][1][1] +
 +                                  sl->chroma_weight[refn1][1][1][1]);
 +            }
          }
      } else {
          int list     = list1 ? 1 : 0;
                         sl->luma_log2_weight_denom,
                         sl->luma_weight[refn][list][0],
                         sl->luma_weight[refn][list][1]);
 -        if (sl->use_weight_chroma) {
 -            chroma_weight_op(dest_cb, sl->mb_uvlinesize, chroma_height,
 -                             sl->chroma_log2_weight_denom,
 -                             sl->chroma_weight[refn][list][0][0],
 -                             sl->chroma_weight[refn][list][0][1]);
 -            chroma_weight_op(dest_cr, sl->mb_uvlinesize, chroma_height,
 -                             sl->chroma_log2_weight_denom,
 -                             sl->chroma_weight[refn][list][1][0],
 -                             sl->chroma_weight[refn][list][1][1]);
 +        if (!CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {
 +            if (sl->use_weight_chroma) {
-                 chroma_weight_op(dest_cb, h->mb_uvlinesize, chroma_height,
++                chroma_weight_op(dest_cb, sl->mb_uvlinesize, chroma_height,
 +                                 sl->chroma_log2_weight_denom,
 +                                 sl->chroma_weight[refn][list][0][0],
 +                                 sl->chroma_weight[refn][list][0][1]);
-                 chroma_weight_op(dest_cr, h->mb_uvlinesize, chroma_height,
++                chroma_weight_op(dest_cr, sl->mb_uvlinesize, chroma_height,
 +                                 sl->chroma_log2_weight_denom,
 +                                 sl->chroma_weight[refn][list][1][0],
 +                                 sl->chroma_weight[refn][list][1][1]);
 +            }
          }
      }
  }
@@@ -491,8 -485,8 +491,8 @@@ static av_always_inline void prefetch_m
          const int mx  = (sl->mv_cache[list][scan8[0]][0] >> 2) + 16 * h->mb_x + 8;
          const int my  = (sl->mv_cache[list][scan8[0]][1] >> 2) + 16 * h->mb_y;
          uint8_t **src = h->ref_list[list][refn].f.data;
 -        int off       = (mx << pixel_shift) +
 +        int off       =  mx * (1<< pixel_shift) +
-                         (my + (h->mb_x & 3) * 4) * h->mb_linesize +
+                         (my + (h->mb_x & 3) * 4) * sl->mb_linesize +
                          (64 << pixel_shift);
          h->vdsp.prefetch(src[0] + off, h->linesize, 4);
          if (chroma_idc == 3 /* yuv444 */) {
Simple merge
Simple merge
Simple merge