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

Side by Side Diff: source/libvpx/vp9/common/vp9_blockd.c

Issue 1015483002: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 9 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/test/test.mk ('k') | source/libvpx/vp9/common/vp9_thread_common.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) 2014 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 const MB_MODE_INFO* mbmi = &xd->mi[0].src_mi->mbmi; 43 const MB_MODE_INFO* mbmi = &xd->mi[0].src_mi->mbmi;
44 // block and transform sizes, in number of 4x4 blocks log 2 ("*_b") 44 // block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
45 // 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8 45 // 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
46 // transform size varies per plane, look it up in a common way. 46 // transform size varies per plane, look it up in a common way.
47 const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) 47 const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd)
48 : mbmi->tx_size; 48 : mbmi->tx_size;
49 const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); 49 const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
50 const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize]; 50 const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
51 const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize]; 51 const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
52 const int step = 1 << (tx_size << 1); 52 const int step = 1 << (tx_size << 1);
53 int i; 53 int i = 0, r, c;
54 54
55 // If mb_to_right_edge is < 0 we are in a situation in which 55 // If mb_to_right_edge is < 0 we are in a situation in which
56 // the current block size extends into the UMV and we won't 56 // the current block size extends into the UMV and we won't
57 // visit the sub blocks that are wholly within the UMV. 57 // visit the sub blocks that are wholly within the UMV.
58 if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0) { 58 const int max_blocks_wide = num_4x4_w + (xd->mb_to_right_edge >= 0 ? 0 :
59 int r, c; 59 xd->mb_to_right_edge >> (5 + pd->subsampling_x));
60 const int max_blocks_high = num_4x4_h + (xd->mb_to_bottom_edge >= 0 ? 0 :
61 xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
60 62
61 int max_blocks_wide = num_4x4_w; 63 // Keep track of the row and column of the blocks we use so that we know
62 int max_blocks_high = num_4x4_h; 64 // if we are in the unrestricted motion border.
63 65 for (r = 0; r < max_blocks_high; r += (1 << tx_size)) {
64 // xd->mb_to_right_edge is in units of pixels * 8. This converts 66 for (c = 0; c < num_4x4_w; c += (1 << tx_size)) {
65 // it to 4x4 block sizes. 67 // Skip visiting the sub blocks that are wholly within the UMV.
66 if (xd->mb_to_right_edge < 0) 68 if (c < max_blocks_wide)
67 max_blocks_wide += (xd->mb_to_right_edge >> (5 + pd->subsampling_x)); 69 visit(plane, i, plane_bsize, tx_size, arg);
68 70 i += step;
69 if (xd->mb_to_bottom_edge < 0)
70 max_blocks_high += (xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
71
72 i = 0;
73 // Unlike the normal case - in here we have to keep track of the
74 // row and column of the blocks we use so that we know if we are in
75 // the unrestricted motion border.
76 for (r = 0; r < num_4x4_h; r += (1 << tx_size)) {
77 for (c = 0; c < num_4x4_w; c += (1 << tx_size)) {
78 if (r < max_blocks_high && c < max_blocks_wide)
79 visit(plane, i, plane_bsize, tx_size, arg);
80 i += step;
81 }
82 } 71 }
83 } else {
84 for (i = 0; i < num_4x4_w * num_4x4_h; i += step)
85 visit(plane, i, plane_bsize, tx_size, arg);
86 } 72 }
87 } 73 }
88 74
89 void vp9_foreach_transformed_block(const MACROBLOCKD* const xd, 75 void vp9_foreach_transformed_block(const MACROBLOCKD* const xd,
90 BLOCK_SIZE bsize, 76 BLOCK_SIZE bsize,
91 foreach_transformed_block_visitor visit, 77 foreach_transformed_block_visitor visit,
92 void *arg) { 78 void *arg) {
93 int plane; 79 int plane;
94 80
95 for (plane = 0; plane < MAX_MB_PLANE; ++plane) 81 for (plane = 0; plane < MAX_MB_PLANE; ++plane)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 126
141 void vp9_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) { 127 void vp9_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) {
142 int i; 128 int i;
143 129
144 for (i = 0; i < MAX_MB_PLANE; i++) { 130 for (i = 0; i < MAX_MB_PLANE; i++) {
145 xd->plane[i].plane_type = i ? PLANE_TYPE_UV : PLANE_TYPE_Y; 131 xd->plane[i].plane_type = i ? PLANE_TYPE_UV : PLANE_TYPE_Y;
146 xd->plane[i].subsampling_x = i ? ss_x : 0; 132 xd->plane[i].subsampling_x = i ? ss_x : 0;
147 xd->plane[i].subsampling_y = i ? ss_y : 0; 133 xd->plane[i].subsampling_y = i ? ss_y : 0;
148 } 134 }
149 } 135 }
OLDNEW
« no previous file with comments | « source/libvpx/test/test.mk ('k') | source/libvpx/vp9/common/vp9_thread_common.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698