decodemv.c 99.7 KB
Newer Older
Jingning Han's avatar
Jingning Han committed
1
/*
Yaowu Xu's avatar
Yaowu Xu committed
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Jingning Han's avatar
Jingning Han committed
3
 *
Yaowu Xu's avatar
Yaowu Xu committed
4 5 6 7 8 9
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
Jingning Han's avatar
Jingning Han committed
10 11 12 13
 */

#include <assert.h>

14 15 16 17 18 19 20
#include "av1/common/common.h"
#include "av1/common/entropy.h"
#include "av1/common/entropymode.h"
#include "av1/common/entropymv.h"
#include "av1/common/mvref_common.h"
#include "av1/common/pred_common.h"
#include "av1/common/reconinter.h"
hui su's avatar
hui su committed
21 22 23
#if CONFIG_EXT_INTRA
#include "av1/common/reconintra.h"
#endif  // CONFIG_EXT_INTRA
24
#include "av1/common/seg_common.h"
Yue Chen's avatar
Yue Chen committed
25
#include "av1/common/warped_motion.h"
26 27

#include "av1/decoder/decodeframe.h"
Jingning Han's avatar
Jingning Han committed
28
#include "av1/decoder/decodemv.h"
29

Yaowu Xu's avatar
Yaowu Xu committed
30
#include "aom_dsp/aom_dsp_common.h"
31

Michael Bebenita's avatar
Michael Bebenita committed
32
#define ACCT_STR __func__
33

34
#define DEC_MISMATCH_DEBUG 0
35

36
static PREDICTION_MODE read_intra_mode(aom_reader *r, aom_cdf_prob *cdf) {
Hui Su's avatar
Hui Su committed
37
  return (PREDICTION_MODE)aom_read_symbol(r, cdf, INTRA_MODES, ACCT_STR);
38
}
Jingning Han's avatar
Jingning Han committed
39

40 41 42 43 44
static int read_delta_qindex(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r,
                             MB_MODE_INFO *const mbmi, int mi_col, int mi_row) {
  FRAME_COUNTS *counts = xd->counts;
  int sign, abs, reduced_delta_qindex = 0;
  BLOCK_SIZE bsize = mbmi->sb_type;
45 46
  const int b_col = mi_col & (cm->mib_size - 1);
  const int b_row = mi_row & (cm->mib_size - 1);
47
  const int read_delta_q_flag = (b_col == 0 && b_row == 0);
Thomas Davies's avatar
Thomas Davies committed
48 49 50 51
  int rem_bits, thr;
  int i, smallval;
  FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
  (void)cm;
52

Pavel Frolov's avatar
Pavel Frolov committed
53
  if ((bsize != cm->sb_size || mbmi->skip == 0) && read_delta_q_flag) {
Thomas Davies's avatar
Thomas Davies committed
54 55 56 57 58 59 60 61
    abs = aom_read_symbol(r, ec_ctx->delta_q_cdf, DELTA_Q_PROBS + 1, ACCT_STR);
    smallval = (abs < DELTA_Q_SMALL);
    if (counts) {
      for (i = 0; i < abs; ++i) counts->delta_q[i][1]++;
      if (smallval) counts->delta_q[abs][0]++;
    }

    if (!smallval) {
62
      rem_bits = aom_read_literal(r, 3, ACCT_STR) + 1;
63 64 65 66 67 68 69 70 71 72 73 74 75 76
      thr = (1 << rem_bits) + 1;
      abs = aom_read_literal(r, rem_bits, ACCT_STR) + thr;
    }

    if (abs) {
      sign = aom_read_bit(r, ACCT_STR);
    } else {
      sign = 1;
    }

    reduced_delta_qindex = sign ? -abs : abs;
  }
  return reduced_delta_qindex;
}
Fangwen Fu's avatar
Fangwen Fu committed
77 78
#if CONFIG_EXT_DELTA_Q
static int read_delta_lflevel(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r,
79 80 81
#if CONFIG_LOOPFILTER_LEVEL
                              int lf_id,
#endif
Fangwen Fu's avatar
Fangwen Fu committed
82 83 84 85 86
                              MB_MODE_INFO *const mbmi, int mi_col,
                              int mi_row) {
  FRAME_COUNTS *counts = xd->counts;
  int sign, abs, reduced_delta_lflevel = 0;
  BLOCK_SIZE bsize = mbmi->sb_type;
87 88
  const int b_col = mi_col & (cm->mib_size - 1);
  const int b_row = mi_row & (cm->mib_size - 1);
Fangwen Fu's avatar
Fangwen Fu committed
89 90 91 92 93 94
  const int read_delta_lf_flag = (b_col == 0 && b_row == 0);
  int rem_bits, thr;
  int i, smallval;
  FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
  (void)cm;

95
  if ((bsize != cm->sb_size || mbmi->skip == 0) && read_delta_lf_flag) {
96
#if CONFIG_LOOPFILTER_LEVEL
97 98 99 100 101 102 103 104
    if (cm->delta_lf_multi) {
      assert(lf_id >= 0 && lf_id < FRAME_LF_COUNT);
      abs = aom_read_symbol(r, ec_ctx->delta_lf_multi_cdf[lf_id],
                            DELTA_LF_PROBS + 1, ACCT_STR);
    } else {
      abs = aom_read_symbol(r, ec_ctx->delta_lf_cdf, DELTA_LF_PROBS + 1,
                            ACCT_STR);
    }
105
#else
Fangwen Fu's avatar
Fangwen Fu committed
106 107
    abs =
        aom_read_symbol(r, ec_ctx->delta_lf_cdf, DELTA_LF_PROBS + 1, ACCT_STR);
108
#endif  // CONFIG_LOOPFILTER_LEVEL
Fangwen Fu's avatar
Fangwen Fu committed
109 110
    smallval = (abs < DELTA_LF_SMALL);
    if (counts) {
111
#if CONFIG_LOOPFILTER_LEVEL
112 113 114 115 116 117 118
      if (cm->delta_lf_multi) {
        for (i = 0; i < abs; ++i) counts->delta_lf_multi[lf_id][i][1]++;
        if (smallval) counts->delta_lf_multi[lf_id][abs][0]++;
      } else {
        for (i = 0; i < abs; ++i) counts->delta_lf[i][1]++;
        if (smallval) counts->delta_lf[abs][0]++;
      }
119
#else
Fangwen Fu's avatar
Fangwen Fu committed
120 121
      for (i = 0; i < abs; ++i) counts->delta_lf[i][1]++;
      if (smallval) counts->delta_lf[abs][0]++;
122
#endif  // CONFIG_LOOPFILTER_LEVEL
Fangwen Fu's avatar
Fangwen Fu committed
123 124
    }
    if (!smallval) {
125
      rem_bits = aom_read_literal(r, 3, ACCT_STR) + 1;
Fangwen Fu's avatar
Fangwen Fu committed
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
      thr = (1 << rem_bits) + 1;
      abs = aom_read_literal(r, rem_bits, ACCT_STR) + thr;
    }

    if (abs) {
      sign = aom_read_bit(r, ACCT_STR);
    } else {
      sign = 1;
    }

    reduced_delta_lflevel = sign ? -abs : abs;
  }
  return reduced_delta_lflevel;
}
#endif
141

