Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: source/libvpx/vp9/common/vp9_onyxc_int.h

Issue 168343002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: libvpx: Pull from upstream Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/common/vp9_onyx.h ('k') | source/libvpx/vp9/common/vp9_postproc.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef VP9_COMMON_VP9_ONYXC_INT_H_ 11 #ifndef VP9_COMMON_VP9_ONYXC_INT_H_
12 #define VP9_COMMON_VP9_ONYXC_INT_H_ 12 #define VP9_COMMON_VP9_ONYXC_INT_H_
13 13
14 #include "./vpx_config.h" 14 #include "./vpx_config.h"
15 #include "vpx/internal/vpx_codec_internal.h" 15 #include "vpx/internal/vpx_codec_internal.h"
16 #include "./vp9_rtcd.h" 16 #include "./vp9_rtcd.h"
17 #include "vp9/common/vp9_loopfilter.h" 17 #include "vp9/common/vp9_loopfilter.h"
18 #include "vp9/common/vp9_entropymv.h" 18 #include "vp9/common/vp9_entropymv.h"
19 #include "vp9/common/vp9_entropy.h" 19 #include "vp9/common/vp9_entropy.h"
20 #include "vp9/common/vp9_entropymode.h" 20 #include "vp9/common/vp9_entropymode.h"
21 #include "vp9/common/vp9_frame_buffers.h"
21 #include "vp9/common/vp9_quant_common.h" 22 #include "vp9/common/vp9_quant_common.h"
22 #include "vp9/common/vp9_tile_common.h" 23 #include "vp9/common/vp9_tile_common.h"
23 24
24 #if CONFIG_VP9_POSTPROC 25 #if CONFIG_VP9_POSTPROC
25 #include "vp9/common/vp9_postproc.h" 26 #include "vp9/common/vp9_postproc.h"
26 #endif 27 #endif
27 28
28 #ifdef __cplusplus 29 #ifdef __cplusplus
29 extern "C" { 30 extern "C" {
30 #endif 31 #endif
(...skipping 22 matching lines...) Expand all
53 vp9_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1]; 54 vp9_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1];
54 vp9_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES]; 55 vp9_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES];
55 vp9_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS] 56 vp9_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
56 [SWITCHABLE_FILTERS - 1]; 57 [SWITCHABLE_FILTERS - 1];
57 vp9_prob inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1]; 58 vp9_prob inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1];
58 vp9_prob intra_inter_prob[INTRA_INTER_CONTEXTS]; 59 vp9_prob intra_inter_prob[INTRA_INTER_CONTEXTS];
59 vp9_prob comp_inter_prob[COMP_INTER_CONTEXTS]; 60 vp9_prob comp_inter_prob[COMP_INTER_CONTEXTS];
60 vp9_prob single_ref_prob[REF_CONTEXTS][2]; 61 vp9_prob single_ref_prob[REF_CONTEXTS][2];
61 vp9_prob comp_ref_prob[REF_CONTEXTS]; 62 vp9_prob comp_ref_prob[REF_CONTEXTS];
62 struct tx_probs tx_probs; 63 struct tx_probs tx_probs;
63 vp9_prob mbskip_probs[MBSKIP_CONTEXTS]; 64 vp9_prob skip_probs[SKIP_CONTEXTS];
64 nmv_context nmvc; 65 nmv_context nmvc;
65 } FRAME_CONTEXT; 66 } FRAME_CONTEXT;
66 67
67 typedef struct { 68 typedef struct {
68 unsigned int y_mode[BLOCK_SIZE_GROUPS][INTRA_MODES]; 69 unsigned int y_mode[BLOCK_SIZE_GROUPS][INTRA_MODES];
69 unsigned int uv_mode[INTRA_MODES][INTRA_MODES]; 70 unsigned int uv_mode[INTRA_MODES][INTRA_MODES];
70 unsigned int partition[PARTITION_CONTEXTS][PARTITION_TYPES]; 71 unsigned int partition[PARTITION_CONTEXTS][PARTITION_TYPES];
71 vp9_coeff_count_model coef[TX_SIZES][PLANE_TYPES]; 72 vp9_coeff_count_model coef[TX_SIZES][PLANE_TYPES];
72 unsigned int eob_branch[TX_SIZES][PLANE_TYPES][REF_TYPES] 73 unsigned int eob_branch[TX_SIZES][PLANE_TYPES][REF_TYPES]
73 [COEF_BANDS][COEFF_CONTEXTS]; 74 [COEF_BANDS][COEFF_CONTEXTS];
74 unsigned int switchable_interp[SWITCHABLE_FILTER_CONTEXTS] 75 unsigned int switchable_interp[SWITCHABLE_FILTER_CONTEXTS]
75 [SWITCHABLE_FILTERS]; 76 [SWITCHABLE_FILTERS];
76 unsigned int inter_mode[INTER_MODE_CONTEXTS][INTER_MODES]; 77 unsigned int inter_mode[INTER_MODE_CONTEXTS][INTER_MODES];
77 unsigned int intra_inter[INTRA_INTER_CONTEXTS][2]; 78 unsigned int intra_inter[INTRA_INTER_CONTEXTS][2];
78 unsigned int comp_inter[COMP_INTER_CONTEXTS][2]; 79 unsigned int comp_inter[COMP_INTER_CONTEXTS][2];
79 unsigned int single_ref[REF_CONTEXTS][2][2]; 80 unsigned int single_ref[REF_CONTEXTS][2][2];
80 unsigned int comp_ref[REF_CONTEXTS][2]; 81 unsigned int comp_ref[REF_CONTEXTS][2];
81 struct tx_counts tx; 82 struct tx_counts tx;
82 unsigned int mbskip[MBSKIP_CONTEXTS][2]; 83 unsigned int skip[SKIP_CONTEXTS][2];
83 nmv_context_counts mv; 84 nmv_context_counts mv;
84 } FRAME_COUNTS; 85 } FRAME_COUNTS;
85 86
86 87
87 typedef enum { 88 typedef enum {
88 SINGLE_REFERENCE = 0, 89 SINGLE_REFERENCE = 0,
89 COMPOUND_REFERENCE = 1, 90 COMPOUND_REFERENCE = 1,
90 REFERENCE_MODE_SELECT = 2, 91 REFERENCE_MODE_SELECT = 2,
91 REFERENCE_MODES = 3, 92 REFERENCE_MODES = 3,
92 } REFERENCE_MODE; 93 } REFERENCE_MODE;
93 94
95
96 typedef struct {
97 int ref_count;
98 vpx_codec_frame_buffer_t raw_frame_buffer;
99 YV12_BUFFER_CONFIG buf;
100 } RefCntBuffer;
101
94 typedef struct VP9Common { 102 typedef struct VP9Common {
95 struct vpx_internal_error_info error; 103 struct vpx_internal_error_info error;
96 104
97 DECLARE_ALIGNED(16, int16_t, y_dequant[QINDEX_RANGE][8]); 105 DECLARE_ALIGNED(16, int16_t, y_dequant[QINDEX_RANGE][8]);
98 DECLARE_ALIGNED(16, int16_t, uv_dequant[QINDEX_RANGE][8]); 106 DECLARE_ALIGNED(16, int16_t, uv_dequant[QINDEX_RANGE][8]);
99 #if CONFIG_ALPHA 107 #if CONFIG_ALPHA
100 DECLARE_ALIGNED(16, int16_t, a_dequant[QINDEX_RANGE][8]); 108 DECLARE_ALIGNED(16, int16_t, a_dequant[QINDEX_RANGE][8]);
101 #endif 109 #endif
102 110
103 COLOR_SPACE color_space; 111 COLOR_SPACE color_space;
104 112
105 int width; 113 int width;
106 int height; 114 int height;
107 int display_width; 115 int display_width;
108 int display_height; 116 int display_height;
109 int last_width; 117 int last_width;
110 int last_height; 118 int last_height;
111 119
112 // TODO(jkoleszar): this implies chroma ss right now, but could vary per 120 // TODO(jkoleszar): this implies chroma ss right now, but could vary per
113 // plane. Revisit as part of the future change to YV12_BUFFER_CONFIG to 121 // plane. Revisit as part of the future change to YV12_BUFFER_CONFIG to
114 // support additional planes. 122 // support additional planes.
115 int subsampling_x; 123 int subsampling_x;
116 int subsampling_y; 124 int subsampling_y;
117 125
118 YV12_BUFFER_CONFIG *frame_to_show; 126 YV12_BUFFER_CONFIG *frame_to_show;
119 127
120 YV12_BUFFER_CONFIG yv12_fb[FRAME_BUFFERS]; 128 RefCntBuffer frame_bufs[FRAME_BUFFERS];
121 int fb_idx_ref_cnt[FRAME_BUFFERS]; /* reference counts */ 129
122 int ref_frame_map[REF_FRAMES]; /* maps fb_idx to reference slot */ 130 int ref_frame_map[REF_FRAMES]; /* maps fb_idx to reference slot */
123 131
124 // TODO(jkoleszar): could expand active_ref_idx to 4, with 0 as intra, and 132 // TODO(jkoleszar): could expand active_ref_idx to 4, with 0 as intra, and
125 // roll new_fb_idx into it. 133 // roll new_fb_idx into it.
126 134
127 // Each frame can reference REFS_PER_FRAME buffers 135 // Each frame can reference REFS_PER_FRAME buffers
128 RefBuffer frame_refs[REFS_PER_FRAME]; 136 RefBuffer frame_refs[REFS_PER_FRAME];
129 137
130 int new_fb_idx; 138 int new_fb_idx;
131 139
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 int version; 218 int version;
211 219
212 #if CONFIG_VP9_POSTPROC 220 #if CONFIG_VP9_POSTPROC
213 struct postproc_state postproc_state; 221 struct postproc_state postproc_state;
214 #endif 222 #endif
215 223
216 int error_resilient_mode; 224 int error_resilient_mode;
217 int frame_parallel_decoding_mode; 225 int frame_parallel_decoding_mode;
218 226
219 int log2_tile_cols, log2_tile_rows; 227 int log2_tile_cols, log2_tile_rows;
228
229 // Private data associated with the frame buffer callbacks.
230 void *cb_priv;
231 vpx_get_frame_buffer_cb_fn_t get_fb_cb;
232 vpx_release_frame_buffer_cb_fn_t release_fb_cb;
233
234 // Handles memory for the codec.
235 InternalFrameBufferList int_frame_buffers;
220 } VP9_COMMON; 236 } VP9_COMMON;
221 237
222 static YV12_BUFFER_CONFIG *get_frame_new_buffer(VP9_COMMON *cm) { 238 static INLINE YV12_BUFFER_CONFIG *get_frame_new_buffer(VP9_COMMON *cm) {
223 return &cm->yv12_fb[cm->new_fb_idx]; 239 return &cm->frame_bufs[cm->new_fb_idx].buf;
224 } 240 }
225 241
226 static int get_free_fb(VP9_COMMON *cm) { 242 static INLINE int get_free_fb(VP9_COMMON *cm) {
227 int i; 243 int i;
228 for (i = 0; i < FRAME_BUFFERS; i++) 244 for (i = 0; i < FRAME_BUFFERS; i++)
229 if (cm->fb_idx_ref_cnt[i] == 0) 245 if (cm->frame_bufs[i].ref_count == 0)
230 break; 246 break;
231 247
232 assert(i < FRAME_BUFFERS); 248 assert(i < FRAME_BUFFERS);
233 cm->fb_idx_ref_cnt[i] = 1; 249 cm->frame_bufs[i].ref_count = 1;
234 return i; 250 return i;
235 } 251 }
236 252
237 static void ref_cnt_fb(int *buf, int *idx, int new_idx) { 253 static INLINE void ref_cnt_fb(RefCntBuffer *bufs, int *idx, int new_idx) {
238 const int ref_index = *idx; 254 const int ref_index = *idx;
239 255
240 if (ref_index >= 0 && buf[ref_index] > 0) 256 if (ref_index >= 0 && bufs[ref_index].ref_count > 0)
241 buf[ref_index]--; 257 bufs[ref_index].ref_count--;
242 258
243 *idx = new_idx; 259 *idx = new_idx;
244 260
245 buf[new_idx]++; 261 bufs[new_idx].ref_count++;
246 } 262 }
247 263
248 static int mi_cols_aligned_to_sb(int n_mis) { 264 static INLINE int mi_cols_aligned_to_sb(int n_mis) {
249 return ALIGN_POWER_OF_TWO(n_mis, MI_BLOCK_SIZE_LOG2); 265 return ALIGN_POWER_OF_TWO(n_mis, MI_BLOCK_SIZE_LOG2);
250 } 266 }
251 267
252 static INLINE const vp9_prob* get_partition_probs(VP9_COMMON *cm, int ctx) { 268 static INLINE const vp9_prob* get_partition_probs(VP9_COMMON *cm, int ctx) {
253 return cm->frame_type == KEY_FRAME ? vp9_kf_partition_probs[ctx] 269 return cm->frame_type == KEY_FRAME ? vp9_kf_partition_probs[ctx]
254 : cm->fc.partition_prob[ctx]; 270 : cm->fc.partition_prob[ctx];
255 } 271 }
256 272
257 static INLINE void set_skip_context( 273 static INLINE void set_skip_context(
258 MACROBLOCKD *xd, 274 MACROBLOCKD *xd,
259 ENTROPY_CONTEXT *above_context[MAX_MB_PLANE], 275 ENTROPY_CONTEXT *above_context[MAX_MB_PLANE],
260 ENTROPY_CONTEXT left_context[MAX_MB_PLANE][16], 276 ENTROPY_CONTEXT left_context[MAX_MB_PLANE][16],
261 int mi_row, int mi_col) { 277 int mi_row, int mi_col) {
262 const int above_idx = mi_col * 2; 278 const int above_idx = mi_col * 2;
263 const int left_idx = (mi_row * 2) & 15; 279 const int left_idx = (mi_row * 2) & 15;
264 int i; 280 int i;
265 for (i = 0; i < MAX_MB_PLANE; i++) { 281 for (i = 0; i < MAX_MB_PLANE; i++) {
266 struct macroblockd_plane *const pd = &xd->plane[i]; 282 struct macroblockd_plane *const pd = &xd->plane[i];
267 pd->above_context = above_context[i] + (above_idx >> pd->subsampling_x); 283 pd->above_context = above_context[i] + (above_idx >> pd->subsampling_x);
268 pd->left_context = left_context[i] + (left_idx >> pd->subsampling_y); 284 pd->left_context = left_context[i] + (left_idx >> pd->subsampling_y);
269 } 285 }
270 } 286 }
271 287
272 static void set_mi_row_col(MACROBLOCKD *xd, const TileInfo *const tile, 288 static INLINE void set_mi_row_col(MACROBLOCKD *xd, const TileInfo *const tile,
273 int mi_row, int bh, 289 int mi_row, int bh,
274 int mi_col, int bw, 290 int mi_col, int bw,
275 int mi_rows, int mi_cols) { 291 int mi_rows, int mi_cols) {
276 xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8); 292 xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8);
277 xd->mb_to_bottom_edge = ((mi_rows - bh - mi_row) * MI_SIZE) * 8; 293 xd->mb_to_bottom_edge = ((mi_rows - bh - mi_row) * MI_SIZE) * 8;
278 xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8); 294 xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8);
279 xd->mb_to_right_edge = ((mi_cols - bw - mi_col) * MI_SIZE) * 8; 295 xd->mb_to_right_edge = ((mi_cols - bw - mi_col) * MI_SIZE) * 8;
280 296
281 // Are edges available for intra prediction? 297 // Are edges available for intra prediction?
282 xd->up_available = (mi_row != 0); 298 xd->up_available = (mi_row != 0);
283 xd->left_available = (mi_col > tile->mi_col_start); 299 xd->left_available = (mi_col > tile->mi_col_start);
284 } 300 }
285 301
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 left = (left & bs) > 0; 354 left = (left & bs) > 0;
339 355
340 return (left * 2 + above) + bsl * PARTITION_PLOFFSET; 356 return (left * 2 + above) + bsl * PARTITION_PLOFFSET;
341 } 357 }
342 358
343 #ifdef __cplusplus 359 #ifdef __cplusplus
344 } // extern "C" 360 } // extern "C"
345 #endif 361 #endif
346 362
347 #endif // VP9_COMMON_VP9_ONYXC_INT_H_ 363 #endif // VP9_COMMON_VP9_ONYXC_INT_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_onyx.h ('k') | source/libvpx/vp9/common/vp9_postproc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698