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

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

Issue 1124333011: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: only update to last nights LKGR Created 5 years, 7 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
« no previous file with comments | « source/libvpx/vp9/common/vp9_mvref_common.c ('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
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // that no FrameWorker owns, or is decoding, this buffer. 81 // that no FrameWorker owns, or is decoding, this buffer.
82 VP9Worker *frame_worker_owner; 82 VP9Worker *frame_worker_owner;
83 83
84 // row and col indicate which position frame has been decoded to in real 84 // row and col indicate which position frame has been decoded to in real
85 // pixel unit. They are reset to -1 when decoding begins and set to INT_MAX 85 // pixel unit. They are reset to -1 when decoding begins and set to INT_MAX
86 // when the frame is fully decoded. 86 // when the frame is fully decoded.
87 int row; 87 int row;
88 int col; 88 int col;
89 } RefCntBuffer; 89 } RefCntBuffer;
90 90
91 typedef struct { 91 typedef struct BufferPool {
92 // Protect BufferPool from being accessed by several FrameWorkers at 92 // Protect BufferPool from being accessed by several FrameWorkers at
93 // the same time during frame parallel decode. 93 // the same time during frame parallel decode.
94 // TODO(hkuang): Try to use atomic variable instead of locking the whole pool. 94 // TODO(hkuang): Try to use atomic variable instead of locking the whole pool.
95 #if CONFIG_MULTITHREAD 95 #if CONFIG_MULTITHREAD
96 pthread_mutex_t pool_mutex; 96 pthread_mutex_t pool_mutex;
97 #endif 97 #endif
98 98
99 // Private data associated with the frame buffer callbacks. 99 // Private data associated with the frame buffer callbacks.
100 void *cb_priv; 100 void *cb_priv;
101 101
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 int mb_cols, mi_cols; 177 int mb_cols, mi_cols;
178 int mi_stride; 178 int mi_stride;
179 179
180 /* profile settings */ 180 /* profile settings */
181 TX_MODE tx_mode; 181 TX_MODE tx_mode;
182 182
183 int base_qindex; 183 int base_qindex;
184 int y_dc_delta_q; 184 int y_dc_delta_q;
185 int uv_dc_delta_q; 185 int uv_dc_delta_q;
186 int uv_ac_delta_q; 186 int uv_ac_delta_q;
187 int16_t y_dequant[MAX_SEGMENTS][2];
188 int16_t uv_dequant[MAX_SEGMENTS][2];
187 189
188 /* We allocate a MODE_INFO struct for each macroblock, together with 190 /* We allocate a MODE_INFO struct for each macroblock, together with
189 an extra row on top and column on the left to simplify prediction. */ 191 an extra row on top and column on the left to simplify prediction. */
190 int mi_alloc_size; 192 int mi_alloc_size;
191 MODE_INFO *mip; /* Base of allocated array */ 193 MODE_INFO *mip; /* Base of allocated array */
192 MODE_INFO *mi; /* Corresponds to upper left visible macroblock */ 194 MODE_INFO *mi; /* Corresponds to upper left visible macroblock */
193 195
194 // TODO(agrange): Move prev_mi into encoder structure. 196 // TODO(agrange): Move prev_mi into encoder structure.
195 // prev_mip and prev_mi will only be allocated in VP9 encoder. 197 // prev_mip and prev_mi will only be allocated in VP9 encoder.
196 MODE_INFO *prev_mip; /* MODE_INFO array 'mip' from last decoded frame */ 198 MODE_INFO *prev_mip; /* MODE_INFO array 'mip' from last decoded frame */
197 MODE_INFO *prev_mi; /* 'mi' from last frame (points into prev_mip) */ 199 MODE_INFO *prev_mi; /* 'mi' from last frame (points into prev_mip) */
198 200
199 // Separate mi functions between encoder and decoder. 201 // Separate mi functions between encoder and decoder.
200 int (*alloc_mi)(struct VP9Common *cm, int mi_size); 202 int (*alloc_mi)(struct VP9Common *cm, int mi_size);
201 void (*free_mi)(struct VP9Common *cm); 203 void (*free_mi)(struct VP9Common *cm);
202 void (*setup_mi)(struct VP9Common *cm); 204 void (*setup_mi)(struct VP9Common *cm);
203 205
206 // Grid of pointers to 8x8 MODE_INFO structs. Any 8x8 not in the visible
207 // area will be NULL.
208 MODE_INFO **mi_grid_base;
209 MODE_INFO **mi_grid_visible;
210 MODE_INFO **prev_mi_grid_base;
211 MODE_INFO **prev_mi_grid_visible;
204 212
205 // Whether to use previous frame's motion vectors for prediction. 213 // Whether to use previous frame's motion vectors for prediction.
206 int use_prev_frame_mvs; 214 int use_prev_frame_mvs;
207 215
208 // Persistent mb segment id map used in prediction. 216 // Persistent mb segment id map used in prediction.
209 int seg_map_idx; 217 int seg_map_idx;
210 int prev_seg_map_idx; 218 int prev_seg_map_idx;
211 219
212 uint8_t *seg_map_array[NUM_PING_PONG_BUFFERS]; 220 uint8_t *seg_map_array[NUM_PING_PONG_BUFFERS];
213 uint8_t *last_frame_seg_map; 221 uint8_t *last_frame_seg_map;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 int mi_rows, int mi_cols) { 372 int mi_rows, int mi_cols) {
365 xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8); 373 xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8);
366 xd->mb_to_bottom_edge = ((mi_rows - bh - mi_row) * MI_SIZE) * 8; 374 xd->mb_to_bottom_edge = ((mi_rows - bh - mi_row) * MI_SIZE) * 8;
367 xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8); 375 xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8);
368 xd->mb_to_right_edge = ((mi_cols - bw - mi_col) * MI_SIZE) * 8; 376 xd->mb_to_right_edge = ((mi_cols - bw - mi_col) * MI_SIZE) * 8;
369 377
370 // Are edges available for intra prediction? 378 // Are edges available for intra prediction?
371 xd->up_available = (mi_row != 0); 379 xd->up_available = (mi_row != 0);
372 xd->left_available = (mi_col > tile->mi_col_start); 380 xd->left_available = (mi_col > tile->mi_col_start);
373 if (xd->up_available) { 381 if (xd->up_available) {
374 xd->above_mi = xd->mi[-xd->mi_stride].src_mi; 382 xd->above_mi = xd->mi[-xd->mi_stride];
383 // above_mi may be NULL in VP9 encoder's first pass.
375 xd->above_mbmi = xd->above_mi ? &xd->above_mi->mbmi : NULL; 384 xd->above_mbmi = xd->above_mi ? &xd->above_mi->mbmi : NULL;
376 } else { 385 } else {
377 xd->above_mi = NULL; 386 xd->above_mi = NULL;
378 xd->above_mbmi = NULL; 387 xd->above_mbmi = NULL;
379 } 388 }
380 389
381 if (xd->left_available) { 390 if (xd->left_available) {
382 xd->left_mi = xd->mi[-1].src_mi; 391 xd->left_mi = xd->mi[-1];
392 // left_mi may be NULL in VP9 encoder's first pass.
383 xd->left_mbmi = xd->left_mi ? &xd->left_mi->mbmi : NULL; 393 xd->left_mbmi = xd->left_mi ? &xd->left_mi->mbmi : NULL;
384 } else { 394 } else {
385 xd->left_mi = NULL; 395 xd->left_mi = NULL;
386 xd->left_mbmi = NULL; 396 xd->left_mbmi = NULL;
387 } 397 }
388 } 398 }
389 399
390 static INLINE void update_partition_context(MACROBLOCKD *xd, 400 static INLINE void update_partition_context(MACROBLOCKD *xd,
391 int mi_row, int mi_col, 401 int mi_row, int mi_col,
392 BLOCK_SIZE subsize, 402 BLOCK_SIZE subsize,
393 BLOCK_SIZE bsize) { 403 BLOCK_SIZE bsize) {
394 PARTITION_CONTEXT *const above_ctx = xd->above_seg_context + mi_col; 404 PARTITION_CONTEXT *const above_ctx = xd->above_seg_context + mi_col;
395 PARTITION_CONTEXT *const left_ctx = xd->left_seg_context + (mi_row & MI_MASK); 405 PARTITION_CONTEXT *const left_ctx = xd->left_seg_context + (mi_row & MI_MASK);
396 406
397 // num_4x4_blocks_wide_lookup[bsize] / 2 407 // num_4x4_blocks_wide_lookup[bsize] / 2
398 const int bs = num_8x8_blocks_wide_lookup[bsize]; 408 const int bs = num_8x8_blocks_wide_lookup[bsize];
399 409
400 // update the partition context at the end notes. set partition bits 410 // update the partition context at the end notes. set partition bits
401 // of block sizes larger than the current one to be one, and partition 411 // of block sizes larger than the current one to be one, and partition
402 // bits of smaller block sizes to be zero. 412 // bits of smaller block sizes to be zero.
403 vpx_memset(above_ctx, partition_context_lookup[subsize].above, bs); 413 memset(above_ctx, partition_context_lookup[subsize].above, bs);
404 vpx_memset(left_ctx, partition_context_lookup[subsize].left, bs); 414 memset(left_ctx, partition_context_lookup[subsize].left, bs);
405 } 415 }
406 416
407 static INLINE int partition_plane_context(const MACROBLOCKD *xd, 417 static INLINE int partition_plane_context(const MACROBLOCKD *xd,
408 int mi_row, int mi_col, 418 int mi_row, int mi_col,
409 BLOCK_SIZE bsize) { 419 BLOCK_SIZE bsize) {
410 const PARTITION_CONTEXT *above_ctx = xd->above_seg_context + mi_col; 420 const PARTITION_CONTEXT *above_ctx = xd->above_seg_context + mi_col;
411 const PARTITION_CONTEXT *left_ctx = xd->left_seg_context + (mi_row & MI_MASK); 421 const PARTITION_CONTEXT *left_ctx = xd->left_seg_context + (mi_row & MI_MASK);
412
413 const int bsl = mi_width_log2_lookup[bsize]; 422 const int bsl = mi_width_log2_lookup[bsize];
414 const int bs = 1 << bsl; 423 int above = (*above_ctx >> bsl) & 1 , left = (*left_ctx >> bsl) & 1;
415 int above = 0, left = 0, i;
416 424
417 assert(b_width_log2_lookup[bsize] == b_height_log2_lookup[bsize]); 425 assert(b_width_log2_lookup[bsize] == b_height_log2_lookup[bsize]);
418 assert(bsl >= 0); 426 assert(bsl >= 0);
419 427
420 for (i = 0; i < bs; i++) {
421 above |= above_ctx[i];
422 left |= left_ctx[i];
423 }
424 above = (above & bs) > 0;
425 left = (left & bs) > 0;
426
427 return (left * 2 + above) + bsl * PARTITION_PLOFFSET; 428 return (left * 2 + above) + bsl * PARTITION_PLOFFSET;
428 } 429 }
429 430
430 #ifdef __cplusplus 431 #ifdef __cplusplus
431 } // extern "C" 432 } // extern "C"
432 #endif 433 #endif
433 434
434 #endif // VP9_COMMON_VP9_ONYXC_INT_H_ 435 #endif // VP9_COMMON_VP9_ONYXC_INT_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_mvref_common.c ('k') | source/libvpx/vp9/common/vp9_postproc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698