Luc Trudeau's avatar
Luc Trudeau committed
142
static UV_PREDICTION_MODE read_intra_mode_uv(FRAME_CONTEXT *ec_ctx,
143
                                             aom_reader *r,
Luc Trudeau's avatar
Luc Trudeau committed
144 145
                                             PREDICTION_MODE y_mode) {
  const UV_PREDICTION_MODE uv_mode =
146 147 148
#if CONFIG_CFL
      aom_read_symbol(r, ec_ctx->uv_mode_cdf[y_mode], UV_INTRA_MODES, ACCT_STR);
#else
149
      read_intra_mode(r, ec_ctx->uv_mode_cdf[y_mode]);
150
#endif  // CONFIG_CFL
Jingning Han's avatar
Jingning Han committed
151 152 153
  return uv_mode;
}

Luc Trudeau's avatar
Luc Trudeau committed
154
#if CONFIG_CFL
155
static int read_cfl_alphas(FRAME_CONTEXT *const ec_ctx, aom_reader *r,
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
                           int *signs_out) {
  const int joint_sign =
      aom_read_symbol(r, ec_ctx->cfl_sign_cdf, CFL_JOINT_SIGNS, "cfl:signs");
  int idx = 0;
  // Magnitudes are only coded for nonzero values
  if (CFL_SIGN_U(joint_sign) != CFL_SIGN_ZERO) {
    aom_cdf_prob *cdf_u = ec_ctx->cfl_alpha_cdf[CFL_CONTEXT_U(joint_sign)];
    idx = aom_read_symbol(r, cdf_u, CFL_ALPHABET_SIZE, "cfl:alpha_u")
          << CFL_ALPHABET_SIZE_LOG2;
  }
  if (CFL_SIGN_V(joint_sign) != CFL_SIGN_ZERO) {
    aom_cdf_prob *cdf_v = ec_ctx->cfl_alpha_cdf[CFL_CONTEXT_V(joint_sign)];
    idx += aom_read_symbol(r, cdf_v, CFL_ALPHABET_SIZE, "cfl:alpha_v");
  }
  *signs_out = joint_sign;
  return idx;
Luc Trudeau's avatar
Luc Trudeau committed
172 173 174
}
#endif

Yue Chen's avatar
Yue Chen committed
175 176
static INTERINTRA_MODE read_interintra_mode(MACROBLOCKD *xd, aom_reader *r,
                                            int size_group) {
177 178 179
  const INTERINTRA_MODE ii_mode = (INTERINTRA_MODE)aom_read_symbol(
      r, xd->tile_ctx->interintra_mode_cdf[size_group], INTERINTRA_MODES,
      ACCT_STR);
180
  FRAME_COUNTS *counts = xd->counts;
181
  if (counts) ++counts->interintra_mode[size_group][ii_mode];
182 183 184
  return ii_mode;
}

185
static PREDICTION_MODE read_inter_mode(FRAME_CONTEXT *ec_ctx, MACROBLOCKD *xd,
Yaowu Xu's avatar
Yaowu Xu committed
186
                                       aom_reader *r, int16_t ctx) {
187
  FRAME_COUNTS *counts = xd->counts;
188
  int16_t mode_ctx = ctx & NEWMV_CTX_MASK;
189 190 191 192 193 194 195
  int is_newmv, is_zeromv, is_refmv;
#if CONFIG_NEW_MULTISYMBOL
  is_newmv = aom_read_symbol(r, ec_ctx->newmv_cdf[mode_ctx], 2, ACCT_STR) == 0;
#else
  is_newmv = aom_read(r, ec_ctx->newmv_prob[mode_ctx], ACCT_STR) == 0;
#endif
  if (is_newmv) {
196
    if (counts) ++counts->newmv_mode[mode_ctx][0];
197
    return NEWMV;
198
  }
199
  if (counts) ++counts->newmv_mode[mode_ctx][1];
Sarah Parker's avatar
Sarah Parker committed
200 201
  if (ctx & (1 << ALL_ZERO_FLAG_OFFSET)) return GLOBALMV;
  mode_ctx = (ctx >> GLOBALMV_OFFSET) & GLOBALMV_CTX_MASK;
202 203 204 205 206 207 208
#if CONFIG_NEW_MULTISYMBOL
  is_zeromv =
      aom_read_symbol(r, ec_ctx->zeromv_cdf[mode_ctx], 2, ACCT_STR) == 0;
#else
  is_zeromv = aom_read(r, ec_ctx->zeromv_prob[mode_ctx], ACCT_STR) == 0;
#endif
  if (is_zeromv) {
209
    if (counts) ++counts->zeromv_mode[mode_ctx][0];
Sarah Parker's avatar
Sarah Parker committed
210
    return GLOBALMV;
211
  }
212
  if (counts) ++counts->zeromv_mode[mode_ctx][1];
213
  mode_ctx = (ctx >> REFMV_OFFSET) & REFMV_CTX_MASK;
214 215 216
  if (ctx & (1 << SKIP_NEARESTMV_OFFSET)) mode_ctx = 6;
  if (ctx & (1 << SKIP_NEARMV_OFFSET)) mode_ctx = 7;
  if (ctx & (1 << SKIP_NEARESTMV_SUB8X8_OFFSET)) mode_ctx = 8;
217 218 219 220 221 222
#if CONFIG_NEW_MULTISYMBOL
  is_refmv = aom_read_symbol(r, ec_ctx->refmv_cdf[mode_ctx], 2, ACCT_STR) == 0;
#else
  is_refmv = aom_read(r, ec_ctx->refmv_prob[mode_ctx], ACCT_STR) == 0;
#endif
  if (is_refmv) {
223
    if (counts) ++counts->refmv_mode[mode_ctx][0];
224 225
    return NEARESTMV;
  } else {
226
    if (counts) ++counts->refmv_mode[mode_ctx][1];
227 228 229 230
    return NEARMV;
  }
  // Invalid prediction mode.
  assert(0);
Jingning Han's avatar
Jingning Han committed
231 232
}

