History

Use explicit block position in foreach_transformed_block

Add the row and column index to the argument list of unit functions called by foreach_transformed_block wrapper. This avoids the repeated internal parsing according to the block index.

Jingning Han committed 11 years ago

Commit caeb10b1 parent f4af1a96 files · +73 −79Browse files

Unified · Split

6 files
  1. vp10/common/blockd.c +1 −1
  2. vp10/common/blockd.h +1 −11
  3. vp10/encoder/encodemb.c +34 −37
  4. vp10/encoder/encodemb.h +9 −5
  5. vp10/encoder/rdopt.c +13 −12
  6. vp10/encoder/tokenize.c +15 −13
vp10/common/blockd.c+1−1
@@ -66,7 +66,7 @@ void vp10_foreach_transformed_block_in_plane( · 65 unmodified lines
66 for (r = 0; r < max_blocks_high; r += (1 << tx_size)) {66 for (r = 0; r < max_blocks_high; r += (1 << tx_size)) {
67 // Skip visiting the sub blocks that are wholly within the UMV.67 // Skip visiting the sub blocks that are wholly within the UMV.
68 for (c = 0; c < max_blocks_wide; c += (1 << tx_size)) {68 for (c = 0; c < max_blocks_wide; c += (1 << tx_size)) {
69 visit(plane, i, plane_bsize, tx_size, arg);69 visit(plane, i, r, c, plane_bsize, tx_size, arg);
70 i += step;70 i += step;
71 }71 }
72 i += extra_step;72 i += extra_step;
vp10/common/blockd.h+1−11
@@ -283,6 +283,7 @@ static INLINE void reset_skip_context(MACROBLOCKD *xd, BLOCK_SIZE bsize) { · 282 unmodified lines
283}283}
284 284
285typedef void (*foreach_transformed_block_visitor)(int plane, int block,285typedef void (*foreach_transformed_block_visitor)(int plane, int block,
286 int blk_row, int blk_col,
286 BLOCK_SIZE plane_bsize,287 BLOCK_SIZE plane_bsize,
287 TX_SIZE tx_size,288 TX_SIZE tx_size,
288 void *arg);289 void *arg);
@@ -296,17 +297,6 @@ void vp10_foreach_transformed_block( · 7 unmodified lines
296 const MACROBLOCKD* const xd, BLOCK_SIZE bsize,297 const MACROBLOCKD* const xd, BLOCK_SIZE bsize,
297 foreach_transformed_block_visitor visit, void *arg);298 foreach_transformed_block_visitor visit, void *arg);
298 299
299static INLINE void txfrm_block_to_raster_xy(BLOCK_SIZE plane_bsize,
300 TX_SIZE tx_size, int block,
301 int *x, int *y) {
302 const int bwl = b_width_log2_lookup[plane_bsize];
303 const int tx_cols_log2 = bwl - tx_size;
304 const int tx_cols = 1 << tx_cols_log2;
305 const int raster_mb = block >> (tx_size << 1);
306 *x = (raster_mb & (tx_cols - 1)) << tx_size;
307 *y = (raster_mb >> tx_cols_log2) << tx_size;
308}
309
310void vp10_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,300void vp10_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
311 BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob,301 BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int has_eob,
312 int aoff, int loff);302 int aoff, int loff);
vp10/encoder/encodemb.c+34−37
@@ -324,7 +324,8 @@ static INLINE void highbd_fdct32x32(int rd_transform, const int16_t *src, · 323 unmodified lines
324#endif // CONFIG_VP9_HIGHBITDEPTH324#endif // CONFIG_VP9_HIGHBITDEPTH
325 325
326void vp10_xform_quant_fp(MACROBLOCK *x, int plane, int block,326void vp10_xform_quant_fp(MACROBLOCK *x, int plane, int block,
327 BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {327 int blk_row, int blk_col,
328 BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
328 MACROBLOCKD *const xd = &x->e_mbd;329 MACROBLOCKD *const xd = &x->e_mbd;
329 const struct macroblock_plane *const p = &x->plane[plane];330 const struct macroblock_plane *const p = &x->plane[plane];
330 const struct macroblockd_plane *const pd = &xd->plane[plane];331 const struct macroblockd_plane *const pd = &xd->plane[plane];
@@ -336,10 +337,8 @@ void vp10_xform_quant_fp(MACROBLOCK *x, int plane, int block, · 5 unmodified lines
336 tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);337 tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
337 uint16_t *const eob = &p->eobs[block];338 uint16_t *const eob = &p->eobs[block];
338 const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];339 const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
339 int i, j;
340 const int16_t *src_diff;340 const int16_t *src_diff;
341 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);341 src_diff = &p->src_diff[4 * (blk_row * diff_stride + blk_col)];
342 src_diff = &p->src_diff[4 * (j * diff_stride + i)];
343 342
344#if CONFIG_VP9_HIGHBITDEPTH343#if CONFIG_VP9_HIGHBITDEPTH
345 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {344 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
@@ -424,7 +423,8 @@ void vp10_xform_quant_fp(MACROBLOCK *x, int plane, int block, · 78 unmodified lines
424}423}
425 424
426void vp10_xform_quant_dc(MACROBLOCK *x, int plane, int block,425void vp10_xform_quant_dc(MACROBLOCK *x, int plane, int block,
427 BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {426 int blk_row, int blk_col,
427 BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
428 MACROBLOCKD *const xd = &x->e_mbd;428 MACROBLOCKD *const xd = &x->e_mbd;
429 const struct macroblock_plane *const p = &x->plane[plane];429 const struct macroblock_plane *const p = &x->plane[plane];
430 const struct macroblockd_plane *const pd = &xd->plane[plane];430 const struct macroblockd_plane *const pd = &xd->plane[plane];
@@ -433,11 +433,8 @@ void vp10_xform_quant_dc(MACROBLOCK *x, int plane, int block, · 2 unmodified lines
433 tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);433 tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
434 uint16_t *const eob = &p->eobs[block];434 uint16_t *const eob = &p->eobs[block];
435 const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];435 const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
436 int i, j;
437 const int16_t *src_diff;436 const int16_t *src_diff;
438 437 src_diff = &p->src_diff[4 * (blk_row * diff_stride + blk_col)];
439 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
440 src_diff = &p->src_diff[4 * (j * diff_stride + i)];
441 438
442#if CONFIG_VP9_HIGHBITDEPTH439#if CONFIG_VP9_HIGHBITDEPTH
443 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {440 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
@@ -658,7 +655,8 @@ static void highbd_fwd_txfm_32x32(int rd_transform, const int16_t *src_diff, · 214 unmodified lines
658#endif // CONFIG_VP9_HIGHBITDEPTH655#endif // CONFIG_VP9_HIGHBITDEPTH
659 656
660void vp10_xform_quant(MACROBLOCK *x, int plane, int block,657void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
661 BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {658 int blk_row, int blk_col,
659 BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
662 MACROBLOCKD *const xd = &x->e_mbd;660 MACROBLOCKD *const xd = &x->e_mbd;
663 const struct macroblock_plane *const p = &x->plane[plane];661 const struct macroblock_plane *const p = &x->plane[plane];
664 const struct macroblockd_plane *const pd = &xd->plane[plane];662 const struct macroblockd_plane *const pd = &xd->plane[plane];
@@ -670,10 +668,8 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block, · 5 unmodified lines
670 tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);668 tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
671 uint16_t *const eob = &p->eobs[block];669 uint16_t *const eob = &p->eobs[block];
672 const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];670 const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
673 int i, j;
674 const int16_t *src_diff;671 const int16_t *src_diff;
675 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);672 src_diff = &p->src_diff[4 * (blk_row * diff_stride + blk_col)];
676 src_diff = &p->src_diff[4 * (j * diff_stride + i)];
677 673
678#if CONFIG_VP9_HIGHBITDEPTH674#if CONFIG_VP9_HIGHBITDEPTH
679 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {675 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
@@ -751,7 +747,8 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block, · 71 unmodified lines
751 }747 }
752}748}
753 749
754static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,750static void encode_block(int plane, int block, int blk_row, int blk_col,
751 BLOCK_SIZE plane_bsize,
755 TX_SIZE tx_size, void *arg) {752 TX_SIZE tx_size, void *arg) {
756 struct encode_b_args *const args = arg;753 struct encode_b_args *const args = arg;
757 MACROBLOCK *const x = args->x;754 MACROBLOCK *const x = args->x;
@@ -760,14 +757,12 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize, · 2 unmodified lines
760 struct macroblock_plane *const p = &x->plane[plane];757 struct macroblock_plane *const p = &x->plane[plane];
761 struct macroblockd_plane *const pd = &xd->plane[plane];758 struct macroblockd_plane *const pd = &xd->plane[plane];
762 tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);759 tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
763 int i, j;
764 uint8_t *dst;760 uint8_t *dst;
765 ENTROPY_CONTEXT *a, *l;761 ENTROPY_CONTEXT *a, *l;
766 TX_TYPE tx_type = get_tx_type(pd->plane_type, xd, block);762 TX_TYPE tx_type = get_tx_type(pd->plane_type, xd, block);
767 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);763 dst = &pd->dst.buf[4 * blk_row * pd->dst.stride + 4 * blk_col];
768 dst = &pd->dst.buf[4 * j * pd->dst.stride + 4 * i];764 a = &ctx->ta[plane][blk_col];
769 a = &ctx->ta[plane][i];765 l = &ctx->tl[plane][blk_row];
770 l = &ctx->tl[plane][j];
771 766
772 // TODO(jingning): per transformed block zero forcing only enabled for767 // TODO(jingning): per transformed block zero forcing only enabled for
773 // luma component. will integrate chroma components as well.768 // luma component. will integrate chroma components as well.
@@ -786,17 +781,20 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize, · 12 unmodified lines
786 *a = *l = 0;781 *a = *l = 0;
787 return;782 return;
788 } else {783 } else {
789 vp10_xform_quant_fp(x, plane, block, plane_bsize, tx_size);784 vp10_xform_quant_fp(x, plane, block, blk_row, blk_col,
785 plane_bsize, tx_size);
790 }786 }
791 } else {787 } else {
792 if (max_txsize_lookup[plane_bsize] == tx_size) {788 if (max_txsize_lookup[plane_bsize] == tx_size) {
793 int txfm_blk_index = (plane << 2) + (block >> (tx_size << 1));789 int txfm_blk_index = (plane << 2) + (block >> (tx_size << 1));
794 if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_NONE) {790 if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_NONE) {
795 // full forward transform and quantization791 // full forward transform and quantization
796 vp10_xform_quant(x, plane, block, plane_bsize, tx_size);792 vp10_xform_quant(x, plane, block, blk_row, blk_col,
793 plane_bsize, tx_size);
797 } else if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_AC_ONLY) {794 } else if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_AC_ONLY) {
798 // fast path forward transform and quantization795 // fast path forward transform and quantization
799 vp10_xform_quant_dc(x, plane, block, plane_bsize, tx_size);796 vp10_xform_quant_dc(x, plane, block, blk_row, blk_col,
797 plane_bsize, tx_size);
800 } else {798 } else {
801 // skip forward transform799 // skip forward transform
802 p->eobs[block] = 0;800 p->eobs[block] = 0;
@@ -804,7 +802,8 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize, · 1 unmodified line
804 return;802 return;
805 }803 }
806 } else {804 } else {
807 vp10_xform_quant(x, plane, block, plane_bsize, tx_size);805 vp10_xform_quant(x, plane, block, blk_row, blk_col,
806 plane_bsize, tx_size);
808 }807 }
809 }808 }
810 }809 }
@@ -879,19 +878,18 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize, · 68 unmodified lines
879 }878 }
880}879}
881 880
882static void encode_block_pass1(int plane, int block, BLOCK_SIZE plane_bsize,881static void encode_block_pass1(int plane, int block, int blk_row, int blk_col,
882 BLOCK_SIZE plane_bsize,
883 TX_SIZE tx_size, void *arg) {883 TX_SIZE tx_size, void *arg) {
884 MACROBLOCK *const x = (MACROBLOCK *)arg;884 MACROBLOCK *const x = (MACROBLOCK *)arg;
885 MACROBLOCKD *const xd = &x->e_mbd;885 MACROBLOCKD *const xd = &x->e_mbd;
886 struct macroblock_plane *const p = &x->plane[plane];886 struct macroblock_plane *const p = &x->plane[plane];
887 struct macroblockd_plane *const pd = &xd->plane[plane];887 struct macroblockd_plane *const pd = &xd->plane[plane];
888 tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);888 tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
889 int i, j;
890 uint8_t *dst;889 uint8_t *dst;
891 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);890 dst = &pd->dst.buf[4 * blk_row * pd->dst.stride + 4 * blk_col];
892 dst = &pd->dst.buf[4 * j * pd->dst.stride + 4 * i];
893 891
894 vp10_xform_quant(x, plane, block, plane_bsize, tx_size);892 vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize, tx_size);
895 893
896 if (p->eobs[block] > 0) {894 if (p->eobs[block] > 0) {
897#if CONFIG_VP9_HIGHBITDEPTH895#if CONFIG_VP9_HIGHBITDEPTH
@@ -948,8 +946,9 @@ void vp10_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) { · 50 unmodified lines
948 }946 }
949}947}
950 948
951void vp10_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,949void vp10_encode_block_intra(int plane, int block, int blk_row, int blk_col,
952 TX_SIZE tx_size, void *arg) {950 BLOCK_SIZE plane_bsize,
951 TX_SIZE tx_size, void *arg) {
953 struct encode_b_args* const args = arg;952 struct encode_b_args* const args = arg;
954 MACROBLOCK *const x = args->x;953 MACROBLOCK *const x = args->x;
955 MACROBLOCKD *const xd = &x->e_mbd;954 MACROBLOCKD *const xd = &x->e_mbd;
@@ -971,15 +970,13 @@ void vp10_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, · 15 unmodified lines
971 uint16_t *eob = &p->eobs[block];970 uint16_t *eob = &p->eobs[block];
972 const int src_stride = p->src.stride;971 const int src_stride = p->src.stride;
973 const int dst_stride = pd->dst.stride;972 const int dst_stride = pd->dst.stride;
974 int i, j;973 dst = &pd->dst.buf[4 * (blk_row * dst_stride + blk_col)];
975 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);974 src = &p->src.buf[4 * (blk_row * src_stride + blk_col)];
976 dst = &pd->dst.buf[4 * (j * dst_stride + i)];975 src_diff = &p->src_diff[4 * (blk_row * diff_stride + blk_col)];
977 src = &p->src.buf[4 * (j * src_stride + i)];
978 src_diff = &p->src_diff[4 * (j * diff_stride + i)];
979 976
980 mode = plane == 0 ? get_y_mode(xd->mi[0], block) : mbmi->uv_mode;977 mode = plane == 0 ? get_y_mode(xd->mi[0], block) : mbmi->uv_mode;
981 vp10_predict_intra_block(xd, bwl, bhl, tx_size, mode, dst, dst_stride,978 vp10_predict_intra_block(xd, bwl, bhl, tx_size, mode, dst, dst_stride,
982 dst, dst_stride, i, j, plane);979 dst, dst_stride, blk_col, blk_row, plane);
983 980
984#if CONFIG_VP9_HIGHBITDEPTH981#if CONFIG_VP9_HIGHBITDEPTH
985 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {982 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
@@ -1130,5 +1127,5 @@ void vp10_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) { · 144 unmodified lines
1130 struct encode_b_args arg = {x, NULL, &xd->mi[0]->mbmi.skip};1127 struct encode_b_args arg = {x, NULL, &xd->mi[0]->mbmi.skip};
1131 1128
1132 vp10_foreach_transformed_block_in_plane(xd, bsize, plane,1129 vp10_foreach_transformed_block_in_plane(xd, bsize, plane,
1133 vp10_encode_block_intra, &arg);1130 vp10_encode_block_intra, &arg);
1134}1131}
vp10/encoder/encodemb.h+9−5
@@ -26,16 +26,20 @@ struct encode_b_args { · 25 unmodified lines
26void vp10_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize);26void vp10_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize);
27void vp10_encode_sby_pass1(MACROBLOCK *x, BLOCK_SIZE bsize);27void vp10_encode_sby_pass1(MACROBLOCK *x, BLOCK_SIZE bsize);
28void vp10_xform_quant_fp(MACROBLOCK *x, int plane, int block,28void vp10_xform_quant_fp(MACROBLOCK *x, int plane, int block,
29 BLOCK_SIZE plane_bsize, TX_SIZE tx_size);29 int blk_row, int blk_col,
30 BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
30void vp10_xform_quant_dc(MACROBLOCK *x, int plane, int block,31void vp10_xform_quant_dc(MACROBLOCK *x, int plane, int block,
31 BLOCK_SIZE plane_bsize, TX_SIZE tx_size);32 int blk_row, int blk_col,
33 BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
32void vp10_xform_quant(MACROBLOCK *x, int plane, int block,34void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
33 BLOCK_SIZE plane_bsize, TX_SIZE tx_size);35 int blk_row, int blk_col,
36 BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
34 37
35void vp10_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);38void vp10_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
36 39
37void vp10_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,40void vp10_encode_block_intra(int plane, int block, int blk_row, int blk_col,
38 TX_SIZE tx_size, void *arg);41 BLOCK_SIZE plane_bsize,
42 TX_SIZE tx_size, void *arg);
39 43
40void vp10_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);44void vp10_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
41 45
vp10/encoder/rdopt.c+13−12
@@ -451,18 +451,16 @@ static void dist_block(MACROBLOCK *x, int plane, int block, TX_SIZE tx_size, · 450 unmodified lines
451 *out_sse = this_sse >> shift;451 *out_sse = this_sse >> shift;
452}452}
453 453
454static int rate_block(int plane, int block, BLOCK_SIZE plane_bsize,454static int rate_block(int plane, int block, int blk_row, int blk_col,
455 TX_SIZE tx_size, struct rdcost_block_args* args) {455 TX_SIZE tx_size, struct rdcost_block_args* args) {
456 int x_idx, y_idx;456 return cost_coeffs(args->x, plane, block, args->t_above + blk_col,
457 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x_idx, &y_idx);457 args->t_left + blk_row, tx_size,
458
459 return cost_coeffs(args->x, plane, block, args->t_above + x_idx,
460 args->t_left + y_idx, tx_size,
461 args->so->scan, args->so->neighbors,458 args->so->scan, args->so->neighbors,
462 args->use_fast_coef_costing);459 args->use_fast_coef_costing);
463}460}
464 461
465static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize,462static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
463 BLOCK_SIZE plane_bsize,
466 TX_SIZE tx_size, void *arg) {464 TX_SIZE tx_size, void *arg) {
467 struct rdcost_block_args *args = arg;465 struct rdcost_block_args *args = arg;
468 MACROBLOCK *const x = args->x;466 MACROBLOCK *const x = args->x;
@@ -478,20 +476,23 @@ static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize, · 9 unmodified lines
478 476
479 if (!is_inter_block(mbmi)) {477 if (!is_inter_block(mbmi)) {
480 struct encode_b_args arg = {x, NULL, &mbmi->skip};478 struct encode_b_args arg = {x, NULL, &mbmi->skip};
481 vp10_encode_block_intra(plane, block, plane_bsize, tx_size, &arg);479 vp10_encode_block_intra(plane, block, blk_row, blk_col,
480 plane_bsize, tx_size, &arg);
482 dist_block(x, plane, block, tx_size, &dist, &sse);481 dist_block(x, plane, block, tx_size, &dist, &sse);
483 } else if (max_txsize_lookup[plane_bsize] == tx_size) {482 } else if (max_txsize_lookup[plane_bsize] == tx_size) {
484 if (x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))] ==483 if (x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))] ==
485 SKIP_TXFM_NONE) {484 SKIP_TXFM_NONE) {
486 // full forward transform and quantization485 // full forward transform and quantization
487 vp10_xform_quant(x, plane, block, plane_bsize, tx_size);486 vp10_xform_quant(x, plane, block, blk_row, blk_col,
487 plane_bsize, tx_size);
488 dist_block(x, plane, block, tx_size, &dist, &sse);488 dist_block(x, plane, block, tx_size, &dist, &sse);
489 } else if (x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))] ==489 } else if (x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))] ==
490 SKIP_TXFM_AC_ONLY) {490 SKIP_TXFM_AC_ONLY) {
491 // compute DC coefficient491 // compute DC coefficient
492 tran_low_t *const coeff = BLOCK_OFFSET(x->plane[plane].coeff, block);492 tran_low_t *const coeff = BLOCK_OFFSET(x->plane[plane].coeff, block);
493 tran_low_t *const dqcoeff = BLOCK_OFFSET(xd->plane[plane].dqcoeff, block);493 tran_low_t *const dqcoeff = BLOCK_OFFSET(xd->plane[plane].dqcoeff, block);
494 vp10_xform_quant_dc(x, plane, block, plane_bsize, tx_size);494 vp10_xform_quant_dc(x, plane, block, blk_row, blk_col,
495 plane_bsize, tx_size);
495 sse = x->bsse[(plane << 2) + (block >> (tx_size << 1))] << 4;496 sse = x->bsse[(plane << 2) + (block >> (tx_size << 1))] << 4;
496 dist = sse;497 dist = sse;
497 if (x->plane[plane].eobs[block]) {498 if (x->plane[plane].eobs[block]) {
@@ -515,7 +516,7 @@ static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize, · 17 unmodified lines
515 }516 }
516 } else {517 } else {
517 // full forward transform and quantization518 // full forward transform and quantization
518 vp10_xform_quant(x, plane, block, plane_bsize, tx_size);519 vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize, tx_size);
519 dist_block(x, plane, block, tx_size, &dist, &sse);520 dist_block(x, plane, block, tx_size, &dist, &sse);
520 }521 }
521 522
@@ -525,7 +526,7 @@ static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize, · 3 unmodified lines
525 return;526 return;
526 }527 }
527 528
528 rate = rate_block(plane, block, plane_bsize, tx_size, args);529 rate = rate_block(plane, block, blk_row, blk_col, tx_size, args);
529 rd1 = RDCOST(x->rdmult, x->rddiv, rate, dist);530 rd1 = RDCOST(x->rdmult, x->rddiv, rate, dist);
530 rd2 = RDCOST(x->rdmult, x->rddiv, 0, sse);531 rd2 = RDCOST(x->rdmult, x->rddiv, 0, sse);
531 532
vp10/encoder/tokenize.c+15−13
@@ -443,7 +443,9 @@ struct tokenize_b_args { · 442 unmodified lines
443 TOKENEXTRA **tp;443 TOKENEXTRA **tp;
444};444};
445 445
446static void set_entropy_context_b(int plane, int block, BLOCK_SIZE plane_bsize,446static void set_entropy_context_b(int plane, int block,
447 int blk_row, int blk_col,
448 BLOCK_SIZE plane_bsize,
447 TX_SIZE tx_size, void *arg) {449 TX_SIZE tx_size, void *arg) {
448 struct tokenize_b_args* const args = arg;450 struct tokenize_b_args* const args = arg;
449 ThreadData *const td = args->td;451 ThreadData *const td = args->td;
@@ -451,10 +453,8 @@ static void set_entropy_context_b(int plane, int block, BLOCK_SIZE plane_bsize, · 1 unmodified line
451 MACROBLOCKD *const xd = &x->e_mbd;453 MACROBLOCKD *const xd = &x->e_mbd;
452 struct macroblock_plane *p = &x->plane[plane];454 struct macroblock_plane *p = &x->plane[plane];
453 struct macroblockd_plane *pd = &xd->plane[plane];455 struct macroblockd_plane *pd = &xd->plane[plane];
454 int aoff, loff;
455 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff);
456 vp10_set_contexts(xd, pd, plane_bsize, tx_size, p->eobs[block] > 0,456 vp10_set_contexts(xd, pd, plane_bsize, tx_size, p->eobs[block] > 0,
457 aoff, loff);457 blk_col, blk_row);
458}458}
459 459
460static INLINE void add_token(TOKENEXTRA **t, const vpx_prob *context_tree,460static INLINE void add_token(TOKENEXTRA **t, const vpx_prob *context_tree,
@@ -520,7 +520,8 @@ void vp10_tokenize_palette_sb(struct ThreadData *const td, · 59 unmodified lines
520 }520 }
521}521}
522 522
523static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,523static void tokenize_b(int plane, int block, int blk_row, int blk_col,
524 BLOCK_SIZE plane_bsize,
524 TX_SIZE tx_size, void *arg) {525 TX_SIZE tx_size, void *arg) {
525 struct tokenize_b_args* const args = arg;526 struct tokenize_b_args* const args = arg;
526 VP10_COMP *cpi = args->cpi;527 VP10_COMP *cpi = args->cpi;
@@ -553,11 +554,8 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize, · 26 unmodified lines
553 const int seg_eob = get_tx_eob(&cpi->common.seg, segment_id, tx_size);554 const int seg_eob = get_tx_eob(&cpi->common.seg, segment_id, tx_size);
554 int16_t token;555 int16_t token;
555 EXTRABIT extra;556 EXTRABIT extra;
556 int aoff, loff;557 pt = get_entropy_context(tx_size, pd->above_context + blk_col,
557 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff);558 pd->left_context + blk_row);
558
559 pt = get_entropy_context(tx_size, pd->above_context + aoff,
560 pd->left_context + loff);
561 scan = so->scan;559 scan = so->scan;
562 nb = so->neighbors;560 nb = so->neighbors;
563 c = 0;561 c = 0;
@@ -597,20 +595,22 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize, · 33 unmodified lines
597 595
598 *tp = t;596 *tp = t;
599 597
600 vp10_set_contexts(xd, pd, plane_bsize, tx_size, c > 0, aoff, loff);598 vp10_set_contexts(xd, pd, plane_bsize, tx_size, c > 0, blk_col, blk_row);
601}599}
602 600
603struct is_skippable_args {601struct is_skippable_args {
604 uint16_t *eobs;602 uint16_t *eobs;
605 int *skippable;603 int *skippable;
606};604};
607static void is_skippable(int plane, int block,605static void is_skippable(int plane, int block, int blk_row, int blk_col,
608 BLOCK_SIZE plane_bsize, TX_SIZE tx_size,606 BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
609 void *argv) {607 void *argv) {
610 struct is_skippable_args *args = argv;608 struct is_skippable_args *args = argv;
611 (void)plane;609 (void)plane;
612 (void)plane_bsize;610 (void)plane_bsize;
613 (void)tx_size;611 (void)tx_size;
612 (void)blk_row;
613 (void)blk_col;
614 args->skippable[0] &= (!args->eobs[block]);614 args->skippable[0] &= (!args->eobs[block]);
615}615}
616 616
@@ -624,13 +624,15 @@ int vp10_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) { · 7 unmodified lines
624 return result;624 return result;
625}625}
626 626
627static void has_high_freq_coeff(int plane, int block,627static void has_high_freq_coeff(int plane, int block, int blk_row, int blk_col,
628 BLOCK_SIZE plane_bsize, TX_SIZE tx_size,628 BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
629 void *argv) {629 void *argv) {
630 struct is_skippable_args *args = argv;630 struct is_skippable_args *args = argv;
631 int eobs = (tx_size == TX_4X4) ? 3 : 10;631 int eobs = (tx_size == TX_4X4) ? 3 : 10;
632 (void) plane;632 (void) plane;
633 (void) plane_bsize;633 (void) plane_bsize;
634 (void) blk_row;
635 (void) blk_col;
634 636
635 *(args->skippable) |= (args->eobs[block] > eobs);637 *(args->skippable) |= (args->eobs[block] > eobs);
636}638}

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