blob: 197b9b3a82be79977f8e3b912bb10a2274d1abf7 [file] [log] [blame]
Yushin Cho77bba8d2016-11-04 16:36:56 -07001/*
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
15void od_adapt_ctx_reset(od_adapt_ctx *adapt, int is_keyframe) {
Yushin Cho77bba8d2016-11-04 16:36:56 -070016 int pli;
17 od_adapt_pvq_ctx_reset(&adapt->pvq, is_keyframe);
Yushin Cho00779272017-02-21 10:38:16 -080018 OD_CDFS_INIT_Q15(adapt->skip_cdf);
Yushin Cho77bba8d2016-11-04 16:36:56 -070019 for (pli = 0; pli < OD_NPLANES_MAX; pli++) {
Yushin Cho00779272017-02-21 10:38:16 -080020 int i;
Timothy B. Terriberry5b4a7262017-04-05 16:18:03 -070021 OD_CDFS_INIT_DYNAMIC(adapt->model_dc[pli].cdf);
Yushin Cho48f84db2016-11-07 21:20:17 -080022 for (i = 0; i < OD_TXSIZES; i++) {
Yushin Cho77bba8d2016-11-04 16:36:56 -070023 int j;
Luc Trudeau98bc74c2017-02-24 15:17:39 -050024 adapt->ex_g[pli][i] = 8;
Yushin Cho77bba8d2016-11-04 16:36:56 -070025 for (j = 0; j < 3; j++) {
26 adapt->ex_dc[pli][i][j] = pli > 0 ? 8 : 32768;
27 }
28 }
29 }
30}
31
32void 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}