233
static void read_drl_idx(FRAME_CONTEXT *ec_ctx, MACROBLOCKD *xd,
Yaowu Xu's avatar
Yaowu Xu committed
234 235
                         MB_MODE_INFO *mbmi, aom_reader *r) {
  uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
236
  mbmi->ref_mv_idx = 0;
237
  if (mbmi->mode == NEWMV || mbmi->mode == NEW_NEWMV
238
#if CONFIG_COMPOUND_SINGLEREF
239
      || mbmi->mode == SR_NEW_NEWMV
240
#endif  // CONFIG_COMPOUND_SINGLEREF
241
      ) {
242 243 244
    int idx;
    for (idx = 0; idx < 2; ++idx) {
      if (xd->ref_mv_count[ref_frame_type] > idx + 1) {
Yaowu Xu's avatar
Yaowu Xu committed
245
        uint8_t drl_ctx = av1_drl_ctx(xd->ref_mv_stack[ref_frame_type], idx);
246 247 248 249 250 251 252 253
#if CONFIG_NEW_MULTISYMBOL
        int drl_idx = aom_read_symbol(r, ec_ctx->drl_cdf[drl_ctx], 2, ACCT_STR);
#else
        int drl_idx = aom_read(r, ec_ctx->drl_prob[drl_ctx], ACCT_STR);
#endif
        mbmi->ref_mv_idx = idx + drl_idx;
        if (xd->counts) ++xd->counts->drl_mode[drl_ctx][drl_idx];
        if (!drl_idx) return;
254 255 256
      }
    }
  }
David Barker's avatar
David Barker committed
257
  if (have_nearmv_in_inter_mode(mbmi->mode)) {
258 259 260 261 262 263
    int idx;
    // Offset the NEARESTMV mode.
    // TODO(jingning): Unify the two syntax decoding loops after the NEARESTMV
    // mode is factored in.
    for (idx = 1; idx < 3; ++idx) {
      if (xd->ref_mv_count[ref_frame_type] > idx + 1) {
Yaowu Xu's avatar
Yaowu Xu committed
264
        uint8_t drl_ctx = av1_drl_ctx(xd->ref_mv_stack[ref_frame_type], idx);
265 266 267 268 269 270 271 272
#if CONFIG_NEW_MULTISYMBOL
        int drl_idx = aom_read_symbol(r, ec_ctx->drl_cdf[drl_ctx], 2, ACCT_STR);
#else
        int drl_idx = aom_read(r, ec_ctx->drl_prob[drl_ctx], ACCT_STR);
#endif
        mbmi->ref_mv_idx = idx + drl_idx - 1;
        if (xd->counts) ++xd->counts->drl_mode[drl_ctx][drl_idx];
        if (!drl_idx) return;
273 274 275 276 277
      }
    }
  }
}

Yaowu Xu's avatar
Yaowu Xu committed
278
static MOTION_MODE read_motion_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
279 280
                                    MODE_INFO *mi, aom_reader *r) {
  MB_MODE_INFO *mbmi = &mi->mbmi;
Yue Chen's avatar
Yue Chen committed
281
#if CONFIG_NEW_MULTISYMBOL
Thomas Davies's avatar
Thomas Davies committed
282 283 284
  (void)cm;
#endif

285
  const MOTION_MODE last_motion_mode_allowed =
286
      motion_mode_allowed(0, xd->global_motion, xd, mi);
Yue Chen's avatar
Yue Chen committed
287 288
  int motion_mode;
  FRAME_COUNTS *counts = xd->counts;
Yaowu Xu's avatar
Yaowu Xu committed
289

Yue Chen's avatar
Yue Chen committed
290
  if (last_motion_mode_allowed == SIMPLE_TRANSLATION) return SIMPLE_TRANSLATION;
Yue Chen's avatar
Yue Chen committed
291

Yue Chen's avatar
Yue Chen committed
292
  if (last_motion_mode_allowed == OBMC_CAUSAL) {
293 294 295 296
#if CONFIG_NEW_MULTISYMBOL
    motion_mode =
        aom_read_symbol(r, xd->tile_ctx->obmc_cdf[mbmi->sb_type], 2, ACCT_STR);
#else
Yue Chen's avatar
Yue Chen committed
297
    motion_mode = aom_read(r, cm->fc->obmc_prob[mbmi->sb_type], ACCT_STR);
298
#endif
Yue Chen's avatar
Yue Chen committed
299 300 301
    if (counts) ++counts->obmc[mbmi->sb_type][motion_mode];
    return (MOTION_MODE)(SIMPLE_TRANSLATION + motion_mode);
  } else {
Yaowu Xu's avatar
Yaowu Xu committed
302
    motion_mode =
Thomas Davies's avatar
Thomas Davies committed
303 304
        aom_read_symbol(r, xd->tile_ctx->motion_mode_cdf[mbmi->sb_type],
                        MOTION_MODES, ACCT_STR);
Yaowu Xu's avatar
Yaowu Xu committed
305 306 307 308
    if (counts) ++counts->motion_mode[mbmi->sb_type][motion_mode];
    return (MOTION_MODE)(SIMPLE_TRANSLATION + motion_mode);
  }
}
309

