AOMedia AV1 Codec: av1/encoder/pickrst.h Source File

| AOMedia AV1 Codec

pickrst.h
1/*
2 * Copyright (c) 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#ifndef AOM_AV1_ENCODER_PICKRST_H_
12#define AOM_AV1_ENCODER_PICKRST_H_
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#include "av1/encoder/encoder.h"
19
20struct yv12_buffer_config;
21struct AV1_COMP;
22
23static const uint8_t g_shuffle_stats_data[16] = {
24 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8,
25};
26
27static const uint8_t g_shuffle_stats_highbd_data[32] = {
28 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9,
29 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9,
30};
31
32static INLINE uint8_t find_average(const uint8_t *src, int h_start, int h_end,
33 int v_start, int v_end, int stride) {
34 uint64_t sum = 0;
35 for (int i = v_start; i < v_end; i++) {
36 for (int j = h_start; j < h_end; j++) {
37 sum += src[i * stride + j];
38 }
39 }
40 uint64_t avg = sum / ((v_end - v_start) * (h_end - h_start));
41 return (uint8_t)avg;
42}
43
44#if CONFIG_AV1_HIGHBITDEPTH
45static INLINE uint16_t find_average_highbd(const uint16_t *src, int h_start,
46 int h_end, int v_start, int v_end,
47 int stride) {
48 uint64_t sum = 0;
49 for (int i = v_start; i < v_end; i++) {
50 for (int j = h_start; j < h_end; j++) {
51 sum += src[i * stride + j];
52 }
53 }
54 uint64_t avg = sum / ((v_end - v_start) * (h_end - h_start));
55 return (uint16_t)avg;
56}
57#endif
58
92 void av1_pick_filter_restoration(const YV12_BUFFER_CONFIG *sd, AV1_COMP *cpi);
93
94#ifdef __cplusplus
95} // extern "C"
96#endif
97
98#endif // AOM_AV1_ENCODER_PICKRST_H_
encoder.h
Declares top-level encoder structures and functions.
av1_pick_filter_restoration
void av1_pick_filter_restoration(const YV12_BUFFER_CONFIG *sd, AV1_COMP *cpi)
Algorithm for AV1 loop restoration search and estimation.
AV1_COMP
Top level encoder structure.
Definition encoder.h:2815
yv12_buffer_config
YV12 frame buffer data structure.
Definition yv12config.h:44