media/libvpx/vp9/common/vp9_scan.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license
michael@0 5 * that can be found in the LICENSE file in the root of the source
michael@0 6 * tree. An additional intellectual property rights grant can be found
michael@0 7 * in the file PATENTS. All contributing project authors may
michael@0 8 * be found in the AUTHORS file in the root of the source tree.
michael@0 9 */
michael@0 10
michael@0 11 #ifndef VP9_COMMON_VP9_SCAN_H_
michael@0 12 #define VP9_COMMON_VP9_SCAN_H_
michael@0 13
michael@0 14 #include "vpx/vpx_integer.h"
michael@0 15 #include "vpx_ports/mem.h"
michael@0 16
michael@0 17 #include "vp9/common/vp9_enums.h"
michael@0 18
michael@0 19 #define MAX_NEIGHBORS 2
michael@0 20
michael@0 21 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_4x4[16]);
michael@0 22 extern DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_4x4[16]);
michael@0 23 extern DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_4x4[16]);
michael@0 24
michael@0 25 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_8x8[64]);
michael@0 26 extern DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_8x8[64]);
michael@0 27 extern DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_8x8[64]);
michael@0 28
michael@0 29 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_16x16[256]);
michael@0 30 extern DECLARE_ALIGNED(16, const int16_t, vp9_col_scan_16x16[256]);
michael@0 31 extern DECLARE_ALIGNED(16, const int16_t, vp9_row_scan_16x16[256]);
michael@0 32
michael@0 33 extern DECLARE_ALIGNED(16, const int16_t, vp9_default_scan_32x32[1024]);
michael@0 34
michael@0 35 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_4x4[16]);
michael@0 36 extern DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_4x4[16]);
michael@0 37 extern DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_4x4[16]);
michael@0 38
michael@0 39 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_8x8[64]);
michael@0 40 extern DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_8x8[64]);
michael@0 41 extern DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_8x8[64]);
michael@0 42
michael@0 43 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_16x16[256]);
michael@0 44 extern DECLARE_ALIGNED(16, int16_t, vp9_col_iscan_16x16[256]);
michael@0 45 extern DECLARE_ALIGNED(16, int16_t, vp9_row_iscan_16x16[256]);
michael@0 46
michael@0 47 extern DECLARE_ALIGNED(16, int16_t, vp9_default_iscan_32x32[1024]);
michael@0 48
michael@0 49 extern DECLARE_ALIGNED(16, int16_t,
michael@0 50 vp9_default_scan_4x4_neighbors[17 * MAX_NEIGHBORS]);
michael@0 51 extern DECLARE_ALIGNED(16, int16_t,
michael@0 52 vp9_col_scan_4x4_neighbors[17 * MAX_NEIGHBORS]);
michael@0 53 extern DECLARE_ALIGNED(16, int16_t,
michael@0 54 vp9_row_scan_4x4_neighbors[17 * MAX_NEIGHBORS]);
michael@0 55 extern DECLARE_ALIGNED(16, int16_t,
michael@0 56 vp9_col_scan_8x8_neighbors[65 * MAX_NEIGHBORS]);
michael@0 57 extern DECLARE_ALIGNED(16, int16_t,
michael@0 58 vp9_row_scan_8x8_neighbors[65 * MAX_NEIGHBORS]);
michael@0 59 extern DECLARE_ALIGNED(16, int16_t,
michael@0 60 vp9_default_scan_8x8_neighbors[65 * MAX_NEIGHBORS]);
michael@0 61 extern DECLARE_ALIGNED(16, int16_t,
michael@0 62 vp9_col_scan_16x16_neighbors[257 * MAX_NEIGHBORS]);
michael@0 63 extern DECLARE_ALIGNED(16, int16_t,
michael@0 64 vp9_row_scan_16x16_neighbors[257 * MAX_NEIGHBORS]);
michael@0 65 extern DECLARE_ALIGNED(16, int16_t,
michael@0 66 vp9_default_scan_16x16_neighbors[257 * MAX_NEIGHBORS]);
michael@0 67 extern DECLARE_ALIGNED(16, int16_t,
michael@0 68 vp9_default_scan_32x32_neighbors[1025 * MAX_NEIGHBORS]);
michael@0 69
michael@0 70
michael@0 71 void vp9_init_neighbors();
michael@0 72
michael@0 73 static INLINE const int16_t* get_scan_4x4(TX_TYPE tx_type) {
michael@0 74 switch (tx_type) {
michael@0 75 case ADST_DCT:
michael@0 76 return vp9_row_scan_4x4;
michael@0 77 case DCT_ADST:
michael@0 78 return vp9_col_scan_4x4;
michael@0 79 default:
michael@0 80 return vp9_default_scan_4x4;
michael@0 81 }
michael@0 82 }
michael@0 83
michael@0 84 static INLINE void get_scan_nb_4x4(TX_TYPE tx_type,
michael@0 85 const int16_t **scan, const int16_t **nb) {
michael@0 86 switch (tx_type) {
michael@0 87 case ADST_DCT:
michael@0 88 *scan = vp9_row_scan_4x4;
michael@0 89 *nb = vp9_row_scan_4x4_neighbors;
michael@0 90 break;
michael@0 91 case DCT_ADST:
michael@0 92 *scan = vp9_col_scan_4x4;
michael@0 93 *nb = vp9_col_scan_4x4_neighbors;
michael@0 94 break;
michael@0 95 default:
michael@0 96 *scan = vp9_default_scan_4x4;
michael@0 97 *nb = vp9_default_scan_4x4_neighbors;
michael@0 98 break;
michael@0 99 }
michael@0 100 }
michael@0 101
michael@0 102 static INLINE const int16_t* get_iscan_4x4(TX_TYPE tx_type) {
michael@0 103 switch (tx_type) {
michael@0 104 case ADST_DCT:
michael@0 105 return vp9_row_iscan_4x4;
michael@0 106 case DCT_ADST:
michael@0 107 return vp9_col_iscan_4x4;
michael@0 108 default:
michael@0 109 return vp9_default_iscan_4x4;
michael@0 110 }
michael@0 111 }
michael@0 112
michael@0 113 static INLINE const int16_t* get_scan_8x8(TX_TYPE tx_type) {
michael@0 114 switch (tx_type) {
michael@0 115 case ADST_DCT:
michael@0 116 return vp9_row_scan_8x8;
michael@0 117 case DCT_ADST:
michael@0 118 return vp9_col_scan_8x8;
michael@0 119 default:
michael@0 120 return vp9_default_scan_8x8;
michael@0 121 }
michael@0 122 }
michael@0 123
michael@0 124 static INLINE void get_scan_nb_8x8(TX_TYPE tx_type,
michael@0 125 const int16_t **scan, const int16_t **nb) {
michael@0 126 switch (tx_type) {
michael@0 127 case ADST_DCT:
michael@0 128 *scan = vp9_row_scan_8x8;
michael@0 129 *nb = vp9_row_scan_8x8_neighbors;
michael@0 130 break;
michael@0 131 case DCT_ADST:
michael@0 132 *scan = vp9_col_scan_8x8;
michael@0 133 *nb = vp9_col_scan_8x8_neighbors;
michael@0 134 break;
michael@0 135 default:
michael@0 136 *scan = vp9_default_scan_8x8;
michael@0 137 *nb = vp9_default_scan_8x8_neighbors;
michael@0 138 break;
michael@0 139 }
michael@0 140 }
michael@0 141
michael@0 142 static INLINE const int16_t* get_iscan_8x8(TX_TYPE tx_type) {
michael@0 143 switch (tx_type) {
michael@0 144 case ADST_DCT:
michael@0 145 return vp9_row_iscan_8x8;
michael@0 146 case DCT_ADST:
michael@0 147 return vp9_col_iscan_8x8;
michael@0 148 default:
michael@0 149 return vp9_default_iscan_8x8;
michael@0 150 }
michael@0 151 }
michael@0 152
michael@0 153 static INLINE const int16_t* get_scan_16x16(TX_TYPE tx_type) {
michael@0 154 switch (tx_type) {
michael@0 155 case ADST_DCT:
michael@0 156 return vp9_row_scan_16x16;
michael@0 157 case DCT_ADST:
michael@0 158 return vp9_col_scan_16x16;
michael@0 159 default:
michael@0 160 return vp9_default_scan_16x16;
michael@0 161 }
michael@0 162 }
michael@0 163
michael@0 164 static INLINE void get_scan_nb_16x16(TX_TYPE tx_type,
michael@0 165 const int16_t **scan, const int16_t **nb) {
michael@0 166 switch (tx_type) {
michael@0 167 case ADST_DCT:
michael@0 168 *scan = vp9_row_scan_16x16;
michael@0 169 *nb = vp9_row_scan_16x16_neighbors;
michael@0 170 break;
michael@0 171 case DCT_ADST:
michael@0 172 *scan = vp9_col_scan_16x16;
michael@0 173 *nb = vp9_col_scan_16x16_neighbors;
michael@0 174 break;
michael@0 175 default:
michael@0 176 *scan = vp9_default_scan_16x16;
michael@0 177 *nb = vp9_default_scan_16x16_neighbors;
michael@0 178 break;
michael@0 179 }
michael@0 180 }
michael@0 181
michael@0 182 static INLINE const int16_t* get_iscan_16x16(TX_TYPE tx_type) {
michael@0 183 switch (tx_type) {
michael@0 184 case ADST_DCT:
michael@0 185 return vp9_row_iscan_16x16;
michael@0 186 case DCT_ADST:
michael@0 187 return vp9_col_iscan_16x16;
michael@0 188 default:
michael@0 189 return vp9_default_iscan_16x16;
michael@0 190 }
michael@0 191 }
michael@0 192
michael@0 193 static INLINE int get_coef_context(const int16_t *neighbors,
michael@0 194 const uint8_t *token_cache, int c) {
michael@0 195 return (1 + token_cache[neighbors[MAX_NEIGHBORS * c + 0]] +
michael@0 196 token_cache[neighbors[MAX_NEIGHBORS * c + 1]]) >> 1;
michael@0 197 }
michael@0 198
michael@0 199 #endif // VP9_COMMON_VP9_SCAN_H_

mercurial