Yaowu Xu's avatar
Yaowu Xu committed
310 311
static PREDICTION_MODE read_inter_compound_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
                                                aom_reader *r, int16_t ctx) {
312
  (void)cm;
Zoe Liu's avatar
Zoe Liu committed
313 314 315 316 317 318 319
#if CONFIG_EXT_SKIP
  FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
  const int mode =
      xd->mi[0]->mbmi.skip_mode
          ? (NEAREST_NEARESTMV - NEAREST_NEARESTMV)
          : aom_read_symbol(r, ec_ctx->inter_compound_mode_cdf[ctx],
                            INTER_COMPOUND_MODES, ACCT_STR);
320
  if (xd->mi[0]->mbmi.skip_mode && r->allow_update_cdf)
Zoe Liu's avatar
Zoe Liu committed
321 322 323
    update_cdf(ec_ctx->inter_compound_mode_cdf[ctx], mode,
               INTER_COMPOUND_MODES);
#else
324 325 326
  const int mode =
      aom_read_symbol(r, xd->tile_ctx->inter_compound_mode_cdf[ctx],
                      INTER_COMPOUND_MODES, ACCT_STR);
Zoe Liu's avatar
Zoe Liu committed
327 328
#endif  // CONFIG_EXT_SKIP

329
  FRAME_COUNTS *counts = xd->counts;
330
  if (counts) ++counts->inter_compound_mode[ctx][mode];
331 332 333
  assert(is_inter_compound_mode(NEAREST_NEARESTMV + mode));
  return NEAREST_NEARESTMV + mode;
}
334 335

#if CONFIG_COMPOUND_SINGLEREF
336
static PREDICTION_MODE read_inter_singleref_comp_mode(MACROBLOCKD *xd,
337 338 339
                                                      aom_reader *r,
                                                      int16_t ctx) {
  const int mode =
340 341
      aom_read_symbol(r, xd->tile_ctx->inter_singleref_comp_mode_cdf[ctx],
                      INTER_SINGLEREF_COMP_MODES, ACCT_STR);
342 343 344 345 346 347 348 349
  FRAME_COUNTS *counts = xd->counts;

  if (counts) ++counts->inter_singleref_comp_mode[ctx][mode];

  assert(is_inter_singleref_comp_mode(SR_NEAREST_NEARMV + mode));
  return SR_NEAREST_NEARMV + mode;
}
#endif  // CONFIG_COMPOUND_SINGLEREF
350

351
static int read_segment_id(aom_reader *r, struct segmentation_probs *segp) {
Michael Bebenita's avatar
Michael Bebenita committed
352
  return aom_read_symbol(r, segp->tree_cdf, MAX_SEGMENTS, ACCT_STR);
Jingning Han's avatar
Jingning Han committed
353 354
}

Yaowu Xu's avatar
Yaowu Xu committed
355
static void read_tx_size_vartx(AV1_COMMON *cm, MACROBLOCKD *xd,
356
                               MB_MODE_INFO *mbmi, FRAME_COUNTS *counts,
357 358
                               TX_SIZE tx_size, int depth, int blk_row,
                               int blk_col, aom_reader *r) {
359 360 361 362
#if CONFIG_NEW_MULTISYMBOL
  FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
  (void)cm;
#endif
363
  int is_split = 0;
364 365
  const int tx_row = blk_row >> 1;
  const int tx_col = blk_col >> 1;
366 367
  const int max_blocks_high = max_block_high(xd, mbmi->sb_type, 0);
  const int max_blocks_wide = max_block_wide(xd, mbmi->sb_type, 0);
368 369
  int ctx = txfm_partition_context(xd->above_txfm_context + blk_col,
                                   xd->left_txfm_context + blk_row,
370
                                   mbmi->sb_type, tx_size);
clang-format's avatar
clang-format committed
371
  TX_SIZE(*const inter_tx_size)
372 373 374
  [MAX_MIB_SIZE] =
      (TX_SIZE(*)[MAX_MIB_SIZE]) & mbmi->inter_tx_size[tx_row][tx_col];
  if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return;
David Barker's avatar
David Barker committed
375
  assert(tx_size > TX_4X4);
376

Jingning Han's avatar
Jingning Han committed
377
  if (depth == MAX_VARTX_DEPTH) {
378 379
    int idx, idy;
    inter_tx_size[0][0] = tx_size;
380 381
    for (idy = 0; idy < AOMMAX(1, tx_size_high_unit[tx_size] / 2); ++idy)
      for (idx = 0; idx < AOMMAX(1, tx_size_wide_unit[tx_size] / 2); ++idx)
382 383
        inter_tx_size[idy][idx] = tx_size;
    mbmi->tx_size = tx_size;
384
    mbmi->min_tx_size = AOMMIN(mbmi->min_tx_size, get_min_tx_size(tx_size));
385 386
    txfm_partition_update(xd->above_txfm_context + blk_col,
                          xd->left_txfm_context + blk_row, tx_size, tx_size);
387 388 389
    return;
  }

390 391 392
#if CONFIG_NEW_MULTISYMBOL
  is_split = aom_read_symbol(r, ec_ctx->txfm_partition_cdf[ctx], 2, ACCT_STR);
#else
Michael Bebenita's avatar
Michael Bebenita committed
393
  is_split = aom_read(r, cm->fc->txfm_partition_prob[ctx], ACCT_STR);
394
#endif
395 396

  if (is_split) {
397 398
    const TX_SIZE sub_txs = sub_tx_size_map[tx_size];
    const int bsl = tx_size_wide_unit[sub_txs];
399
    int i;
400

401
    if (counts) ++counts->txfm_partition[ctx][1];
402

David Barker's avatar
David Barker committed
403
    if (sub_txs == TX_4X4) {
404
      int idx, idy;
405
      inter_tx_size[0][0] = sub_txs;
406 407
      for (idy = 0; idy < AOMMAX(1, tx_size_high_unit[tx_size] / 2); ++idy)
        for (idx = 0; idx < AOMMAX(1, tx_size_wide_unit[tx_size] / 2); ++idx)
408
          inter_tx_size[idy][idx] = inter_tx_size[0][0];
409
      mbmi->tx_size = sub_txs;
410
      mbmi->min_tx_size = get_min_tx_size(mbmi->tx_size);
411 412
      txfm_partition_update(xd->above_txfm_context + blk_col,
                            xd->left_txfm_context + blk_row, sub_txs, tx_size);
413 414 415 416 417
      return;
    }

    assert(bsl > 0);
    for (i = 0; i < 4; ++i) {
418 419 420
      int offsetr = blk_row + (i >> 1) * bsl;
      int offsetc = blk_col + (i & 0x01) * bsl;
      read_tx_size_vartx(cm, xd, mbmi, counts, sub_txs, depth + 1, offsetr,
421
                         offsetc, r);
422 423
    }
  } else {
424
    int idx, idy;
425
    inter_tx_size[0][0] = tx_size;
426 427
    for (idy = 0; idy < AOMMAX(1, tx_size_high_unit[tx_size] / 2); ++idy)
      for (idx = 0; idx < AOMMAX(1, tx_size_wide_unit[tx_size] / 2); ++idx)
428 429
        inter_tx_size[idy][idx] = tx_size;
    mbmi->tx_size = tx_size;
430
    mbmi->min_tx_size = AOMMIN(mbmi->min_tx_size, get_min_tx_size(tx_size));
431
    if (counts) ++counts->txfm_partition[ctx][0];
432 433
    txfm_partition_update(xd->above_txfm_context + blk_col,
                          xd->left_txfm_context + blk_row, tx_size, tx_size);
434 435 436
  }
}

