Simplifies the code by implementing band mapping with static arrays. A lot of the code complexity introduced in a previous patch disappears.
Unified · Split
| @@ -37,15 +37,78 @@ DECLARE_ALIGNED(16, const uint8_t, vp9_norm[256]) = { · 36 unmodified lines | |||
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | DECLARE_ALIGNED(16, const uint8_t, | 39 | DECLARE_ALIGNED(16, const uint8_t, |
| 40 | vp9_coefband_trans_8x8plus[MAXBAND_INDEX + 1]) = { | 40 | vp9_coefband_trans_8x8plus[1024]) = { |
| 41 | 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, | 41 | 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, |
| 42 | 4, 4, 4, 4, 4, 5 | 42 | 4, 4, 4, 4, 4, 5, |
| 43 | // beyond MAXBAND_INDEX+1 all values are filled as 5 | ||
| 44 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 45 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 46 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 47 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 48 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 49 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 50 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 51 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 52 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 53 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 54 | 5, 5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ECLARE_ALIGNED(16, const uint8_t, |
| 46 | vp9_coefband_trans_4x4[MAXBAND_INDEX + 1]) = { | 110 | vp9_coefband_trans_4x4[16]) = { |
| 47 | 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, | 111 | 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, |
| 48 | 5, 5, 5, 5, 5, 5 | ||
| 49 | }; | 112 | }; |
| 50 | 113 | ||
| 51 | DECLARE_ALIGNED(16, const uint8_t, vp9_pt_energy_class[MAX_ENTROPY_TOKENS]) = { | 114 | DECLARE_ALIGNED(16, const uint8_t, vp9_pt_energy_class[MAX_ENTROPY_TOKENS]) = { |
| @@ -120,12 +120,16 @@ static INLINE void reset_skip_context(MACROBLOCKD *xd, BLOCK_SIZE bsize) { · 119 unmodified lines | |||
| 120 | 120 | ||
| 121 | // This is the index in the scan order beyond which all coefficients for | 121 | // This is the index in the scan order beyond which all coefficients for |
| 122 | // 8x8 transform and above are in the top band. | 122 | // 8x8 transform and above are in the top band. |
| 123 | // For 4x4 blocks the index is less but to keep things common the lookup | 123 | // This macro is currently unused but may be used by certain implementations |
| 124 | // table for 4x4 is padded out to this index. | ||
| 125 | #define MAXBAND_INDEX 21 | 124 | #define MAXBAND_INDEX 21 |
| 126 | 125 | ||
| 127 | extern const uint8_t vp9_coefband_trans_8x8plus[MAXBAND_INDEX + 1]; | 126 | extern const uint8_t vp9_coefband_trans_8x8plus[1024]; |
| 128 | extern const uint8_t vp9_coefband_trans_4x4[MAXBAND_INDEX + 1]; | 127 | extern const uint8_t vp9_coefband_trans_4x4[16]; |
| 128 | |||
| 129 | static const uint8_t *get_band_translate(TX_SIZE tx_size) { | ||
| 130 | return tx_size == TX_4X4 ? vp9_coefband_trans_4x4 | ||
| 131 | : vp9_coefband_trans_8x8plus; | ||
| 132 | } | ||
| 129 | 133 | ||
| 130 | // 128 lists of probabilities are stored for the following ONE node probs: | 134 | // 128 lists of probabilities are stored for the following ONE node probs: |
| 131 | // 1, 3, 5, 7, ..., 253, 255 | 135 | // 1, 3, 5, 7, ..., 253, 255 |
| @@ -45,7 +45,6 @@ typedef struct TileWorkerData { · 44 unmodified lines | |||
| 45 | DECLARE_ALIGNED(16, int16_t, qcoeff[MAX_MB_PLANE][64 * 64]); | 45 | DECLARE_ALIGNED(16, int16_t, qcoeff[MAX_MB_PLANE][64 * 64]); |
| 46 | DECLARE_ALIGNED(16, int16_t, dqcoeff[MAX_MB_PLANE][64 * 64]); | 46 | DECLARE_ALIGNED(16, int16_t, dqcoeff[MAX_MB_PLANE][64 * 64]); |
| 47 | DECLARE_ALIGNED(16, uint16_t, eobs[MAX_MB_PLANE][256]); | 47 | DECLARE_ALIGNED(16, uint16_t, eobs[MAX_MB_PLANE][256]); |
| 48 | const uint8_t *band_translate[2]; | ||
| 49 | } TileWorkerData; | 48 | } TileWorkerData; |
| 50 | 49 | ||
| 51 | static int read_be32(const uint8_t *p) { | 50 | static int read_be32(const uint8_t *p) { |
| @@ -295,7 +294,6 @@ struct intra_args { · 243 unmodified lines | |||
| 295 | MACROBLOCKD *xd; | 294 | MACROBLOCKD *xd; |
| 296 | vp9_reader *r; | 295 | vp9_reader *r; |
| 297 | uint8_t *token_cache; | 296 | uint8_t *token_cache; |
| 298 | const uint8_t *band_translate[2]; | ||
| 299 | }; | 297 | }; |
| 300 | 298 | ||
| 301 | static void predict_and_reconstruct_intra_block(int plane, int block, | 299 | static void predict_and_reconstruct_intra_block(int plane, int block, |
| @@ -304,9 +302,6 @@ static void predict_and_reconstruct_intra_block(int plane, int block, · 2 unmodified lines | |||
| 304 | struct intra_args *const args = arg; | 302 | struct intra_args *const args = arg; |
| 305 | VP9_COMMON *const cm = args->cm; | 303 | VP9_COMMON *const cm = args->cm; |
| 306 | MACROBLOCKD *const xd = args->xd; | 304 | MACROBLOCKD *const xd = args->xd; |
| 307 | const uint8_t *band_translate[2] = { | ||
| 308 | args->band_translate[0], args->band_translate[1] | ||
| 309 | }; | ||
| 310 | struct macroblockd_plane *const pd = &xd->plane[plane]; | 305 | struct macroblockd_plane *const pd = &xd->plane[plane]; |
| 311 | MODE_INFO *const mi = xd->mi_8x8[0]; | 306 | MODE_INFO *const mi = xd->mi_8x8[0]; |
| 312 | const MB_PREDICTION_MODE mode = (plane == 0) | 307 | const MB_PREDICTION_MODE mode = (plane == 0) |
| @@ -327,7 +322,7 @@ static void predict_and_reconstruct_intra_block(int plane, int block, · 14 unmodified lines | |||
| 327 | 322 | ||
| 328 | if (!mi->mbmi.skip_coeff) { | 323 | if (!mi->mbmi.skip_coeff) { |
| 329 | vp9_decode_block_tokens(cm, xd, plane, block, plane_bsize, x, y, tx_size, | 324 | vp9_decode_block_tokens(cm, xd, plane, block, plane_bsize, x, y, tx_size, |
| 330 | args->r, args->token_cache, band_translate); | 325 | args->r, args->token_cache); |
| 331 | inverse_transform_block(xd, plane, block, tx_size, x, y); | 326 | inverse_transform_block(xd, plane, block, tx_size, x, y); |
| 332 | } | 327 | } |
| 333 | } | 328 | } |
| @@ -338,7 +333,6 @@ struct inter_args { · 4 unmodified lines | |||
| 338 | vp9_reader *r; | 333 | vp9_reader *r; |
| 339 | int *eobtotal; | 334 | int *eobtotal; |
| 340 | uint8_t *token_cache; | 335 | uint8_t *token_cache; |
| 341 | const uint8_t *band_translate[2]; | ||
| 342 | }; | 336 | }; |
| 343 | 337 | ||
| 344 | static void reconstruct_inter_block(int plane, int block, | 338 | static void reconstruct_inter_block(int plane, int block, |
| @@ -347,16 +341,12 @@ static void reconstruct_inter_block(int plane, int block, · 2 unmodified lines | |||
| 347 | struct inter_args *args = arg; | 341 | struct inter_args *args = arg; |
| 348 | VP9_COMMON *const cm = args->cm; | 342 | VP9_COMMON *const cm = args->cm; |
| 349 | MACROBLOCKD *const xd = args->xd; | 343 | MACROBLOCKD *const xd = args->xd; |
| 350 | const uint8_t *band_translate[2] = { | ||
| 351 | args->band_translate[0], args->band_translate[1] | ||
| 352 | }; | ||
| 353 | int x, y; | 344 | int x, y; |
| 354 | txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y); | 345 | txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y); |
| 355 | 346 | ||
| 356 | *args->eobtotal += vp9_decode_block_tokens(cm, xd, plane, block, | 347 | *args->eobtotal += vp9_decode_block_tokens(cm, xd, plane, block, |
| 357 | plane_bsize, x, y, tx_size, | 348 | plane_bsize, x, y, tx_size, |
| 358 | args->r, args->token_cache, | 349 | args->r, args->token_cache); |
| 359 | band_translate); | ||
| 360 | inverse_transform_block(xd, plane, block, tx_size, x, y); | 350 | inverse_transform_block(xd, plane, block, tx_size, x, y); |
| 361 | } | 351 | } |
| 362 | 352 | ||
| @@ -408,8 +398,7 @@ static void decode_modes_b(VP9_COMMON *const cm, MACROBLOCKD *const xd, · 45 unmodified lines | |||
| 408 | const TileInfo *const tile, | 398 | const TileInfo *const tile, |
| 409 | int mi_row, int mi_col, | 399 | int mi_row, int mi_col, |
| 410 | vp9_reader *r, BLOCK_SIZE bsize, | 400 | vp9_reader *r, BLOCK_SIZE bsize, |
| 411 | uint8_t *token_cache, | 401 | uint8_t *token_cache) { |
| 412 | const uint8_t *band_translate[2]) { | ||
| 413 | const int less8x8 = bsize < BLOCK_8X8; | 402 | const int less8x8 = bsize < BLOCK_8X8; |
| 414 | MB_MODE_INFO *mbmi; | 403 | MB_MODE_INFO *mbmi; |
| 415 | 404 | ||
| @@ -432,7 +421,7 @@ static void decode_modes_b(VP9_COMMON *const cm, MACROBLOCKD *const xd, · 16 unmodified lines | |||
| 432 | 421 | ||
| 433 | if (!is_inter_block(mbmi)) { | 422 | if (!is_inter_block(mbmi)) { |
| 434 | struct intra_args arg = { | 423 | struct intra_args arg = { |
| 435 | cm, xd, r, token_cache, {band_translate[0], band_translate[1]} | 424 | cm, xd, r, token_cache |
| 436 | }; | 425 | }; |
| 437 | foreach_transformed_block(xd, bsize, predict_and_reconstruct_intra_block, | 426 | foreach_transformed_block(xd, bsize, predict_and_reconstruct_intra_block, |
| 438 | &arg); | 427 | &arg); |
| @@ -452,8 +441,7 @@ static void decode_modes_b(VP9_COMMON *const cm, MACROBLOCKD *const xd, · 13 unmodified lines | |||
| 452 | if (!mbmi->skip_coeff) { | 441 | if (!mbmi->skip_coeff) { |
| 453 | int eobtotal = 0; | 442 | int eobtotal = 0; |
| 454 | struct inter_args arg = { | 443 | struct inter_args arg = { |
| 455 | cm, xd, r, &eobtotal, token_cache, | 444 | cm, xd, r, &eobtotal, token_cache |
| 456 | {band_translate[0], band_translate[1]} | ||
| 457 | }; | 445 | }; |
| 458 | foreach_transformed_block(xd, bsize, reconstruct_inter_block, &arg); | 446 | foreach_transformed_block(xd, bsize, reconstruct_inter_block, &arg); |
| 459 | if (!less8x8 && eobtotal == 0) | 447 | if (!less8x8 && eobtotal == 0) |
| @@ -494,8 +482,7 @@ static void decode_modes_sb(VP9_COMMON *const cm, MACROBLOCKD *const xd, · 34 unmodified lines | |||
| 494 | const TileInfo *const tile, | 482 | const TileInfo *const tile, |
| 495 | int mi_row, int mi_col, | 483 | int mi_row, int mi_col, |
| 496 | vp9_reader* r, BLOCK_SIZE bsize, | 484 | vp9_reader* r, BLOCK_SIZE bsize, |
| 497 | uint8_t *token_cache, | 485 | uint8_t *token_cache) { |
| 498 | const uint8_t *band_translate[2]) { | ||
| 499 | const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2; | 486 | const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2; |
| 500 | PARTITION_TYPE partition; | 487 | PARTITION_TYPE partition; |
| 501 | BLOCK_SIZE subsize; | 488 | BLOCK_SIZE subsize; |
| @@ -506,37 +493,33 @@ static void decode_modes_sb(VP9_COMMON *const cm, MACROBLOCKD *const xd, · 4 unmodified lines | |||
| 506 | partition = read_partition(cm, xd, hbs, mi_row, mi_col, bsize, r); | 493 | partition = read_partition(cm, xd, hbs, mi_row, mi_col, bsize, r); |
| 507 | subsize = get_subsize(bsize, partition); | 494 | subsize = get_subsize(bsize, partition); |
| 508 | if (subsize < BLOCK_8X8) { | 495 | if (subsize < BLOCK_8X8) { |
| 509 | decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache, | 496 | decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache); |
| 510 | band_translate); | ||
| 511 | } else { | 497 | } else { |
| 512 | switch (partition) { | 498 | switch (partition) { |
| 513 | case PARTITION_NONE: | 499 | case PARTITION_NONE: |
| 514 | decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache, | 500 | decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache); |
| 515 | band_translate); | ||
| 516 | break; | 501 | break; |
| 517 | case PARTITION_HORZ: | 502 | case PARTITION_HORZ: |
| 518 | decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache, | 503 | decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache); |
| 519 | band_translate); | ||
| 520 | if (mi_row + hbs < cm->mi_rows) | 504 | if (mi_row + hbs < cm->mi_rows) |
| 521 | decode_modes_b(cm, xd, tile, mi_row + hbs, mi_col, r, subsize, | 505 | decode_modes_b(cm, xd, tile, mi_row + hbs, mi_col, r, subsize, |
| 522 | token_cache, band_translate); | 506 | token_cache); |
| 523 | break; | 507 | break; |
| 524 | case PARTITION_VERT: | 508 | case PARTITION_VERT: |
| 525 | decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache, | 509 | decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache); |
| 526 | band_translate); | ||
| 527 | if (mi_col + hbs < cm->mi_cols) | 510 | if (mi_col + hbs < cm->mi_cols) |
| 528 | decode_modes_b(cm, xd, tile, mi_row, mi_col + hbs, r, subsize, | 511 | decode_modes_b(cm, xd, tile, mi_row, mi_col + hbs, r, subsize, |
| 529 | token_cache, band_translate); | 512 | token_cache); |
| 530 | break; | 513 | break; |
| 531 | case PARTITION_SPLIT: | 514 | case PARTITION_SPLIT: |
| 532 | decode_modes_sb(cm, xd, tile, mi_row, mi_col, r, subsize, | 515 | decode_modes_sb(cm, xd, tile, mi_row, mi_col, r, subsize, |
| 533 | token_cache, band_translate); | 516 | token_cache); |
| 534 | decode_modes_sb(cm, xd, tile, mi_row, mi_col + hbs, r, subsize, | 517 | decode_modes_sb(cm, xd, tile, mi_row, mi_col + hbs, r, subsize, |
| 535 | token_cache, band_translate); | 518 | token_cache); |
| 536 | decode_modes_sb(cm, xd, tile, mi_row + hbs, mi_col, r, subsize, | 519 | decode_modes_sb(cm, xd, tile, mi_row + hbs, mi_col, r, subsize, |
| 537 | token_cache, band_translate); | 520 | token_cache); |
| 538 | decode_modes_sb(cm, xd, tile, mi_row + hbs, mi_col + hbs, r, subsize, | 521 | decode_modes_sb(cm, xd, tile, mi_row + hbs, mi_col + hbs, r, subsize, |
| 539 | token_cache, band_translate); | 522 | token_cache); |
| 540 | break; | 523 | break; |
| 541 | default: | 524 | default: |
| 542 | assert(!"Invalid partition type"); | 525 | assert(!"Invalid partition type"); |
| @@ -820,11 +803,8 @@ static void decode_tile(VP9D_COMP *pbi, const TileInfo *const tile, · 277 unmodified lines | |||
| 820 | vp9_zero(xd->left_seg_context); | 803 | vp9_zero(xd->left_seg_context); |
| 821 | for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end; | 804 | for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end; |
| 822 | mi_col += MI_BLOCK_SIZE) { | 805 | mi_col += MI_BLOCK_SIZE) { |
| 823 | const uint8_t *band_translate[2] = { | ||
| 824 | vp9_coefband_trans_4x4, pbi->coefband_trans_8x8plus | ||
| 825 | }; | ||
| 826 | decode_modes_sb(cm, xd, tile, mi_row, mi_col, r, BLOCK_64X64, | 806 | decode_modes_sb(cm, xd, tile, mi_row, mi_col, r, BLOCK_64X64, |
| 827 | pbi->token_cache, band_translate); | 807 | pbi->token_cache); |
| 828 | } | 808 | } |
| 829 | 809 | ||
| 830 | if (pbi->do_loopfilter_inline) { | 810 | if (pbi->do_loopfilter_inline) { |
| @@ -985,8 +965,7 @@ static int tile_worker_hook(void *arg1, void *arg2) { · 154 unmodified lines | |||
| 985 | mi_col += MI_BLOCK_SIZE) { | 965 | mi_col += MI_BLOCK_SIZE) { |
| 986 | decode_modes_sb(tile_data->cm, &tile_data->xd, tile, | 966 | decode_modes_sb(tile_data->cm, &tile_data->xd, tile, |
| 987 | mi_row, mi_col, &tile_data->bit_reader, BLOCK_64X64, | 967 | mi_row, mi_col, &tile_data->bit_reader, BLOCK_64X64, |
| 988 | tile_data->token_cache, | 968 | tile_data->token_cache); |
| 989 | tile_data->band_translate); | ||
| 990 | } | 969 | } |
| 991 | } | 970 | } |
| 992 | return !tile_data->xd.corrupted; | 971 | return !tile_data->xd.corrupted; |
| @@ -1045,8 +1024,6 @@ static const uint8_t *decode_tiles_mt(VP9D_COMP *pbi, const uint8_t *data) { · 52 unmodified lines | |||
| 1045 | tile_data->cm = cm; | 1024 | tile_data->cm = cm; |
| 1046 | tile_data->xd = pbi->mb; | 1025 | tile_data->xd = pbi->mb; |
| 1047 | tile_data->xd.corrupted = 0; | 1026 | tile_data->xd.corrupted = 0; |
| 1048 | tile_data->band_translate[0] = vp9_coefband_trans_4x4; | ||
| 1049 | tile_data->band_translate[1] = pbi->coefband_trans_8x8plus; | ||
| 1050 | vp9_tile_init(tile, tile_data->cm, 0, tile_col); | 1027 | vp9_tile_init(tile, tile_data->cm, 0, tile_col); |
| 1051 | 1028 | ||
| 1052 | setup_token_decoder(data, data_end, size, &cm->error, | 1029 | setup_token_decoder(data, data_end, size, &cm->error, |
| @@ -93,8 +93,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, · 92 unmodified lines | |||
| 93 | vp9_reader *r, int block_idx, | 93 | vp9_reader *r, int block_idx, |
| 94 | PLANE_TYPE type, int seg_eob, int16_t *dqcoeff_ptr, | 94 | PLANE_TYPE type, int seg_eob, int16_t *dqcoeff_ptr, |
| 95 | TX_SIZE tx_size, const int16_t *dq, int pt, | 95 | TX_SIZE tx_size, const int16_t *dq, int pt, |
| 96 | uint8_t *token_cache, | 96 | uint8_t *token_cache) { |
| 97 | const uint8_t *band_translate) { | ||
| 98 | const FRAME_CONTEXT *const fc = &cm->fc; | 97 | const FRAME_CONTEXT *const fc = &cm->fc; |
| 99 | FRAME_COUNTS *const counts = &cm->counts; | 98 | FRAME_COUNTS *const counts = &cm->counts; |
| 100 | const int ref = is_inter_block(&xd->mi_8x8[0]->mbmi); | 99 | const int ref = is_inter_block(&xd->mi_8x8[0]->mbmi); |
| @@ -110,6 +109,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, · 9 unmodified lines | |||
| 110 | counts->eob_branch[tx_size][type][ref]; | 109 | counts->eob_branch[tx_size][type][ref]; |
| 111 | const int16_t *scan, *nb; | 110 | const int16_t *scan, *nb; |
| 112 | const uint8_t *cat6; | 111 | const uint8_t *cat6; |
| 112 | const uint8_t *band_translate = get_band_translate(tx_size); | ||
| 113 | get_scan(xd, tx_size, type, block_idx, &scan, &nb); | 113 | get_scan(xd, tx_size, type, block_idx, &scan, &nb); |
| 114 | 114 | ||
| 115 | while (c < seg_eob) { | 115 | while (c < seg_eob) { |
| @@ -219,8 +219,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, · 103 unmodified lines | |||
| 219 | int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd, | 219 | int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd, |
| 220 | int plane, int block, BLOCK_SIZE plane_bsize, | 220 | int plane, int block, BLOCK_SIZE plane_bsize, |
| 221 | int x, int y, TX_SIZE tx_size, vp9_reader *r, | 221 | int x, int y, TX_SIZE tx_size, vp9_reader *r, |
| 222 | uint8_t *token_cache, | 222 | uint8_t *token_cache) { |
| 223 | const uint8_t *band_translate[2]) { | ||
| 224 | struct macroblockd_plane *const pd = &xd->plane[plane]; | 223 | struct macroblockd_plane *const pd = &xd->plane[plane]; |
| 225 | const int seg_eob = get_tx_eob(&cm->seg, xd->mi_8x8[0]->mbmi.segment_id, | 224 | const int seg_eob = get_tx_eob(&cm->seg, xd->mi_8x8[0]->mbmi.segment_id, |
| 226 | tx_size); | 225 | tx_size); |
| @@ -228,8 +227,7 @@ int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd, · 1 unmodified line | |||
| 228 | pd->left_context + y); | 227 | pd->left_context + y); |
| 229 | const int eob = decode_coefs(cm, xd, r, block, pd->plane_type, seg_eob, | 228 | const int eob = decode_coefs(cm, xd, r, block, pd->plane_type, seg_eob, |
| 230 | BLOCK_OFFSET(pd->dqcoeff, block), tx_size, | 229 | BLOCK_OFFSET(pd->dqcoeff, block), tx_size, |
| 231 | pd->dequant, pt, token_cache, | 230 | pd->dequant, pt, token_cache); |
| 232 | band_translate[tx_size != TX_4X4]); | ||
| 233 | set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y); | 231 | set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y); |
| 234 | pd->eobs[block] = eob; | 232 | pd->eobs[block] = eob; |
| 235 | return eob; | 233 | return eob; |
| @@ -18,7 +18,6 @@ · 17 unmodified lines | |||
| 18 | int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd, | 18 | int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd, |
| 19 | int plane, int block, BLOCK_SIZE plane_bsize, | 19 | int plane, int block, BLOCK_SIZE plane_bsize, |
| 20 | int x, int y, TX_SIZE tx_size, vp9_reader *r, | 20 | int x, int y, TX_SIZE tx_size, vp9_reader *r, |
| 21 | uint8_t *token_cache, | 21 | uint8_t *token_cache); |
| 22 | const uint8_t *band_translate[2]); | ||
| 23 | 22 | ||
| 24 | #endif // VP9_DECODER_VP9_DETOKENIZE_H_ | 23 | #endif // VP9_DECODER_VP9_DETOKENIZE_H_ |
| @@ -194,9 +194,6 @@ struct macroblock { · 193 unmodified lines | |||
| 194 | BLOCK_SIZE sb64_partitioning; | 194 | BLOCK_SIZE sb64_partitioning; |
| 195 | 195 | ||
| 196 | void (*fwd_txm4x4)(const int16_t *input, int16_t *output, int stride); | 196 | void (*fwd_txm4x4)(const int16_t *input, int16_t *output, int stride); |
| 197 | |||
| 198 | // band cache | ||
| 199 | DECLARE_ALIGNED(16, uint8_t, coefband_trans_8x8plus[1024]); | ||
| 200 | }; | 197 | }; |
| 201 | 198 | ||
| 202 | // TODO(jingning): the variables used here are little complicated. need further | 199 | // TODO(jingning): the variables used here are little complicated. need further |
| @@ -137,9 +137,7 @@ static void optimize_b(MACROBLOCK *mb, · 136 unmodified lines | |||
| 137 | const int mul = 1 + (tx_size == TX_32X32); | 137 | const int mul = 1 + (tx_size == TX_32X32); |
| 138 | uint8_t token_cache[1024]; | 138 | uint8_t token_cache[1024]; |
| 139 | const int16_t *dequant_ptr = pd->dequant; | 139 | const int16_t *dequant_ptr = pd->dequant; |
| 140 | const uint8_t *const band_translate = (tx_size == TX_4X4 ? | 140 | const uint8_t *const band_translate = get_band_translate(tx_size); |
| 141 | vp9_coefband_trans_4x4 : | ||
| 142 | mb->coefband_trans_8x8plus); | ||
| 143 | 141 | ||
| 144 | assert((!type && !plane) || (type && plane)); | 142 | assert((!type && !plane) || (type && plane)); |
| 145 | dqcoeff_ptr = BLOCK_OFFSET(pd->dqcoeff, block); | 143 | dqcoeff_ptr = BLOCK_OFFSET(pd->dqcoeff, block); |
| @@ -1224,13 +1224,6 @@ static void init_config(VP9_PTR ptr, VP9_CONFIG *oxcf) { · 1223 unmodified lines | |||
| 1224 | cpi->fixed_divide[0] = 0; | 1224 | cpi->fixed_divide[0] = 0; |
| 1225 | for (i = 1; i < 512; i++) | 1225 | for (i = 1; i < 512; i++) |
| 1226 | cpi->fixed_divide[i] = 0x80000 / i; | 1226 | cpi->fixed_divide[i] = 0x80000 / i; |
| 1227 | |||
| 1228 | vpx_memset(cpi->mb.coefband_trans_8x8plus, | ||
| 1229 | (COEF_BANDS-1), | ||
| 1230 | sizeof(cpi->mb.coefband_trans_8x8plus)); | ||
| 1231 | vpx_memcpy(cpi->mb.coefband_trans_8x8plus, | ||
| 1232 | vp9_coefband_trans_8x8plus, | ||
| 1233 | sizeof(vp9_coefband_trans_8x8plus)); | ||
| 1234 | } | 1227 | } |
| 1235 | 1228 | ||
| 1236 | 1229 | ||
| @@ -115,9 +115,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize, · 114 unmodified lines | |||
| 115 | vp9_coeff_count *const counts = cpi->coef_counts[tx_size]; | 115 | vp9_coeff_count *const counts = cpi->coef_counts[tx_size]; |
| 116 | vp9_coeff_probs_model *const coef_probs = cpi->common.fc.coef_probs[tx_size]; | 116 | vp9_coeff_probs_model *const coef_probs = cpi->common.fc.coef_probs[tx_size]; |
| 117 | const int ref = is_inter_block(mbmi); | 117 | const int ref = is_inter_block(mbmi); |
| 118 | const uint8_t *const band_translate = (tx_size == TX_4X4 ? | 118 | const uint8_t *const band_translate = get_band_translate(tx_size); |
| 119 | vp9_coefband_trans_4x4 : | ||
| 120 | cpi->mb.coefband_trans_8x8plus); | ||
| 121 | const int seg_eob = get_tx_eob(&cpi->common.seg, segment_id, tx_size); | 119 | const int seg_eob = get_tx_eob(&cpi->common.seg, segment_id, tx_size); |
| 122 | int aoff, loff; | 120 | int aoff, loff; |
| 123 | txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff); | 121 | txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff); |