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

Side by Side Diff: source/libvpx/vp9/encoder/vp9_tokenize.c

Issue 668403002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 2 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/encoder/vp9_tokenize.h ('k') | source/libvpx/vp9/encoder/vp9_variance.h » ('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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 MACROBLOCKD *const xd = args->xd; 254 MACROBLOCKD *const xd = args->xd;
255 struct macroblock_plane *p = &args->cpi->mb.plane[plane]; 255 struct macroblock_plane *p = &args->cpi->mb.plane[plane];
256 struct macroblockd_plane *pd = &xd->plane[plane]; 256 struct macroblockd_plane *pd = &xd->plane[plane];
257 int aoff, loff; 257 int aoff, loff;
258 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff); 258 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff);
259 vp9_set_contexts(xd, pd, plane_bsize, tx_size, p->eobs[block] > 0, 259 vp9_set_contexts(xd, pd, plane_bsize, tx_size, p->eobs[block] > 0,
260 aoff, loff); 260 aoff, loff);
261 } 261 }
262 262
263 static INLINE void add_token(TOKENEXTRA **t, const vp9_prob *context_tree, 263 static INLINE void add_token(TOKENEXTRA **t, const vp9_prob *context_tree,
264 int16_t extra, uint8_t token, 264 int32_t extra, uint8_t token,
265 uint8_t skip_eob_node, 265 uint8_t skip_eob_node,
266 unsigned int *counts) { 266 unsigned int *counts) {
267 (*t)->token = token; 267 (*t)->token = token;
268 (*t)->extra = extra; 268 (*t)->extra = extra;
269 (*t)->context_tree = context_tree; 269 (*t)->context_tree = context_tree;
270 (*t)->skip_eob_node = skip_eob_node; 270 (*t)->skip_eob_node = skip_eob_node;
271 (*t)++; 271 (*t)++;
272 ++counts[token]; 272 ++counts[token];
273 } 273 }
274 274
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 int aoff, loff; 323 int aoff, loff;
324 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff); 324 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff);
325 325
326 pt = get_entropy_context(tx_size, pd->above_context + aoff, 326 pt = get_entropy_context(tx_size, pd->above_context + aoff,
327 pd->left_context + loff); 327 pd->left_context + loff);
328 so = get_scan(xd, tx_size, type, block); 328 so = get_scan(xd, tx_size, type, block);
329 scan = so->scan; 329 scan = so->scan;
330 nb = so->neighbors; 330 nb = so->neighbors;
331 c = 0; 331 c = 0;
332 #if CONFIG_VP9_HIGH && CONFIG_HIGH_QUANT 332 #if CONFIG_VP9_HIGHBITDEPTH
333 if (cpi->common.profile >= PROFILE_2) { 333 if (cpi->common.profile >= PROFILE_2) {
334 dct_value_tokens = (cpi->common.bit_depth == VPX_BITS_10 ? 334 dct_value_tokens = (cpi->common.bit_depth == VPX_BITS_10 ?
335 vp9_dct_value_tokens_high10_ptr : 335 vp9_dct_value_tokens_high10_ptr :
336 vp9_dct_value_tokens_high12_ptr); 336 vp9_dct_value_tokens_high12_ptr);
337 } else { 337 } else {
338 dct_value_tokens = vp9_dct_value_tokens_ptr; 338 dct_value_tokens = vp9_dct_value_tokens_ptr;
339 } 339 }
340 #else 340 #else
341 dct_value_tokens = vp9_dct_value_tokens_ptr; 341 dct_value_tokens = vp9_dct_value_tokens_ptr;
342 #endif 342 #endif
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // TODO(yaowu): rewrite and optimize this function to remove the usage of 396 // TODO(yaowu): rewrite and optimize this function to remove the usage of
397 // vp9_foreach_transform_block() and simplify is_skippable(). 397 // vp9_foreach_transform_block() and simplify is_skippable().
398 int vp9_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) { 398 int vp9_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
399 int result = 1; 399 int result = 1;
400 struct is_skippable_args args = {x, &result}; 400 struct is_skippable_args args = {x, &result};
401 vp9_foreach_transformed_block_in_plane(&x->e_mbd, bsize, plane, is_skippable, 401 vp9_foreach_transformed_block_in_plane(&x->e_mbd, bsize, plane, is_skippable,
402 &args); 402 &args);
403 return result; 403 return result;
404 } 404 }
405 405
406 static void has_high_freq_coeff(int plane, int block,
407 BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
408 void *argv) {
409 struct is_skippable_args *args = argv;
410 int eobs = (tx_size == TX_4X4) ? 3 : 10;
411 (void) plane_bsize;
412
413 *(args->skippable) |= (args->x->plane[plane].eobs[block] > eobs);
414 }
415
416 int vp9_has_high_freq_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
417 int result = 0;
418 struct is_skippable_args args = {x, &result};
419 vp9_foreach_transformed_block_in_plane(&x->e_mbd, bsize, plane,
420 has_high_freq_coeff, &args);
421 return result;
422 }
423
406 void vp9_tokenize_sb(VP9_COMP *cpi, TOKENEXTRA **t, int dry_run, 424 void vp9_tokenize_sb(VP9_COMP *cpi, TOKENEXTRA **t, int dry_run,
407 BLOCK_SIZE bsize) { 425 BLOCK_SIZE bsize) {
408 VP9_COMMON *const cm = &cpi->common; 426 VP9_COMMON *const cm = &cpi->common;
409 MACROBLOCKD *const xd = &cpi->mb.e_mbd; 427 MACROBLOCKD *const xd = &cpi->mb.e_mbd;
410 MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi; 428 MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi;
411 TOKENEXTRA *t_backup = *t; 429 TOKENEXTRA *t_backup = *t;
412 const int ctx = vp9_get_skip_context(xd); 430 const int ctx = vp9_get_skip_context(xd);
413 const int skip_inc = !vp9_segfeature_active(&cm->seg, mbmi->segment_id, 431 const int skip_inc = !vp9_segfeature_active(&cm->seg, mbmi->segment_id,
414 SEG_LVL_SKIP); 432 SEG_LVL_SKIP);
415 struct tokenize_b_args arg = {cpi, xd, t}; 433 struct tokenize_b_args arg = {cpi, xd, t};
416 if (mbmi->skip) { 434 if (mbmi->skip) {
417 if (!dry_run) 435 if (!dry_run)
418 cm->counts.skip[ctx][1] += skip_inc; 436 cm->counts.skip[ctx][1] += skip_inc;
419 reset_skip_context(xd, bsize); 437 reset_skip_context(xd, bsize);
420 if (dry_run) 438 if (dry_run)
421 *t = t_backup; 439 *t = t_backup;
422 return; 440 return;
423 } 441 }
424 442
425 if (!dry_run) { 443 if (!dry_run) {
426 cm->counts.skip[ctx][0] += skip_inc; 444 cm->counts.skip[ctx][0] += skip_inc;
427 vp9_foreach_transformed_block(xd, bsize, tokenize_b, &arg); 445 vp9_foreach_transformed_block(xd, bsize, tokenize_b, &arg);
428 } else { 446 } else {
429 vp9_foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg); 447 vp9_foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg);
430 *t = t_backup; 448 *t = t_backup;
431 } 449 }
432 } 450 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_tokenize.h ('k') | source/libvpx/vp9/encoder/vp9_variance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698