Yaowu Xu's avatar
Yaowu Xu committed
437
static TX_SIZE read_selected_tx_size(AV1_COMMON *cm, MACROBLOCKD *xd,
438
                                     int32_t tx_size_cat, aom_reader *r) {
Jingning Han's avatar
Jingning Han committed
439
  const int ctx = get_tx_size_context(xd);
440 441 442
  FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
  (void)cm;

443 444
  const int depth = aom_read_symbol(r, ec_ctx->tx_size_cdf[tx_size_cat][ctx],
                                    tx_size_cat + 2, ACCT_STR);
445 446
  const TX_SIZE tx_size = depth_to_tx_size(depth);
  assert(!is_rect_tx(tx_size));
447
  return tx_size;
Jingning Han's avatar
Jingning Han committed
448 449
}

450 451 452 453
static TX_SIZE read_tx_size(AV1_COMMON *cm, MACROBLOCKD *xd, int is_inter,
                            int allow_select_inter, aom_reader *r) {
  const TX_MODE tx_mode = cm->tx_mode;
  const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
454
  if (xd->lossless[xd->mi[0]->mbmi.segment_id]) return TX_4X4;
455 456

  if (block_signals_txsize(bsize)) {
457 458 459
    if ((!is_inter || allow_select_inter) && tx_mode == TX_MODE_SELECT) {
      const int32_t tx_size_cat = is_inter ? inter_tx_size_cat_lookup[bsize]
                                           : intra_tx_size_cat_lookup[bsize];
460
      const TX_SIZE coded_tx_size =
461
          read_selected_tx_size(cm, xd, tx_size_cat, r);
462 463
      if (coded_tx_size > max_txsize_lookup[bsize]) {
        assert(coded_tx_size == max_txsize_lookup[bsize] + 1);
Yue Chen's avatar
Yue Chen committed
464
#if CONFIG_RECT_TX_EXT
465
        if (is_quarter_tx_allowed(xd, &xd->mi[0]->mbmi, is_inter)) {
Yue Chen's avatar
Yue Chen committed
466
          int quarter_tx;
467

Yue Chen's avatar
Yue Chen committed
468
          if (quarter_txsize_lookup[bsize] != max_txsize_lookup[bsize]) {
469 470 471 472
#if CONFIG_NEW_MULTISYMBOL
            quarter_tx =
                aom_read_symbol(r, cm->fc->quarter_tx_size_cdf, 2, ACCT_STR);
#else
Yue Chen's avatar
Yue Chen committed
473 474 475
            quarter_tx = aom_read(r, cm->fc->quarter_tx_size_prob, ACCT_STR);
            FRAME_COUNTS *counts = xd->counts;
            if (counts) ++counts->quarter_tx_size[quarter_tx];
476
#endif
Yue Chen's avatar
Yue Chen committed
477 478 479
          } else {
            quarter_tx = 1;
          }
480 481 482
          return quarter_tx ? quarter_txsize_lookup[bsize]
                            : max_txsize_rect_lookup[bsize];
        }
Yue Chen's avatar
Yue Chen committed
483
#endif  // CONFIG_RECT_TX_EXT
484

485 486 487
        return max_txsize_rect_lookup[bsize];
      }
      return coded_tx_size;
488
    } else {
489
      return tx_size_from_tx_mode(bsize, tx_mode, is_inter);
490 491
    }
  } else {
Debargha Mukherjee's avatar
Debargha Mukherjee committed
492
    assert(IMPLIES(tx_mode == ONLY_4X4, bsize == BLOCK_4X4));
493 494
    return max_txsize_rect_lookup[bsize];
  }
Jingning Han's avatar
Jingning Han committed
495 496
}

Yaowu Xu's avatar
Yaowu Xu committed
497
static int dec_get_segment_id(const AV1_COMMON *cm, const uint8_t *segment_ids,
Jingning Han's avatar
Jingning Han committed
498 499 500 501 502
                              int mi_offset, int x_mis, int y_mis) {
  int x, y, segment_id = INT_MAX;

  for (y = 0; y < y_mis; y++)
    for (x = 0; x < x_mis; x++)
503
      segment_id =
Yaowu Xu's avatar
Yaowu Xu committed
504
          AOMMIN(segment_id, segment_ids[mi_offset + y * cm->mi_cols + x]);
Jingning Han's avatar
Jingning Han committed
505 506 507 508 509

  assert(segment_id >= 0 && segment_id < MAX_SEGMENTS);
  return segment_id;
}

