History

Merge "static function convert to inline or global vp9_blockd.h"

Jim Bankoski committed 12 years ago

Commit 37e53252 parents 1c3fc43 9dec77112 files · +228 −184Browse files

Unified · Split

12 files
  1. vp9/common/vp9_blockd.c +167 −0
  2. vp9/common/vp9_blockd.h +26 −152
  3. vp9/decoder/vp9_decodeframe.c +4 −4
  4. vp9/decoder/vp9_decodemv.c +4 −4
  5. vp9/decoder/vp9_detokenize.c +1 −1
  6. vp9/encoder/vp9_bitstream.c +4 −4
  7. vp9/encoder/vp9_encodeframe.c +1 −1
  8. vp9/encoder/vp9_encodemb.c +5 −4
  9. vp9/encoder/vp9_firstpass.c +1 −1
  10. vp9/encoder/vp9_rdopt.c +6 −6
  11. vp9/encoder/vp9_tokenize.c +8 −7
  12. vp9/vp9_common.mk +1 −0
vp9/common/vp9_blockd.c+167−0
@@ -0,0 +1,167 @@
1/*
2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "vp9/common/vp9_blockd.h"
12
13MB_PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi,
14 const MODE_INFO *left_mi, int b) {
15 if (b == 0 || b == 2) {
16 if (!left_mi || is_inter_block(&left_mi->mbmi))
17 return DC_PRED;
18
19 return left_mi->mbmi.sb_type < BLOCK_8X8 ? left_mi->bmi[b + 1].as_mode
20 : left_mi->mbmi.mode;
21 } else {
22 assert(b == 1 || b == 3);
23 return cur_mi->bmi[b - 1].as_mode;
24 }
25}
26
27MB_PREDICTION_MODE vp9_above_block_mode(const MODE_INFO *cur_mi,
28 const MODE_INFO *above_mi, int b) {
29 if (b == 0 || b == 1) {
30 if (!above_mi || is_inter_block(&above_mi->mbmi))
31 return DC_PRED;
32
33 return above_mi->mbmi.sb_type < BLOCK_8X8 ? above_mi->bmi[b + 2].as_mode
34 : above_mi->mbmi.mode;
35 } else {
36 assert(b == 2 || b == 3);
37 return cur_mi->bmi[b - 2].as_mode;
38 }
39}
40
41void vp9_foreach_transformed_block_in_plane(
42 const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
43 foreach_transformed_block_visitor visit, void *arg) {
44 const struct macroblockd_plane *const pd = &xd->plane[plane];
45 const MB_MODE_INFO* mbmi = &xd->mi_8x8[0]->mbmi;
46 // block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
47 // 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
48 // transform size varies per plane, look it up in a common way.
49 const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi)
50 : mbmi->tx_size;
51 const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
52 const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
53 const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
54 const int step = 1 << (tx_size << 1);
55 int i;
56
57 // If mb_to_right_edge is < 0 we are in a situation in which
58 // the current block size extends into the UMV and we won't
59 // visit the sub blocks that are wholly within the UMV.
60 if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0) {
61 int r, c;
62
63 int max_blocks_wide = num_4x4_w;
64 int max_blocks_high = num_4x4_h;
65
66 // xd->mb_to_right_edge is in units of pixels * 8. This converts
67 // it to 4x4 block sizes.
68 if (xd->mb_to_right_edge < 0)
69 max_blocks_wide += (xd->mb_to_right_edge >> (5 + pd->subsampling_x));
70
71 if (xd->mb_to_bottom_edge < 0)
72 max_blocks_high += (xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
73
74 i = 0;
75 // Unlike the normal case - in here we have to keep track of the
76 // row and column of the blocks we use so that we know if we are in
77 // the unrestricted motion border.
78 for (r = 0; r < num_4x4_h; r += (1 << tx_size)) {
79 for (c = 0; c < num_4x4_w; c += (1 << tx_size)) {
80 if (r < max_blocks_high && c < max_blocks_wide)
81 visit(plane, i, plane_bsize, tx_size, arg);
82 i += step;
83 }
84 }
85 } else {
86 for (i = 0; i < num_4x4_w * num_4x4_h; i += step)
87 visit(plane, i, plane_bsize, tx_size, arg);
88 }
89}
90
91void vp9_foreach_transformed_block(const MACROBLOCKD* const xd,
92 BLOCK_SIZE bsize,
93 foreach_transformed_block_visitor visit,
94 void *arg) {
95 int plane;
96
97 for (plane = 0; plane < MAX_MB_PLANE; plane++)
98 vp9_foreach_transformed_block_in_plane(xd, bsize, plane, visit, arg);
99}
100
101void vp9_foreach_transformed_block_uv(const MACROBLOCKD* const xd,
102 BLOCK_SIZE bsize,
103 foreach_transformed_block_visitor visit,
104 void *arg) {
105 int plane;
106
107 for (plane = 1; plane < MAX_MB_PLANE; plane++)
108 vp9_foreach_transformed_block_in_plane(xd, bsize, plane, visit, arg);
109}
110
111void vp9_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
112 BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob,
113 int aoff, int loff) {
114 ENTROPY_CONTEXT *const a = pd->above_context + aoff;
115 ENTROPY_CONTEXT *const l = pd->left_context + loff;
116 const int tx_size_in_blocks = 1 << tx_size;
117
118 // above
119 if (has_eob && xd->mb_to_right_edge < 0) {
120 int i;
121 const int blocks_wide = num_4x4_blocks_wide_lookup[plane_bsize] +
122 (xd->mb_to_right_edge >> (5 + pd->subsampling_x));
123 int above_contexts = tx_size_in_blocks;
124 if (above_contexts + aoff > blocks_wide)
125 above_contexts = blocks_wide - aoff;
126
127 for (i = 0; i < above_contexts; ++i)
128 a[i] = has_eob;
129 for (i = above_contexts; i < tx_size_in_blocks; ++i)
130 a[i] = 0;
131 } else {
132 vpx_memset(a, has_eob, sizeof(ENTROPY_CONTEXT) * tx_size_in_blocks);
133 }
134
135 // left
136 if (has_eob && xd->mb_to_bottom_edge < 0) {
137 int i;
138 const int blocks_high = num_4x4_blocks_high_lookup[plane_bsize] +
139 (xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
140 int left_contexts = tx_size_in_blocks;
141 if (left_contexts + loff > blocks_high)
142 left_contexts = blocks_high - loff;
143
144 for (i = 0; i < left_contexts; ++i)
145 l[i] = has_eob;
146 for (i = left_contexts; i < tx_size_in_blocks; ++i)
147 l[i] = 0;
148 } else {
149 vpx_memset(l, has_eob, sizeof(ENTROPY_CONTEXT) * tx_size_in_blocks);
150 }
151}
152
153void vp9_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) {
154 int i;
155
156 for (i = 0; i < MAX_MB_PLANE; i++) {
157 xd->plane[i].plane_type = i ? PLANE_TYPE_UV : PLANE_TYPE_Y;
158 xd->plane[i].subsampling_x = i ? ss_x : 0;
159 xd->plane[i].subsampling_y = i ? ss_y : 0;
160 }
161#if CONFIG_ALPHA
162 // TODO(jkoleszar): Using the Y w/h for now
163 xd->plane[3].plane_type = PLANE_TYPE_Y;
164 xd->plane[3].subsampling_x = 0;
165 xd->plane[3].subsampling_y = 0;
166#endif
167}
vp9/common/vp9_blockd.h+26−152
@@ -153,33 +153,11 @@ static INLINE int has_second_ref(const MB_MODE_INFO *mbmi) { · 152 unmodified lines
153 return mbmi->ref_frame[1] > INTRA_FRAME;153 return mbmi->ref_frame[1] > INTRA_FRAME;
154}154}
155 155
156static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mi,156MB_PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi,
157 const MODE_INFO *left_mi, int b) {157 const MODE_INFO *left_mi, int b);
158 if (b == 0 || b == 2) {
159 if (!left_mi || is_inter_block(&left_mi->mbmi))
160 return DC_PRED;
161
162 return left_mi->mbmi.sb_type < BLOCK_8X8 ? left_mi->bmi[b + 1].as_mode
163 : left_mi->mbmi.mode;
164 } else {
165 assert(b == 1 || b == 3);
166 return cur_mi->bmi[b - 1].as_mode;
167 }
168}
169 158
170static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mi,159MB_PREDICTION_MODE vp9_above_block_mode(const MODE_INFO *cur_mi,
171 const MODE_INFO *above_mi, int b) {160 const MODE_INFO *above_mi, int b);
172 if (b == 0 || b == 1) {
173 if (!above_mi || is_inter_block(&above_mi->mbmi))
174 return DC_PRED;
175
176 return above_mi->mbmi.sb_type < BLOCK_8X8 ? above_mi->bmi[b + 2].as_mode
177 : above_mi->mbmi.mode;
178 } else {
179 assert(b == 2 || b == 3);
180 return cur_mi->bmi[b - 2].as_mode;
181 }
182}
183 161
184enum mv_precision {162enum mv_precision {
185 MV_PRECISION_Q3,163 MV_PRECISION_Q3,
@@ -266,7 +244,8 @@ typedef struct macroblockd { · 80 unmodified lines
266 244
267 245
268 246
269static BLOCK_SIZE get_subsize(BLOCK_SIZE bsize, PARTITION_TYPE partition) {247static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize,
248 PARTITION_TYPE partition) {
270 const BLOCK_SIZE subsize = subsize_lookup[partition][bsize];249 const BLOCK_SIZE subsize = subsize_lookup[partition][bsize];
271 assert(subsize < BLOCK_SIZES);250 assert(subsize < BLOCK_SIZES);
272 return subsize;251 return subsize;
@@ -298,23 +277,9 @@ static INLINE TX_TYPE get_tx_type_16x16(PLANE_TYPE plane_type, · 25 unmodified lines
298 : DCT_DCT;277 : DCT_DCT;
299}278}
300 279
301static void setup_block_dptrs(MACROBLOCKD *xd, int ss_x, int ss_y) {280void vp9_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y);
302 int i;
303
304 for (i = 0; i < MAX_MB_PLANE; i++) {
305 xd->plane[i].plane_type = i ? PLANE_TYPE_UV : PLANE_TYPE_Y;
306 xd->plane[i].subsampling_x = i ? ss_x : 0;
307 xd->plane[i].subsampling_y = i ? ss_y : 0;
308 }
309#if CONFIG_ALPHA
310 // TODO(jkoleszar): Using the Y w/h for now
311 xd->plane[3].plane_type = PLANE_TYPE_Y;
312 xd->plane[3].subsampling_x = 0;
313 xd->plane[3].subsampling_y = 0;
314#endif
315}
316 281
317static TX_SIZE get_uv_tx_size_impl(TX_SIZE y_tx_size, BLOCK_SIZE bsize) {282static INLINE TX_SIZE get_uv_tx_size_impl(TX_SIZE y_tx_size, BLOCK_SIZE bsize) {
318 if (bsize < BLOCK_8X8) {283 if (bsize < BLOCK_8X8) {
319 return TX_4X4;284 return TX_4X4;
320 } else {285 } else {
@@ -324,12 +289,12 @@ static TX_SIZE get_uv_tx_size_impl(TX_SIZE y_tx_size, BLOCK_SIZE bsize) { · 3 unmodified lines
324 }289 }
325}290}
326 291
327static TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi) {292static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi) {
328 return get_uv_tx_size_impl(mbmi->tx_size, mbmi->sb_type);293 return get_uv_tx_size_impl(mbmi->tx_size, mbmi->sb_type);
329}294}
330 295
331static BLOCK_SIZE get_plane_block_size(BLOCK_SIZE bsize,296static INLINE BLOCK_SIZE get_plane_block_size(BLOCK_SIZE bsize,
332 const struct macroblockd_plane *pd) {297 const struct macroblockd_plane *pd) {
333 BLOCK_SIZE bs = ss_size_lookup[bsize][pd->subsampling_x][pd->subsampling_y];298 BLOCK_SIZE bs = ss_size_lookup[bsize][pd->subsampling_x][pd->subsampling_y];
334 assert(bs < BLOCK_SIZES);299 assert(bs < BLOCK_SIZES);
335 return bs;300 return bs;
@@ -340,77 +305,23 @@ typedef void (*foreach_transformed_block_visitor)(int plane, int block, · 4 unmodified lines
340 TX_SIZE tx_size,305 TX_SIZE tx_size,
341 void *arg);306 void *arg);
342 307
343static INLINE void foreach_transformed_block_in_plane(308void vp9_foreach_transformed_block_in_plane(
344 const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,309 const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
345 foreach_transformed_block_visitor visit, void *arg) {310 foreach_transformed_block_visitor visit, void *arg);
346 const struct macroblockd_plane *const pd = &xd->plane[plane];
347 const MB_MODE_INFO* mbmi = &xd->mi_8x8[0]->mbmi;
348 // block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
349 // 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
350 // transform size varies per plane, look it up in a common way.
351 const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi)
352 : mbmi->tx_size;
353 const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
354 const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
355 const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
356 const int step = 1 << (tx_size << 1);
357 int i;
358
359 // If mb_to_right_edge is < 0 we are in a situation in which
360 // the current block size extends into the UMV and we won't
361 // visit the sub blocks that are wholly within the UMV.
362 if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0) {
363 int r, c;
364
365 int max_blocks_wide = num_4x4_w;
366 int max_blocks_high = num_4x4_h;
367
368 // xd->mb_to_right_edge is in units of pixels * 8. This converts
369 // it to 4x4 block sizes.
370 if (xd->mb_to_right_edge < 0)
371 max_blocks_wide += (xd->mb_to_right_edge >> (5 + pd->subsampling_x));
372
373 if (xd->mb_to_bottom_edge < 0)
374 max_blocks_high += (xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
375
376 i = 0;
377 // Unlike the normal case - in here we have to keep track of the
378 // row and column of the blocks we use so that we know if we are in
379 // the unrestricted motion border.
380 for (r = 0; r < num_4x4_h; r += (1 << tx_size)) {
381 for (c = 0; c < num_4x4_w; c += (1 << tx_size)) {
382 if (r < max_blocks_high && c < max_blocks_wide)
383 visit(plane, i, plane_bsize, tx_size, arg);
384 i += step;
385 }
386 }
387 } else {
388 for (i = 0; i < num_4x4_w * num_4x4_h; i += step)
389 visit(plane, i, plane_bsize, tx_size, arg);
390 }
391}
392 311
393static INLINE void foreach_transformed_block(312
313void vp9_foreach_transformed_block(
394 const MACROBLOCKD* const xd, BLOCK_SIZE bsize,314 const MACROBLOCKD* const xd, BLOCK_SIZE bsize,
395 foreach_transformed_block_visitor visit, void *arg) {315 foreach_transformed_block_visitor visit, void *arg);
396 int plane;
397 316
398 for (plane = 0; plane < MAX_MB_PLANE; plane++)
399 foreach_transformed_block_in_plane(xd, bsize, plane, visit, arg);
400}
401 317
402static INLINE void foreach_transformed_block_uv(318void vp9_foreach_transformed_block_uv(
403 const MACROBLOCKD* const xd, BLOCK_SIZE bsize,319 const MACROBLOCKD* const xd, BLOCK_SIZE bsize,
404 foreach_transformed_block_visitor visit, void *arg) {320 foreach_transformed_block_visitor visit, void *arg);
405 int plane;
406
407 for (plane = 1; plane < MAX_MB_PLANE; plane++)
408 foreach_transformed_block_in_plane(xd, bsize, plane, visit, arg);
409}
410 321
411static void txfrm_block_to_raster_xy(BLOCK_SIZE plane_bsize,322static INLINE void txfrm_block_to_raster_xy(BLOCK_SIZE plane_bsize,
412 TX_SIZE tx_size, int block,323 TX_SIZE tx_size, int block,
413 int *x, int *y) {324 int *x, int *y) {
414 const int bwl = b_width_log2(plane_bsize);325 const int bwl = b_width_log2(plane_bsize);
415 const int tx_cols_log2 = bwl - tx_size;326 const int tx_cols_log2 = bwl - tx_size;
416 const int tx_cols = 1 << tx_cols_log2;327 const int tx_cols = 1 << tx_cols_log2;
@@ -419,50 +330,13 @@ static void txfrm_block_to_raster_xy(BLOCK_SIZE plane_bsize, · 2 unmodified lines
419 *y = (raster_mb >> tx_cols_log2) << tx_size;330 *y = (raster_mb >> tx_cols_log2) << tx_size;
420}331}
421 332
422static void set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,333void vp9_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
423 BLOCK_SIZE plane_bsize, TX_SIZE tx_size,334 BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob,
424 int has_eob, int aoff, int loff) {335 int aoff, int loff);
425 ENTROPY_CONTEXT *const a = pd->above_context + aoff;
426 ENTROPY_CONTEXT *const l = pd->left_context + loff;
427 const int tx_size_in_blocks = 1 << tx_size;
428
429 // above
430 if (has_eob && xd->mb_to_right_edge < 0) {
431 int i;
432 const int blocks_wide = num_4x4_blocks_wide_lookup[plane_bsize] +
433 (xd->mb_to_right_edge >> (5 + pd->subsampling_x));
434 int above_contexts = tx_size_in_blocks;
435 if (above_contexts + aoff > blocks_wide)
436 above_contexts = blocks_wide - aoff;
437
438 for (i = 0; i < above_contexts; ++i)
439 a[i] = has_eob;
440 for (i = above_contexts; i < tx_size_in_blocks; ++i)
441 a[i] = 0;
442 } else {
443 vpx_memset(a, has_eob, sizeof(ENTROPY_CONTEXT) * tx_size_in_blocks);
444 }
445 336
446 // left
447 if (has_eob && xd->mb_to_bottom_edge < 0) {
448 int i;
449 const int blocks_high = num_4x4_blocks_high_lookup[plane_bsize] +
450 (xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
451 int left_contexts = tx_size_in_blocks;
452 if (left_contexts + loff > blocks_high)
453 left_contexts = blocks_high - loff;
454
455 for (i = 0; i < left_contexts; ++i)
456 l[i] = has_eob;
457 for (i = left_contexts; i < tx_size_in_blocks; ++i)
458 l[i] = 0;
459 } else {
460 vpx_memset(l, has_eob, sizeof(ENTROPY_CONTEXT) * tx_size_in_blocks);
461 }
462}
463 337
464static int get_tx_eob(const struct segmentation *seg, int segment_id,338static INLINE int get_tx_eob(const struct segmentation *seg, int segment_id,
465 TX_SIZE tx_size) {339 TX_SIZE tx_size) {
466 const int eob_max = 16 << (tx_size << 1);340 const int eob_max = 16 << (tx_size << 1);
467 return vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP) ? 0 : eob_max;341 return vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP) ? 0 : eob_max;
468}342}
vp9/decoder/vp9_decodeframe.c+4−4
@@ -407,8 +407,8 @@ static void decode_modes_b(VP9_COMMON *const cm, MACROBLOCKD *const xd, · 406 unmodified lines
407 407
408 if (!is_inter_block(mbmi)) {408 if (!is_inter_block(mbmi)) {
409 struct intra_args arg = { cm, xd, r };409 struct intra_args arg = { cm, xd, r };
410 foreach_transformed_block(xd, bsize, predict_and_reconstruct_intra_block,410 vp9_foreach_transformed_block(xd, bsize,
411 &arg);411 predict_and_reconstruct_intra_block, &arg);
412 } else {412 } else {
413 // Setup413 // Setup
414 set_ref(cm, xd, 0, mi_row, mi_col);414 set_ref(cm, xd, 0, mi_row, mi_col);
@@ -424,7 +424,7 @@ static void decode_modes_b(VP9_COMMON *const cm, MACROBLOCKD *const xd, · 9 unmodified lines
424 if (!mbmi->skip_coeff) {424 if (!mbmi->skip_coeff) {
425 int eobtotal = 0;425 int eobtotal = 0;
426 struct inter_args arg = { cm, xd, r, &eobtotal };426 struct inter_args arg = { cm, xd, r, &eobtotal };
427 foreach_transformed_block(xd, bsize, reconstruct_inter_block, &arg);427 vp9_foreach_transformed_block(xd, bsize, reconstruct_inter_block, &arg);
428 if (!less8x8 && eobtotal == 0)428 if (!less8x8 && eobtotal == 0)
429 mbmi->skip_coeff = 1; // skip loopfilter429 mbmi->skip_coeff = 1; // skip loopfilter
430 }430 }
@@ -1371,7 +1371,7 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) { · 940 unmodified lines
1371 set_prev_mi(cm);1371 set_prev_mi(cm);
1372 1372
1373 setup_plane_dequants(cm, xd, cm->base_qindex);1373 setup_plane_dequants(cm, xd, cm->base_qindex);
1374 setup_block_dptrs(xd, cm->subsampling_x, cm->subsampling_y);1374 vp9_setup_block_planes(xd, cm->subsampling_x, cm->subsampling_y);
1375 1375
1376 cm->fc = cm->frame_contexts[cm->frame_context_idx];1376 cm->fc = cm->frame_contexts[cm->frame_context_idx];
1377 vp9_zero(cm->counts);1377 vp9_zero(cm->counts);
vp9/decoder/vp9_decodemv.c+4−4
@@ -175,8 +175,8 @@ static void read_intra_frame_mode_info(VP9_COMMON *const cm, · 174 unmodified lines
175 mbmi->ref_frame[1] = NONE;175 mbmi->ref_frame[1] = NONE;
176 176
177 if (bsize >= BLOCK_8X8) {177 if (bsize >= BLOCK_8X8) {
178 const MB_PREDICTION_MODE A = above_block_mode(mi, above_mi, 0);178 const MB_PREDICTION_MODE A = vp9_above_block_mode(mi, above_mi, 0);
179 const MB_PREDICTION_MODE L = left_block_mode(mi, left_mi, 0);179 const MB_PREDICTION_MODE L = vp9_left_block_mode(mi, left_mi, 0);
180 mbmi->mode = read_intra_mode(r, vp9_kf_y_mode_prob[A][L]);180 mbmi->mode = read_intra_mode(r, vp9_kf_y_mode_prob[A][L]);
181 } else {181 } else {
182 // Only 4x4, 4x8, 8x4 blocks182 // Only 4x4, 4x8, 8x4 blocks
@@ -187,8 +187,8 @@ static void read_intra_frame_mode_info(VP9_COMMON *const cm, · 4 unmodified lines
187 for (idy = 0; idy < 2; idy += num_4x4_h) {187 for (idy = 0; idy < 2; idy += num_4x4_h) {
188 for (idx = 0; idx < 2; idx += num_4x4_w) {188 for (idx = 0; idx < 2; idx += num_4x4_w) {
189 const int ib = idy * 2 + idx;189 const int ib = idy * 2 + idx;
190 const MB_PREDICTION_MODE A = above_block_mode(mi, above_mi, ib);190 const MB_PREDICTION_MODE A = vp9_above_block_mode(mi, above_mi, ib);
191 const MB_PREDICTION_MODE L = left_block_mode(mi, left_mi, ib);191 const MB_PREDICTION_MODE L = vp9_left_block_mode(mi, left_mi, ib);
192 const MB_PREDICTION_MODE b_mode = read_intra_mode(r,192 const MB_PREDICTION_MODE b_mode = read_intra_mode(r,
193 vp9_kf_y_mode_prob[A][L]);193 vp9_kf_y_mode_prob[A][L]);
194 mi->bmi[ib].as_mode = b_mode;194 mi->bmi[ib].as_mode = b_mode;
vp9/decoder/vp9_detokenize.c+1−1
@@ -204,7 +204,7 @@ int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd, · 203 unmodified lines
204 const int eob = decode_coefs(cm, xd, pd->plane_type,204 const int eob = decode_coefs(cm, xd, pd->plane_type,
205 BLOCK_OFFSET(pd->dqcoeff, block), tx_size,205 BLOCK_OFFSET(pd->dqcoeff, block), tx_size,
206 pd->dequant, ctx, so->scan, so->neighbors, r);206 pd->dequant, ctx, so->scan, so->neighbors, r);
207 set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y);207 vp9_set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y);
208 return eob;208 return eob;
209}209}
210 210
vp9/encoder/vp9_bitstream.c+4−4
@@ -393,8 +393,8 @@ static void write_mb_modes_kf(const VP9_COMP *cpi, MODE_INFO **mi_8x8, · 392 unmodified lines
393 write_selected_tx_size(cpi, m, m->mbmi.tx_size, m->mbmi.sb_type, bc);393 write_selected_tx_size(cpi, m, m->mbmi.tx_size, m->mbmi.sb_type, bc);
394 394
395 if (m->mbmi.sb_type >= BLOCK_8X8) {395 if (m->mbmi.sb_type >= BLOCK_8X8) {
396 const MB_PREDICTION_MODE A = above_block_mode(m, above_mi, 0);396 const MB_PREDICTION_MODE A = vp9_above_block_mode(m, above_mi, 0);
397 const MB_PREDICTION_MODE L = left_block_mode(m, left_mi, 0);397 const MB_PREDICTION_MODE L = vp9_left_block_mode(m, left_mi, 0);
398 write_intra_mode(bc, ym, vp9_kf_y_mode_prob[A][L]);398 write_intra_mode(bc, ym, vp9_kf_y_mode_prob[A][L]);
399 } else {399 } else {
400 int idx, idy;400 int idx, idy;
@@ -403,8 +403,8 @@ static void write_mb_modes_kf(const VP9_COMP *cpi, MODE_INFO **mi_8x8, · 2 unmodified lines
403 for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {403 for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
404 for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {404 for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
405 int i = idy * 2 + idx;405 int i = idy * 2 + idx;
406 const MB_PREDICTION_MODE A = above_block_mode(m, above_mi, i);406 const MB_PREDICTION_MODE A = vp9_above_block_mode(m, above_mi, i);
407 const MB_PREDICTION_MODE L = left_block_mode(m, left_mi, i);407 const MB_PREDICTION_MODE L = vp9_left_block_mode(m, left_mi, i);
408 const int bm = m->bmi[i].as_mode;408 const int bm = m->bmi[i].as_mode;
409 write_intra_mode(bc, bm, vp9_kf_y_mode_prob[A][L]);409 write_intra_mode(bc, bm, vp9_kf_y_mode_prob[A][L]);
410 }410 }
vp9/encoder/vp9_encodeframe.c+1−1
@@ -2142,7 +2142,7 @@ static void init_encode_frame_mb_context(VP9_COMP *cpi) { · 2141 unmodified lines
2142 setup_pre_planes(xd, 0, get_ref_frame_buffer(cpi, LAST_FRAME), 0, 0, NULL);2142 setup_pre_planes(xd, 0, get_ref_frame_buffer(cpi, LAST_FRAME), 0, 0, NULL);
2143 setup_dst_planes(xd, get_frame_new_buffer(cm), 0, 0);2143 setup_dst_planes(xd, get_frame_new_buffer(cm), 0, 0);
2144 2144
2145 setup_block_dptrs(&x->e_mbd, cm->subsampling_x, cm->subsampling_y);2145 vp9_setup_block_planes(&x->e_mbd, cm->subsampling_x, cm->subsampling_y);
2146 2146
2147 xd->mi_8x8[0]->mbmi.mode = DC_PRED;2147 xd->mi_8x8[0]->mbmi.mode = DC_PRED;
2148 xd->mi_8x8[0]->mbmi.uv_mode = DC_PRED;2148 xd->mi_8x8[0]->mbmi.uv_mode = DC_PRED;
vp9/encoder/vp9_encodemb.c+5−4
@@ -487,7 +487,8 @@ void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE bsize) { · 486 unmodified lines
487 if (x->optimize)487 if (x->optimize)
488 optimize_init_b(0, bsize, &arg);488 optimize_init_b(0, bsize, &arg);
489 489
490 foreach_transformed_block_in_plane(xd, bsize, 0, encode_block_pass1, &arg);490 vp9_foreach_transformed_block_in_plane(xd, bsize, 0, encode_block_pass1,
491 &arg);
491}492}
492 493
493void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {494void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
@@ -505,7 +506,7 @@ void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) { · 11 unmodified lines
505 optimize_init_b(i, bsize, &arg);506 optimize_init_b(i, bsize, &arg);
506 }507 }
507 508
508 foreach_transformed_block(xd, bsize, encode_block, &arg);509 vp9_foreach_transformed_block(xd, bsize, encode_block, &arg);
509}510}
510 511
511void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,512void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
@@ -648,7 +649,7 @@ void vp9_encode_intra_block_y(MACROBLOCK *x, BLOCK_SIZE bsize) { · 136 unmodified lines
648 MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;649 MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
649 struct encode_b_args arg = {x, &ctx, &mbmi->skip_coeff};650 struct encode_b_args arg = {x, &ctx, &mbmi->skip_coeff};
650 651
651 foreach_transformed_block_in_plane(xd, bsize, 0, vp9_encode_block_intra,652 vp9_foreach_transformed_block_in_plane(xd, bsize, 0, vp9_encode_block_intra,
652 &arg);653 &arg);
653}654}
654void vp9_encode_intra_block_uv(MACROBLOCK *x, BLOCK_SIZE bsize) {655void vp9_encode_intra_block_uv(MACROBLOCK *x, BLOCK_SIZE bsize) {
@@ -656,7 +657,7 @@ void vp9_encode_intra_block_uv(MACROBLOCK *x, BLOCK_SIZE bsize) { · 1 unmodified line
656 struct optimize_ctx ctx;657 struct optimize_ctx ctx;
657 MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;658 MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
658 struct encode_b_args arg = {x, &ctx, &mbmi->skip_coeff};659 struct encode_b_args arg = {x, &ctx, &mbmi->skip_coeff};
659 foreach_transformed_block_uv(xd, bsize, vp9_encode_block_intra, &arg);660 vp9_foreach_transformed_block_uv(xd, bsize, vp9_encode_block_intra, &arg);
660}661}
661 662
662int vp9_encode_intra(MACROBLOCK *x, int use_16x16_pred) {663int vp9_encode_intra(MACROBLOCK *x, int use_16x16_pred) {
vp9/encoder/vp9_firstpass.c+1−1
@@ -505,7 +505,7 @@ void vp9_first_pass(VP9_COMP *cpi) { · 504 unmodified lines
505 xd->mi_8x8 = cm->mi_grid_visible;505 xd->mi_8x8 = cm->mi_grid_visible;
506 xd->mi_8x8[0] = cm->mi; // required for vp9_frame_init_quantizer506 xd->mi_8x8[0] = cm->mi; // required for vp9_frame_init_quantizer
507 507
508 setup_block_dptrs(&x->e_mbd, cm->subsampling_x, cm->subsampling_y);508 vp9_setup_block_planes(&x->e_mbd, cm->subsampling_x, cm->subsampling_y);
509 509
510 vp9_frame_init_quantizer(cpi);510 vp9_frame_init_quantizer(cpi);
511 511
vp9/encoder/vp9_rdopt.c+6−6
@@ -742,8 +742,8 @@ static void txfm_rd_in_plane(MACROBLOCK *x, · 741 unmodified lines
742 rd_stack.scan = so->scan;742 rd_stack.scan = so->scan;
743 rd_stack.nb = so->neighbors;743 rd_stack.nb = so->neighbors;
744 744
745 foreach_transformed_block_in_plane(xd, bsize, plane,745 vp9_foreach_transformed_block_in_plane(xd, bsize, plane,
746 block_rd_txfm, &rd_stack);746 block_rd_txfm, &rd_stack);
747 if (rd_stack.skip) {747 if (rd_stack.skip) {
748 *rate = INT_MAX;748 *rate = INT_MAX;
749 *distortion = INT64_MAX;749 *distortion = INT64_MAX;
@@ -1150,8 +1150,8 @@ static int64_t rd_pick_intra_sub_8x8_y_mode(VP9_COMP * const cpi, · 400 unmodified lines
1150 int64_t d = INT64_MAX, this_rd = INT64_MAX;1150 int64_t d = INT64_MAX, this_rd = INT64_MAX;
1151 i = idy * 2 + idx;1151 i = idy * 2 + idx;
1152 if (cpi->common.frame_type == KEY_FRAME) {1152 if (cpi->common.frame_type == KEY_FRAME) {
1153 const MB_PREDICTION_MODE A = above_block_mode(mic, above_mi, i);1153 const MB_PREDICTION_MODE A = vp9_above_block_mode(mic, above_mi, i);
1154 const MB_PREDICTION_MODE L = left_block_mode(mic, left_mi, i);1154 const MB_PREDICTION_MODE L = vp9_left_block_mode(mic, left_mi, i);
1155 1155
1156 bmode_costs = mb->y_mode_costs[A][L];1156 bmode_costs = mb->y_mode_costs[A][L];
1157 }1157 }
@@ -1216,8 +1216,8 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x, · 58 unmodified lines
1216 continue;1216 continue;
1217 1217
1218 if (cpi->common.frame_type == KEY_FRAME) {1218 if (cpi->common.frame_type == KEY_FRAME) {
1219 const MB_PREDICTION_MODE A = above_block_mode(mic, above_mi, 0);1219 const MB_PREDICTION_MODE A = vp9_above_block_mode(mic, above_mi, 0);
1220 const MB_PREDICTION_MODE L = left_block_mode(mic, left_mi, 0);1220 const MB_PREDICTION_MODE L = vp9_left_block_mode(mic, left_mi, 0);
1221 1221
1222 bmode_costs = x->y_mode_costs[A][L];1222 bmode_costs = x->y_mode_costs[A][L];
1223 }1223 }
vp9/encoder/vp9_tokenize.c+8−7
@@ -172,7 +172,8 @@ static void set_entropy_context_b(int plane, int block, BLOCK_SIZE plane_bsize, · 171 unmodified lines
172 struct macroblockd_plane *pd = &xd->plane[plane];172 struct macroblockd_plane *pd = &xd->plane[plane];
173 int aoff, loff;173 int aoff, loff;
174 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff);174 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff);
175 set_contexts(xd, pd, plane_bsize, tx_size, p->eobs[block] > 0, aoff, loff);175 vp9_set_contexts(xd, pd, plane_bsize, tx_size, p->eobs[block] > 0,
176 aoff, loff);
176}177}
177 178
178static INLINE void add_token(TOKENEXTRA **t, const vp9_prob *context_tree,179static INLINE void add_token(TOKENEXTRA **t, const vp9_prob *context_tree,
@@ -259,7 +260,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize, · 80 unmodified lines
259 260
260 *tp = t;261 *tp = t;
261 262
262 set_contexts(xd, pd, plane_bsize, tx_size, c > 0, aoff, loff);263 vp9_set_contexts(xd, pd, plane_bsize, tx_size, c > 0, aoff, loff);
263}264}
264 265
265struct is_skippable_args {266struct is_skippable_args {
@@ -277,15 +278,15 @@ static void is_skippable(int plane, int block, · 11 unmodified lines
277static int sb_is_skippable(MACROBLOCK *x, BLOCK_SIZE bsize) {278static int sb_is_skippable(MACROBLOCK *x, BLOCK_SIZE bsize) {
278 int result = 1;279 int result = 1;
279 struct is_skippable_args args = {x, &result};280 struct is_skippable_args args = {x, &result};
280 foreach_transformed_block(&x->e_mbd, bsize, is_skippable, &args);281 vp9_foreach_transformed_block(&x->e_mbd, bsize, is_skippable, &args);
281 return result;282 return result;
282}283}
283 284
284int vp9_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {285int vp9_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
285 int result = 1;286 int result = 1;
286 struct is_skippable_args args = {x, &result};287 struct is_skippable_args args = {x, &result};
287 foreach_transformed_block_in_plane(&x->e_mbd, bsize, plane, is_skippable,288 vp9_foreach_transformed_block_in_plane(&x->e_mbd, bsize, plane, is_skippable,
288 &args);289 &args);
289 return result;290 return result;
290}291}
291 292
@@ -310,9 +311,9 @@ void vp9_tokenize_sb(VP9_COMP *cpi, TOKENEXTRA **t, int dry_run, · 18 unmodified lines
310 311
311 if (!dry_run) {312 if (!dry_run) {
312 cm->counts.skip[ctx][0] += skip_inc;313 cm->counts.skip[ctx][0] += skip_inc;
313 foreach_transformed_block(xd, bsize, tokenize_b, &arg);314 vp9_foreach_transformed_block(xd, bsize, tokenize_b, &arg);
314 } else {315 } else {
315 foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg);316 vp9_foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg);
316 *t = t_backup;317 *t = t_backup;
317 }318 }
318}319}
vp9/vp9_common.mk+1−0
@@ -14,6 +14,7 @@ VP9_COMMON_SRCS-yes += common/vp9_pragmas.h · 13 unmodified lines
14VP9_COMMON_SRCS-yes += common/vp9_ppflags.h14VP9_COMMON_SRCS-yes += common/vp9_ppflags.h
15VP9_COMMON_SRCS-yes += common/vp9_onyx.h15VP9_COMMON_SRCS-yes += common/vp9_onyx.h
16VP9_COMMON_SRCS-yes += common/vp9_alloccommon.c16VP9_COMMON_SRCS-yes += common/vp9_alloccommon.c
17VP9_COMMON_SRCS-yes += common/vp9_blockd.c
17VP9_COMMON_SRCS-yes += common/vp9_convolve.c18VP9_COMMON_SRCS-yes += common/vp9_convolve.c
18VP9_COMMON_SRCS-yes += common/vp9_convolve.h19VP9_COMMON_SRCS-yes += common/vp9_convolve.h
19VP9_COMMON_SRCS-yes += common/vp9_debugmodes.c20VP9_COMMON_SRCS-yes += common/vp9_debugmodes.c

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t