Yushin Cho | 77bba8d | 2016-11-04 16:36:56 -0700 | [diff] [blame] | 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 | |
| 15 | void od_adapt_ctx_reset(od_adapt_ctx *adapt, int is_keyframe) { |
Yushin Cho | 77bba8d | 2016-11-04 16:36:56 -0700 | [diff] [blame] | 16 | int pli; |
| 17 | od_adapt_pvq_ctx_reset(&adapt->pvq, is_keyframe); |
Yushin Cho | 0077927 | 2017-02-21 10:38:16 -0800 | [diff] [blame] | 18 | OD_CDFS_INIT_Q15(adapt->skip_cdf); |
Yushin Cho | 77bba8d | 2016-11-04 16:36:56 -0700 | [diff] [blame] | 19 | for (pli = 0; pli < OD_NPLANES_MAX; pli++) { |
Yushin Cho | 0077927 | 2017-02-21 10:38:16 -0800 | [diff] [blame] | 20 | int i; |
Timothy B. Terriberry | 5b4a726 | 2017-04-05 16:18:03 -0700 | [diff] [blame] | 21 | OD_CDFS_INIT_DYNAMIC(adapt->model_dc[pli].cdf); |
Yushin Cho | 48f84db | 2016-11-07 21:20:17 -0800 | [diff] [blame] | 22 | for (i = 0; i < OD_TXSIZES; i++) { |
Yushin Cho | 77bba8d | 2016-11-04 16:36:56 -0700 | [diff] [blame] | 23 | int j; |
Luc Trudeau | 98bc74c | 2017-02-24 15:17:39 -0500 | [diff] [blame] | 24 | adapt->ex_g[pli][i] = 8; |
Yushin Cho | 77bba8d | 2016-11-04 16:36:56 -0700 | [diff] [blame] | 25 | for (j = 0; j < 3; j++) { |
| 26 | adapt->ex_dc[pli][i][j] = pli > 0 ? 8 : 32768; |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |
| 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 | } |