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+
13+MB_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+
27+MB_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+
41+void 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+
91+void 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+
101+void 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+
111+void 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+
153+void 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
153153 return mbmi->ref_frame[1] > INTRA_FRAME;
154154 }
155155
156−static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mi,
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−}
156+MB_PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi,
157+ const MODE_INFO *left_mi, int b);
169158
170−static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mi,
171− 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−}
159+MB_PREDICTION_MODE vp9_above_block_mode(const MODE_INFO *cur_mi,
160+ const MODE_INFO *above_mi, int b);
183161
184162 enum mv_precision {
185163 MV_PRECISION_Q3,
@@ -266,7 +244,8 @@ typedef struct macroblockd { · 80 unmodified lines
266244
267245
268246
269−static BLOCK_SIZE get_subsize(BLOCK_SIZE bsize, PARTITION_TYPE partition) {
247+static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize,
248+ PARTITION_TYPE partition) {
270249 const BLOCK_SIZE subsize = subsize_lookup[partition][bsize];
271250 assert(subsize < BLOCK_SIZES);
272251 return subsize;
@@ -298,23 +277,9 @@ static INLINE TX_TYPE get_tx_type_16x16(PLANE_TYPE plane_type, · 25 unmodified lines
298277 : DCT_DCT;
299278 }
300279
301−static void setup_block_dptrs(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−}
280+void vp9_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y);
316281
317−static TX_SIZE get_uv_tx_size_impl(TX_SIZE y_tx_size, BLOCK_SIZE bsize) {
282+static INLINE TX_SIZE get_uv_tx_size_impl(TX_SIZE y_tx_size, BLOCK_SIZE bsize) {
318283 if (bsize < BLOCK_8X8) {
319284 return TX_4X4;
320285 } else {
@@ -324,12 +289,12 @@ static TX_SIZE get_uv_tx_size_impl(TX_SIZE y_tx_size, BLOCK_SIZE bsize) { · 3 unmodified lines
324289 }
325290 }
326291
327−static TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi) {
292+static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi) {
328293 return get_uv_tx_size_impl(mbmi->tx_size, mbmi->sb_type);
329294 }
330295
331−static BLOCK_SIZE get_plane_block_size(BLOCK_SIZE bsize,
332− const struct macroblockd_plane *pd) {
296+static INLINE BLOCK_SIZE get_plane_block_size(BLOCK_SIZE bsize,
297+ const struct macroblockd_plane *pd) {
333298 BLOCK_SIZE bs = ss_size_lookup[bsize][pd->subsampling_x][pd->subsampling_y];
334299 assert(bs < BLOCK_SIZES);
335300 return bs;
@@ -340,77 +305,23 @@ typedef void (*foreach_transformed_block_visitor)(int plane, int block, · 4 unmodified lines
340305 TX_SIZE tx_size,
341306 void *arg);
342307
343−static INLINE void foreach_transformed_block_in_plane(
308+void vp9_foreach_transformed_block_in_plane(
344309 const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
345− 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−}
310+ foreach_transformed_block_visitor visit, void *arg);
392311
393−static INLINE void foreach_transformed_block(
312+
313+void vp9_foreach_transformed_block(
394314 const MACROBLOCKD* const xd, BLOCK_SIZE bsize,
395− foreach_transformed_block_visitor visit, void *arg) {
396− int plane;
315+ foreach_transformed_block_visitor visit, void *arg);
397316
398− for (plane = 0; plane < MAX_MB_PLANE; plane++)
399− foreach_transformed_block_in_plane(xd, bsize, plane, visit, arg);
400−}
401317
402−static INLINE void foreach_transformed_block_uv(
318+void vp9_foreach_transformed_block_uv(
403319 const MACROBLOCKD* const xd, BLOCK_SIZE bsize,
404− 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−}
320+ foreach_transformed_block_visitor visit, void *arg);
410321
411−static void txfrm_block_to_raster_xy(BLOCK_SIZE plane_bsize,
412− TX_SIZE tx_size, int block,
413− int *x, int *y) {
322+static INLINE void txfrm_block_to_raster_xy(BLOCK_SIZE plane_bsize,
323+ TX_SIZE tx_size, int block,
324+ int *x, int *y) {
414325 const int bwl = b_width_log2(plane_bsize);
415326 const int tx_cols_log2 = bwl - tx_size;
416327 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
419330 *y = (raster_mb >> tx_cols_log2) << tx_size;
420331 }
421332
422−static void set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
423− BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
424− int has_eob, 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− }
333+void vp9_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
334+ BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob,
335+ int aoff, int loff);
445336
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−}
463337
464−static int get_tx_eob(const struct segmentation *seg, int segment_id,
465− TX_SIZE tx_size) {
338+static INLINE int get_tx_eob(const struct segmentation *seg, int segment_id,
339+ TX_SIZE tx_size) {
466340 const int eob_max = 16 << (tx_size << 1);
467341 return vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP) ? 0 : eob_max;
468342 }
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
407407
408408 if (!is_inter_block(mbmi)) {
409409 struct intra_args arg = { cm, xd, r };
410− foreach_transformed_block(xd, bsize, predict_and_reconstruct_intra_block,
411− &arg);
410+ vp9_foreach_transformed_block(xd, bsize,
411+ predict_and_reconstruct_intra_block, &arg);
412412 } else {
413413 // Setup
414414 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
424424 if (!mbmi->skip_coeff) {
425425 int eobtotal = 0;
426426 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);
428428 if (!less8x8 && eobtotal == 0)
429429 mbmi->skip_coeff = 1; // skip loopfilter
430430 }
@@ -1371,7 +1371,7 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) { · 940 unmodified lines
13711371 set_prev_mi(cm);
13721372
13731373 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);
13751375
13761376 cm->fc = cm->frame_contexts[cm->frame_context_idx];
13771377 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
175175 mbmi->ref_frame[1] = NONE;
176176
177177 if (bsize >= BLOCK_8X8) {
178− const MB_PREDICTION_MODE A = above_block_mode(mi, above_mi, 0);
179− const MB_PREDICTION_MODE L = left_block_mode(mi, left_mi, 0);
178+ const MB_PREDICTION_MODE A = vp9_above_block_mode(mi, above_mi, 0);
179+ const MB_PREDICTION_MODE L = vp9_left_block_mode(mi, left_mi, 0);
180180 mbmi->mode = read_intra_mode(r, vp9_kf_y_mode_prob[A][L]);
181181 } else {
182182 // Only 4x4, 4x8, 8x4 blocks
@@ -187,8 +187,8 @@ static void read_intra_frame_mode_info(VP9_COMMON *const cm, · 4 unmodified lines
187187 for (idy = 0; idy < 2; idy += num_4x4_h) {
188188 for (idx = 0; idx < 2; idx += num_4x4_w) {
189189 const int ib = idy * 2 + idx;
190− const MB_PREDICTION_MODE A = above_block_mode(mi, above_mi, ib);
191− const MB_PREDICTION_MODE L = left_block_mode(mi, left_mi, ib);
190+ const MB_PREDICTION_MODE A = vp9_above_block_mode(mi, above_mi, ib);
191+ const MB_PREDICTION_MODE L = vp9_left_block_mode(mi, left_mi, ib);
192192 const MB_PREDICTION_MODE b_mode = read_intra_mode(r,
193193 vp9_kf_y_mode_prob[A][L]);
194194 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
204204 const int eob = decode_coefs(cm, xd, pd->plane_type,
205205 BLOCK_OFFSET(pd->dqcoeff, block), tx_size,
206206 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);
208208 return eob;
209209 }
210210
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
393393 write_selected_tx_size(cpi, m, m->mbmi.tx_size, m->mbmi.sb_type, bc);
394394
395395 if (m->mbmi.sb_type >= BLOCK_8X8) {
396− const MB_PREDICTION_MODE A = above_block_mode(m, above_mi, 0);
397− const MB_PREDICTION_MODE L = left_block_mode(m, left_mi, 0);
396+ const MB_PREDICTION_MODE A = vp9_above_block_mode(m, above_mi, 0);
397+ const MB_PREDICTION_MODE L = vp9_left_block_mode(m, left_mi, 0);
398398 write_intra_mode(bc, ym, vp9_kf_y_mode_prob[A][L]);
399399 } else {
400400 int idx, idy;
@@ -403,8 +403,8 @@ static void write_mb_modes_kf(const VP9_COMP *cpi, MODE_INFO **mi_8x8, · 2 unmodified lines
403403 for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
404404 for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
405405 int i = idy * 2 + idx;
406− const MB_PREDICTION_MODE A = above_block_mode(m, above_mi, i);
407− const MB_PREDICTION_MODE L = left_block_mode(m, left_mi, i);
406+ const MB_PREDICTION_MODE A = vp9_above_block_mode(m, above_mi, i);
407+ const MB_PREDICTION_MODE L = vp9_left_block_mode(m, left_mi, i);
408408 const int bm = m->bmi[i].as_mode;
409409 write_intra_mode(bc, bm, vp9_kf_y_mode_prob[A][L]);
410410 }
vp9/encoder/vp9_encodeframe.c+1−1
@@ -2142,7 +2142,7 @@ static void init_encode_frame_mb_context(VP9_COMP *cpi) { · 2141 unmodified lines
21422142 setup_pre_planes(xd, 0, get_ref_frame_buffer(cpi, LAST_FRAME), 0, 0, NULL);
21432143 setup_dst_planes(xd, get_frame_new_buffer(cm), 0, 0);
21442144
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);
21462146
21472147 xd->mi_8x8[0]->mbmi.mode = DC_PRED;
21482148 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
487487 if (x->optimize)
488488 optimize_init_b(0, bsize, &arg);
489489
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);
491492 }
492493
493494 void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
@@ -505,7 +506,7 @@ void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) { · 11 unmodified lines
505506 optimize_init_b(i, bsize, &arg);
506507 }
507508
508− foreach_transformed_block(xd, bsize, encode_block, &arg);
509+ vp9_foreach_transformed_block(xd, bsize, encode_block, &arg);
509510 }
510511
511512 void 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
648649 MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
649650 struct encode_b_args arg = {x, &ctx, &mbmi->skip_coeff};
650651
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,
652653 &arg);
653654 }
654655 void 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
656657 struct optimize_ctx ctx;
657658 MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
658659 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);
660661 }
661662
662663 int 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
505505 xd->mi_8x8 = cm->mi_grid_visible;
506506 xd->mi_8x8[0] = cm->mi; // required for vp9_frame_init_quantizer
507507
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);
509509
510510 vp9_frame_init_quantizer(cpi);
511511
vp9/encoder/vp9_rdopt.c+6−6
@@ -742,8 +742,8 @@ static void txfm_rd_in_plane(MACROBLOCK *x, · 741 unmodified lines
742742 rd_stack.scan = so->scan;
743743 rd_stack.nb = so->neighbors;
744744
745− foreach_transformed_block_in_plane(xd, bsize, plane,
746− block_rd_txfm, &rd_stack);
745+ vp9_foreach_transformed_block_in_plane(xd, bsize, plane,
746+ block_rd_txfm, &rd_stack);
747747 if (rd_stack.skip) {
748748 *rate = INT_MAX;
749749 *distortion = INT64_MAX;
@@ -1150,8 +1150,8 @@ static int64_t rd_pick_intra_sub_8x8_y_mode(VP9_COMP * const cpi, · 400 unmodified lines
11501150 int64_t d = INT64_MAX, this_rd = INT64_MAX;
11511151 i = idy * 2 + idx;
11521152 if (cpi->common.frame_type == KEY_FRAME) {
1153− const MB_PREDICTION_MODE A = above_block_mode(mic, above_mi, i);
1154− const MB_PREDICTION_MODE L = left_block_mode(mic, left_mi, i);
1153+ const MB_PREDICTION_MODE A = vp9_above_block_mode(mic, above_mi, i);
1154+ const MB_PREDICTION_MODE L = vp9_left_block_mode(mic, left_mi, i);
11551155
11561156 bmode_costs = mb->y_mode_costs[A][L];
11571157 }
@@ -1216,8 +1216,8 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x, · 58 unmodified lines
12161216 continue;
12171217
12181218 if (cpi->common.frame_type == KEY_FRAME) {
1219− const MB_PREDICTION_MODE A = above_block_mode(mic, above_mi, 0);
1220− const MB_PREDICTION_MODE L = left_block_mode(mic, left_mi, 0);
1219+ const MB_PREDICTION_MODE A = vp9_above_block_mode(mic, above_mi, 0);
1220+ const MB_PREDICTION_MODE L = vp9_left_block_mode(mic, left_mi, 0);
12211221
12221222 bmode_costs = x->y_mode_costs[A][L];
12231223 }
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
172172 struct macroblockd_plane *pd = &xd->plane[plane];
173173 int aoff, loff;
174174 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);
176177 }
177178
178179 static 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
259260
260261 *tp = t;
261262
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);
263264 }
264265
265266 struct is_skippable_args {
@@ -277,15 +278,15 @@ static void is_skippable(int plane, int block, · 11 unmodified lines
277278 static int sb_is_skippable(MACROBLOCK *x, BLOCK_SIZE bsize) {
278279 int result = 1;
279280 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);
281282 return result;
282283 }
283284
284285 int vp9_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
285286 int result = 1;
286287 struct is_skippable_args args = {x, &result};
287− foreach_transformed_block_in_plane(&x->e_mbd, bsize, plane, is_skippable,
288− &args);
288+ vp9_foreach_transformed_block_in_plane(&x->e_mbd, bsize, plane, is_skippable,
289+ &args);
289290 return result;
290291 }
291292
@@ -310,9 +311,9 @@ void vp9_tokenize_sb(VP9_COMP *cpi, TOKENEXTRA **t, int dry_run, · 18 unmodified lines
310311
311312 if (!dry_run) {
312313 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);
314315 } else {
315− foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg);
316+ vp9_foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg);
316317 *t = t_backup;
317318 }
318319 }
vp9/vp9_common.mk+1−0
@@ -14,6 +14,7 @@ VP9_COMMON_SRCS-yes += common/vp9_pragmas.h · 13 unmodified lines
1414 VP9_COMMON_SRCS-yes += common/vp9_ppflags.h
1515 VP9_COMMON_SRCS-yes += common/vp9_onyx.h
1616 VP9_COMMON_SRCS-yes += common/vp9_alloccommon.c
17+VP9_COMMON_SRCS-yes += common/vp9_blockd.c
1718 VP9_COMMON_SRCS-yes += common/vp9_convolve.c
1819 VP9_COMMON_SRCS-yes += common/vp9_convolve.h
1920 VP9_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