Yaowu Xu's avatar
Yaowu Xu committed
510
static void set_segment_id(AV1_COMMON *cm, int mi_offset, int x_mis, int y_mis,
511
                           int segment_id) {
Jingning Han's avatar
Jingning Han committed
512 513 514 515 516 517 518 519 520
  int x, y;

  assert(segment_id >= 0 && segment_id < MAX_SEGMENTS);

  for (y = 0; y < y_mis; y++)
    for (x = 0; x < x_mis; x++)
      cm->current_frame_seg_map[mi_offset + y * cm->mi_cols + x] = segment_id;
}

Yaowu Xu's avatar
Yaowu Xu committed
521
static int read_intra_segment_id(AV1_COMMON *const cm, MACROBLOCKD *const xd,
522
                                 int mi_offset, int x_mis, int y_mis,
Yaowu Xu's avatar
Yaowu Xu committed
523
                                 aom_reader *r) {
Jingning Han's avatar
Jingning Han committed
524
  struct segmentation *const seg = &cm->seg;
525
  FRAME_COUNTS *counts = xd->counts;
526 527
  FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
  struct segmentation_probs *const segp = &ec_ctx->seg;
Jingning Han's avatar
Jingning Han committed
528 529
  int segment_id;

530
  if (!seg->enabled) return 0;  // Default for disabled segmentation
Jingning Han's avatar
Jingning Han committed
531

532
  assert(seg->update_map && !seg->temporal_update);
Jingning Han's avatar
Jingning Han committed
533

534
  segment_id = read_segment_id(r, segp);
535
  if (counts) ++counts->seg.tree_total[segment_id];
Jingning Han's avatar
Jingning Han committed
536 537 538 539
  set_segment_id(cm, mi_offset, x_mis, y_mis, segment_id);
  return segment_id;
}

Yaowu Xu's avatar
Yaowu Xu committed
540
static void copy_segment_id(const AV1_COMMON *cm,
541 542 543
                            const uint8_t *last_segment_ids,
                            uint8_t *current_segment_ids, int mi_offset,
                            int x_mis, int y_mis) {
544 545 546 547
  int x, y;

  for (y = 0; y < y_mis; y++)
    for (x = 0; x < x_mis; x++)
548 549 550
      current_segment_ids[mi_offset + y * cm->mi_cols + x] =
          last_segment_ids ? last_segment_ids[mi_offset + y * cm->mi_cols + x]
                           : 0;
551 552
}

Yaowu Xu's avatar
Yaowu Xu committed
553 554
static int read_inter_segment_id(AV1_COMMON *const cm, MACROBLOCKD *const xd,
                                 int mi_row, int mi_col, aom_reader *r) {
Jingning Han's avatar
Jingning Han committed
555
  struct segmentation *const seg = &cm->seg;
556
  FRAME_COUNTS *counts = xd->counts;
557 558 559
  FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
  struct segmentation_probs *const segp = &ec_ctx->seg;

Jingning Han's avatar
Jingning Han committed
560 561 562
  MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
  int predicted_segment_id, segment_id;
  const int mi_offset = mi_row * cm->mi_cols + mi_col;
563 564
  const int bw = mi_size_wide[mbmi->sb_type];
  const int bh = mi_size_high[mbmi->sb_type];
Jingning Han's avatar
Jingning Han committed
565 566

  // TODO(slavarnway): move x_mis, y_mis into xd ?????
Yaowu Xu's avatar
Yaowu Xu committed
567 568
  const int x_mis = AOMMIN(cm->mi_cols - mi_col, bw);
  const int y_mis = AOMMIN(cm->mi_rows - mi_row, bh);
Jingning Han's avatar
Jingning Han committed
569

570
  if (!seg->enabled) return 0;  // Default for disabled segmentation
Jingning Han's avatar
Jingning Han committed
571

572 573 574 575
  predicted_segment_id = cm->last_frame_seg_map
                             ? dec_get_segment_id(cm, cm->last_frame_seg_map,
                                                  mi_offset, x_mis, y_mis)
                             : 0;
Jingning Han's avatar
Jingning Han committed
576 577 578 579 580 581 582 583

  if (!seg->update_map) {
    copy_segment_id(cm, cm->last_frame_seg_map, cm->current_frame_seg_map,
                    mi_offset, x_mis, y_mis);
    return predicted_segment_id;
  }

  if (seg->temporal_update) {
Yaowu Xu's avatar
Yaowu Xu committed
584
    const int ctx = av1_get_pred_context_seg_id(xd);
585 586 587 588
#if CONFIG_NEW_MULTISYMBOL
    aom_cdf_prob *pred_cdf = segp->pred_cdf[ctx];
    mbmi->seg_id_predicted = aom_read_symbol(r, pred_cdf, 2, ACCT_STR);
#else
Yaowu Xu's avatar
Yaowu Xu committed
589
    const aom_prob pred_prob = segp->pred_probs[ctx];
Michael Bebenita's avatar
Michael Bebenita committed
590
    mbmi->seg_id_predicted = aom_read(r, pred_prob, ACCT_STR);
591
#endif
592
    if (counts) ++counts->seg.pred[ctx][mbmi->seg_id_predicted];
593 594 595 596
    if (mbmi->seg_id_predicted) {
      segment_id = predicted_segment_id;
    } else {
      segment_id = read_segment_id(r, segp);
597
      if (counts) ++counts->seg.tree_mispred[segment_id];
598
    }
Jingning Han's avatar
Jingning Han committed
599
  } else {
600
    segment_id = read_segment_id(r, segp);
601
    if (counts) ++counts->seg.tree_total[segment_id];
Jingning Han's avatar
Jingning Han committed
602 603 604 605 606
  }
  set_segment_id(cm, mi_offset, x_mis, y_mis, segment_id);
  return segment_id;
}

