Merge commit 'e76f2d11970484266e67a12961f2339a5c2fccf9'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 28 Jul 2014 12:02:03 +0000 (14:02 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 28 Jul 2014 12:02:03 +0000 (14:02 +0200)
* commit 'e76f2d11970484266e67a12961f2339a5c2fccf9':
  hevc: eliminate the last element from TransformTree

Conflicts:
libavcodec/hevc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/hevc.c
libavcodec/hevc.h

@@@ -860,27 -1234,32 +860,26 @@@ static int hls_transform_unit(HEVCConte
                                int xBase, int yBase, int cb_xBase, int cb_yBase,
                                int log2_cb_size, int log2_trafo_size,
                                int trafo_depth, int blk_idx,
-                               int *cbf_cb, int *cbf_cr)
 -                              int cbf_luma, int cbf_cb, int cbf_cr)
++                              int cbf_luma, int *cbf_cb, int *cbf_cr)
  {
 -    HEVCLocalContext *lc = &s->HEVClc;
 +    HEVCLocalContext *lc = s->HEVClc;
 +    const int log2_trafo_size_c = log2_trafo_size - s->sps->hshift[1];
 +    int i;
  
      if (lc->cu.pred_mode == MODE_INTRA) {
          int trafo_size = 1 << log2_trafo_size;
          ff_hevc_set_neighbour_available(s, x0, y0, trafo_size, trafo_size);
  
          s->hpc.intra_pred[log2_trafo_size - 2](s, x0, y0, 0);
 -        if (log2_trafo_size > 2) {
 -            trafo_size = trafo_size << (s->sps->hshift[1] - 1);
 -            ff_hevc_set_neighbour_available(s, x0, y0, trafo_size, trafo_size);
 -            s->hpc.intra_pred[log2_trafo_size - 3](s, x0, y0, 1);
 -            s->hpc.intra_pred[log2_trafo_size - 3](s, x0, y0, 2);
 -        } else if (blk_idx == 3) {
 -            trafo_size = trafo_size << s->sps->hshift[1];
 -            ff_hevc_set_neighbour_available(s, xBase, yBase,
 -                                            trafo_size, trafo_size);
 -            s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 1);
 -            s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 2);
 -        }
      }
  
