1 /*
2 * Copyright (c) 2001-2016, Alliance for Open Media. All rights reserved
3 *
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10 */
11
12 #include "av1/common/pvq_state.h"
13 #include "av1/common/odintrin.h"
14
od_adapt_ctx_reset(od_adapt_ctx * adapt,int is_keyframe)15 void od_adapt_ctx_reset(od_adapt_ctx *adapt, int is_keyframe) {
16 int pli;
17 od_adapt_pvq_ctx_reset(&adapt->pvq, is_keyframe);
18 OD_CDFS_INIT_Q15(adapt->skip_cdf);
19 for (pli = 0; pli < OD_NPLANES_MAX; pli++) {
20 int i;
21 OD_CDFS_INIT_DYNAMIC(adapt->model_dc[pli].cdf);
22 for (i = 0; i < OD_TXSIZES; i++) {
23 int j;
24 adapt->ex_g[pli][i] = 8;
25 for (j = 0; j < 3; j++) {
26 adapt->ex_dc[pli][i][j] = pli > 0 ? 8 : 32768;
27 }
28 }
29 }
30 }
31
od_init_skipped_coeffs(int16_t * d,int16_t * pred,int is_keyframe,int bo,int n,int w)32 void od_init_skipped_coeffs(int16_t *d, int16_t *pred, int is_keyframe, int bo,
33 int n, int w) {
34 int i;
35 int j;
36 if (is_keyframe) {
37 for (i = 0; i < n; i++) {
38 for (j = 0; j < n; j++) {
39 /* skip DC */
40 if (i || j) d[bo + i * w + j] = 0;
41 }
42 }
43 } else {
44 for (i = 0; i < n; i++) {
45 for (j = 0; j < n; j++) {
46 d[bo + i * w + j] = pred[i * n + j];
47 }
48 }
49 }
50 }
51