Zoe Liu's avatar
Zoe Liu committed
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633
#if CONFIG_EXT_SKIP
static int read_skip_mode(AV1_COMMON *cm, const MACROBLOCKD *xd, int segment_id,
                          aom_reader *r) {
  if (!cm->is_skip_mode_allowed) return 0;

  if (segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)) {
    // TODO(zoeliu): To revisit the handling of this scenario.
    return 0;
  } else {
    const int ctx = av1_get_skip_mode_context(xd);
#if CONFIG_NEW_MULTISYMBOL
    FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
    const int skip_mode =
        aom_read_symbol(r, ec_ctx->skip_mode_cdfs[ctx], 2, ACCT_STR);
#else
    const int skip_mode = aom_read(r, cm->fc->skip_mode_probs[ctx], ACCT_STR);
#endif  // CONFIG_NEW_MULTISYMBOL
    FRAME_COUNTS *counts = xd->counts;
    if (counts) ++counts->skip_mode[ctx][skip_mode];

    // TODO(zoeliu): To handle:
    //               if (!is_comp_ref_allowed(xd->mi[0]->mbmi.sb_type))
    return skip_mode;
  }
}
#endif  // CONFIG_EXT_SKIP

Yaowu Xu's avatar
Yaowu Xu committed
634 635
static int read_skip(AV1_COMMON *cm, const MACROBLOCKD *xd, int segment_id,
                     aom_reader *r) {
Jingning Han's avatar
Jingning Han committed
636 637 638
  if (segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)) {
    return 1;
  } else {
Yaowu Xu's avatar
Yaowu Xu committed
639
    const int ctx = av1_get_skip_context(xd);
640 641 642 643
#if CONFIG_NEW_MULTISYMBOL
    FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
    const int skip = aom_read_symbol(r, ec_ctx->skip_cdfs[ctx], 2, ACCT_STR);
#else
Michael Bebenita's avatar
Michael Bebenita committed
644
    const int skip = aom_read(r, cm->fc->skip_probs[ctx], ACCT_STR);
645
#endif
Jingning Han's avatar
Jingning Han committed
646
    FRAME_COUNTS *counts = xd->counts;
647
    if (counts) ++counts->skip[ctx][skip];
Jingning Han's avatar
Jingning Han committed
648 649 650 651
    return skip;
  }
}

652
#if CONFIG_PALETTE_DELTA_ENCODING
653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669
// Merge the sorted list of cached colors(cached_colors[0...n_cached_colors-1])
// and the sorted list of transmitted colors(colors[n_cached_colors...n-1]) into
// one single sorted list(colors[...]).
static void merge_colors(uint16_t *colors, uint16_t *cached_colors,
                         int n_colors, int n_cached_colors) {
  if (n_cached_colors == 0) return;
  int cache_idx = 0, trans_idx = n_cached_colors;
  for (int i = 0; i < n_colors; ++i) {
    if (cache_idx < n_cached_colors &&
        (trans_idx >= n_colors ||
         cached_colors[cache_idx] <= colors[trans_idx])) {
      colors[i] = cached_colors[cache_idx++];
    } else {
      assert(trans_idx < n_colors);
      colors[i] = colors[trans_idx++];
    }
  }
670 671 672 673 674
}

static void read_palette_colors_y(MACROBLOCKD *const xd, int bit_depth,
                                  PALETTE_MODE_INFO *const pmi, aom_reader *r) {
  uint16_t color_cache[2 * PALETTE_MAX_SIZE];
675
  uint16_t cached_colors[PALETTE_MAX_SIZE];
676
  const int n_cache = av1_get_palette_cache(xd, 0, color_cache);
677 678 679
  const int n = pmi->palette_size[0];
  int idx = 0;
  for (int i = 0; i < n_cache && idx < n; ++i)
680
    if (aom_read_bit(r, ACCT_STR)) cached_colors[idx++] = color_cache[i];
681
  if (idx < n) {
682
    const int n_cached_colors = idx;
683 684 685 686 687 688
    pmi->palette_colors[idx++] = aom_read_literal(r, bit_depth, ACCT_STR);
    if (idx < n) {
      const int min_bits = bit_depth - 3;
      int bits = min_bits + aom_read_literal(r, 2, ACCT_STR);
      int range = (1 << bit_depth) - pmi->palette_colors[idx - 1] - 1;
      for (; idx < n; ++idx) {
689
        assert(range >= 0);
690
        const int delta = aom_read_literal(r, bits, ACCT_STR) + 1;
691 692 693
        pmi->palette_colors[idx] = clamp(pmi->palette_colors[idx - 1] + delta,
                                         0, (1 << bit_depth) - 1);
        range -= (pmi->palette_colors[idx] - pmi->palette_colors[idx - 1]);
694 695 696
        bits = AOMMIN(bits, av1_ceil_log2(range));
      }
    }
697 698 699
    merge_colors(pmi->palette_colors, cached_colors, n, n_cached_colors);
  } else {
    memcpy(pmi->palette_colors, cached_colors, n * sizeof(cached_colors[0]));
700 701 702 703 704 705 706 707 708
  }
}

static void read_palette_colors_uv(MACROBLOCKD *const xd, int bit_depth,
                                   PALETTE_MODE_INFO *const pmi,
                                   aom_reader *r) {
  const int n = pmi->palette_size[1];
  // U channel colors.
  uint16_t color_cache[2 * PALETTE_MAX_SIZE];
709
  uint16_t cached_colors[PALETTE_MAX_SIZE];
710
  const int n_cache = av1_get_palette_cache(xd, 1, color_cache);
711 712 713 714 715 716
  int idx = 0;
  for (int i = 0; i < n_cache && idx < n; ++i)
    if (aom_read_bit(r, ACCT_STR)) cached_colors[idx++] = color_cache[i];
  if (idx < n) {
    const int n_cached_colors = idx;
    idx += PALETTE_MAX_SIZE;
717 718 719 720 721 722
    pmi->palette_colors[idx++] = aom_read_literal(r, bit_depth, ACCT_STR);
    if (idx < PALETTE_MAX_SIZE + n) {
      const int min_bits = bit_depth - 3;
      int bits = min_bits + aom_read_literal(r, 2, ACCT_STR);
      int range = (1 << bit_depth) - pmi->palette_colors[idx - 1];
      for (; idx < PALETTE_MAX_SIZE + n; ++idx) {
723
        assert(range >= 0);
724
        const int delta = aom_read_literal(r, bits, ACCT_STR);
725 726 727
        pmi->palette_colors[idx] = clamp(pmi->palette_colors[idx - 1] + delta,
                                         0, (1 << bit_depth) - 1);
        range -= (pmi->palette_colors[idx] - pmi->palette_colors[idx - 1]);
728 729 730
        bits = AOMMIN(bits, av1_ceil_log2(range));
      }
    }
731 732 733 734 735
    merge_colors(pmi->palette_colors + PALETTE_MAX_SIZE, cached_colors, n,
                 n_cached_colors);
  } else {
    memcpy(pmi->palette_colors + PALETTE_MAX_SIZE, cached_colors,
           n * sizeof(cached_colors[0]));
736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761
  }

  // V channel colors.
  if (aom_read_bit(r, ACCT_STR)) {  // Delta encoding.
    const int min_bits_v = bit_depth - 4;
    const int max_val = 1 << bit_depth;
    int bits = min_bits_v + aom_read_literal(r, 2, ACCT_STR);
    pmi->palette_colors[2 * PALETTE_MAX_SIZE] =
        aom_read_literal(r, bit_depth, ACCT_STR);
    for (int i = 1; i < n; ++i) {
      int delta = aom_read_literal(r, bits, ACCT_STR);
      if (delta && aom_read_bit(r, ACCT_STR)) delta = -delta;
      int val = (int)pmi->palette_colors[2 * PALETTE_MAX_SIZE + i - 1] + delta;
      if (val < 0) val += max_val;
      if (val >= max_val) val -= max_val;
      pmi->palette_colors[2 * PALETTE_MAX_SIZE + i] = val;
    }
  } else {
    for (int i = 0; i < n; ++i) {
      pmi->palette_colors[2 * PALETTE_MAX_SIZE + i] =
          aom_read_literal(r, bit_depth, ACCT_STR);
    }
  }
}
#endif  // CONFIG_PALETTE_DELTA_ENCODING