-     if (lc->tt.cbf_luma || cbf_cb[0] || cbf_cr[0] ||
 -    if (cbf_luma || cbf_cb || cbf_cr) {
++    if (cbf_luma || cbf_cb[0] || cbf_cr[0] ||
 +        (s->sps->chroma_format_idc == 2 && (cbf_cb[1] || cbf_cr[1]))) {
          int scan_idx   = SCAN_DIAG;
          int scan_idx_c = SCAN_DIAG;
-         int cbf_luma = lc->tt.cbf_luma;
 +        int cbf_chroma = cbf_cb[0] || cbf_cr[0] ||
 +                         (s->sps->chroma_format_idc == 2 &&
 +                         (cbf_cb[1] || cbf_cr[1]));
  
          if (s->pps->cu_qp_delta_enabled_flag && !lc->tu.is_cu_qp_delta_coded) {
              lc->tu.cu_qp_delta = ff_hevc_cu_qp_delta_abs(s);
@@@ -1083,38 -1336,19 +1082,36 @@@ static int hls_transform_tree(HEVCConte
                                int xBase, int yBase, int cb_xBase, int cb_yBase,
                                int log2_cb_size, int log2_trafo_size,
                                int trafo_depth, int blk_idx,
 -                              int cbf_cb, int cbf_cr)
 +                              int *base_cbf_cb, int *base_cbf_cr)
  {
 -    HEVCLocalContext *lc = &s->HEVClc;
 +    HEVCLocalContext *lc = s->HEVClc;
      uint8_t split_transform_flag;
 +    int cbf_cb[2];
 +    int cbf_cr[2];
      int ret;
  
 +    cbf_cb[0] = base_cbf_cb[0];
 +    cbf_cb[1] = base_cbf_cb[1];
 +    cbf_cr[0] = base_cbf_cr[0];
 +    cbf_cr[1] = base_cbf_cr[1];
 +
      if (lc->cu.intra_split_flag) {
 -        if (trafo_depth == 1)
 -            lc->tu.cur_intra_pred_mode = lc->pu.intra_pred_mode[blk_idx];
 +        if (trafo_depth == 1) {
 +            lc->tu.intra_pred_mode   = lc->pu.intra_pred_mode[blk_idx];
 +            if (s->sps->chroma_format_idc == 3) {
 +                lc->tu.intra_pred_mode_c = lc->pu.intra_pred_mode_c[blk_idx];
 +                lc->tu.chroma_mode_c     = lc->pu.chroma_mode_c[blk_idx];
 +            } else {
 +                lc->tu.intra_pred_mode_c = lc->pu.intra_pred_mode_c[0];
 +                lc->tu.chroma_mode_c     = lc->pu.chroma_mode_c[0];
 +            }
 +        }
      } else {
 -        lc->tu.cur_intra_pred_mode = lc->pu.intra_pred_mode[0];
 +        lc->tu.intra_pred_mode   = lc->pu.intra_pred_mode[0];
 +        lc->tu.intra_pred_mode_c = lc->pu.intra_pred_mode_c[0];
 +        lc->tu.chroma_mode_c     = lc->pu.chroma_mode_c[0];
      }
  
-     lc->tt.cbf_luma = 1;
      if (log2_trafo_size <= s->sps->log2_max_trafo_size &&
          log2_trafo_size >  s->sps->log2_min_tb_size    &&
          trafo_depth     < lc->cu.max_trafo_depth       &&
@@@ -1177,12 -1398,11 +1174,13 @@@ do 
          int min_tu_size      = 1 << s->sps->log2_min_tb_size;
          int log2_min_tu_size = s->sps->log2_min_tb_size;
          int min_tu_width     = s->sps->min_tb_width;
+         int cbf_luma         = 1;
  
          if (lc->cu.pred_mode == MODE_INTRA || trafo_depth != 0 ||
 -            cbf_cb || cbf_cr)
 +            cbf_cb[0] || cbf_cr[0] ||
 +            (s->sps->chroma_format_idc == 2 && (cbf_cb[1] || cbf_cr[1]))) {
-             lc->tt.cbf_luma = ff_hevc_cbf_luma_decode(s, trafo_depth);
+             cbf_luma = ff_hevc_cbf_luma_decode(s, trafo_depth);
 +        }
  
          ret = hls_transform_unit(s, x0, y0, xBase, yBase, cb_xBase, cb_yBase,
                                   log2_cb_size, log2_trafo_size, trafo_depth,
@@@ -679,29 -642,15 +679,25 @@@ typedef struct PredictionUnit 
      uint8_t intra_pred_mode[4];
      Mv mvd;
      uint8_t merge_flag;
 -    uint8_t intra_pred_mode_c;
 +    uint8_t intra_pred_mode_c[4];
 +    uint8_t chroma_mode_c[4];
  } PredictionUnit;
  
- typedef struct TransformTree {
-     uint8_t cbf_luma;
- } TransformTree;
  typedef struct TransformUnit {
 +    DECLARE_ALIGNED(32, int16_t, coeffs[2][MAX_TB_SIZE * MAX_TB_SIZE]);
      int cu_qp_delta;
  
 +    int res_scale_val;
 +
      // Inferred parameters;
 -    int cur_intra_pred_mode;
 +    int intra_pred_mode;
 +    int intra_pred_mode_c;
 +    int chroma_mode_c;
      uint8_t is_cu_qp_delta_coded;
 +    uint8_t is_cu_chroma_qp_offset_coded;
 +    int8_t  cu_qp_offset_cb;
 +    int8_t  cu_qp_offset_cr;
 +    uint8_t cross_pf;
  } TransformUnit;
  
  typedef struct DBParams {