Yaowu Xu's avatar
Yaowu Xu committed
762 763
static void read_palette_mode_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
                                   aom_reader *r) {
hui su's avatar
hui su committed
764 765
  MODE_INFO *const mi = xd->mi[0];
  MB_MODE_INFO *const mbmi = &mi->mbmi;
766
  const MODE_INFO *const above_mi = xd->above_mi;
767
  const MODE_INFO *const left_mi = xd->left_mi;
hui su's avatar
hui su committed
768
  const BLOCK_SIZE bsize = mbmi->sb_type;
769 770
  PALETTE_MODE_INFO *const pmi = &mbmi->palette_mode_info;

771 772
  assert(bsize >= BLOCK_8X8 && bsize <= BLOCK_LARGEST);
  const int block_palette_idx = bsize - BLOCK_8X8;
773
  int modev;
774

775
  if (mbmi->mode == DC_PRED) {
776
    int palette_y_mode_ctx = 0;
777
    if (above_mi) {
778 779
      palette_y_mode_ctx +=
          (above_mi->mbmi.palette_mode_info.palette_size[0] > 0);
780 781
    }
    if (left_mi) {
782 783
      palette_y_mode_ctx +=
          (left_mi->mbmi.palette_mode_info.palette_size[0] > 0);
784
    }
785 786 787 788 789 790 791 792 793 794 795 796
#if CONFIG_NEW_MULTISYMBOL
    modev = aom_read_symbol(
        r,
        xd->tile_ctx->palette_y_mode_cdf[block_palette_idx][palette_y_mode_ctx],
        2, ACCT_STR);
#else
    modev = aom_read(
        r,
        av1_default_palette_y_mode_prob[block_palette_idx][palette_y_mode_ctx],
        ACCT_STR);
#endif
    if (modev) {
797
      pmi->palette_size[0] =
798
          aom_read_symbol(r,
799
                          xd->tile_ctx->palette_y_size_cdf[block_palette_idx],
800 801
                          PALETTE_SIZES, ACCT_STR) +
          2;
hui su's avatar
hui su committed
802
#if CONFIG_PALETTE_DELTA_ENCODING
803
      read_palette_colors_y(xd, cm->bit_depth, pmi, r);
hui su's avatar
hui su committed
804
#else
805
      for (int i = 0; i < pmi->palette_size[0]; ++i)
Michael Bebenita's avatar
Michael Bebenita committed
806
        pmi->palette_colors[i] = aom_read_literal(r, cm->bit_depth, ACCT_STR);
hui su's avatar
hui su committed
807
#endif  // CONFIG_PALETTE_DELTA_ENCODING
808 809
    }
  }
Luc Trudeau's avatar
Luc Trudeau committed
810
  if (mbmi->uv_mode == UV_DC_PRED) {
811
    const int palette_uv_mode_ctx = (pmi->palette_size[0] > 0);
812 813 814 815 816 817 818 819
#if CONFIG_NEW_MULTISYMBOL
    modev = aom_read_symbol(
        r, xd->tile_ctx->palette_uv_mode_cdf[palette_uv_mode_ctx], 2, ACCT_STR);
#else
    modev = aom_read(r, av1_default_palette_uv_mode_prob[palette_uv_mode_ctx],
                     ACCT_STR);
#endif
    if (modev) {
820
      pmi->palette_size[1] =
821
          aom_read_symbol(r,
822
                          xd->tile_ctx->palette_uv_size_cdf[block_palette_idx],
823 824
                          PALETTE_SIZES, ACCT_STR) +
          2;
hui su's avatar
hui su committed
825
#if CONFIG_PALETTE_DELTA_ENCODING
826
      read_palette_colors_uv(xd, cm->bit_depth, pmi, r);
hui su's avatar
hui su committed
827
#else
828
      for (int i = 0; i < pmi->palette_size[1]; ++i) {
829
        pmi->palette_colors[PALETTE_MAX_SIZE + i] =
Michael Bebenita's avatar
Michael Bebenita committed
830
            aom_read_literal(r, cm->bit_depth, ACCT_STR);
831
        pmi->palette_colors[2 * PALETTE_MAX_SIZE + i] =
Michael Bebenita's avatar
Michael Bebenita committed
832
            aom_read_literal(r, cm->bit_depth, ACCT_STR);
833
      }
hui su's avatar
hui su committed
834
#endif  // CONFIG_PALETTE_DELTA_ENCODING
835
    }
hui su's avatar
hui su committed
836 837 838
  }
}

839 840
#if CONFIG_FILTER_INTRA
<