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 | 39 | DECLARE_ALIGNED(16, const uint8_t, |
| 40 | − vp9_coefband_trans_8x8plus[MAXBAND_INDEX + 1]) = { | |
| 40 | + vp9_coefband_trans_8x8plus[1024]) = { | |
| 41 | 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, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 55 | + 5, 5, 5, 5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5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 92 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 93 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 94 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 95 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 96 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 97 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 98 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 99 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 100 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 101 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 102 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 103 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 104 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 105 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 106 | + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
| 43 | 107 | }; |
| 44 | 108 | |
| 45 | 109 | DECLARE_ALIGNED(16, const uint8_t, |
| 46 | − vp9_coefband_trans_4x4[MAXBAND_INDEX + 1]) = { | |
| 110 | + vp9_coefband_trans_4x4[16]) = { | |
| 47 | 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 | 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 | 121 | // This is the index in the scan order beyond which all coefficients for |
| 122 | 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 | |
| 124 | −// table for 4x4 is padded out to this index. | |
| 123 | +// This macro is currently unused but may be used by certain implementations | |
| 125 | 124 | #define MAXBAND_INDEX 21 |
| 126 | 125 | |
| 127 | −extern const uint8_t vp9_coefband_trans_8x8plus[MAXBAND_INDEX + 1]; | |
| 128 | −extern const uint8_t vp9_coefband_trans_4x4[MAXBAND_INDEX + 1]; | |
| 126 | +extern const uint8_t vp9_coefband_trans_8x8plus[1024]; | |
| 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 | 134 | // 128 lists of probabilities are stored for the following ONE node probs: |
| 131 | 135 | // 1, 3, 5, 7, ..., 253, 255 |
| @@ -45,7 +45,6 @@ typedef struct TileWorkerData { · 44 unmodified lines | ||
| 45 | 45 | DECLARE_ALIGNED(16, int16_t, qcoeff[MAX_MB_PLANE][64 * 64]); |
| 46 | 46 | DECLARE_ALIGNED(16, int16_t, dqcoeff[MAX_MB_PLANE][64 * 64]); |
| 47 | 47 | DECLARE_ALIGNED(16, uint16_t, eobs[MAX_MB_PLANE][256]); |
| 48 | − const uint8_t *band_translate[2]; | |
| 49 | 48 | } TileWorkerData; |
| 50 | 49 | |
| 51 | 50 | static int read_be32(const uint8_t *p) { |
| @@ -295,7 +294,6 @@ struct intra_args { · 243 unmodified lines | ||
| 295 | 294 | MACROBLOCKD *xd; |
| 296 | 295 | vp9_reader *r; |
| 297 | 296 | uint8_t *token_cache; |
| 298 | − const uint8_t *band_translate[2]; | |
| 299 | 297 | }; |
| 300 | 298 | |
| 301 | 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 | 302 | struct intra_args *const args = arg; |
| 305 | 303 | VP9_COMMON *const cm = args->cm; |
| 306 | 304 | MACROBLOCKD *const xd = args->xd; |
| 307 | − const uint8_t *band_translate[2] = { | |
| 308 | − args->band_translate[0], args->band_translate[1] | |
| 309 | − }; | |
| 310 | 305 | struct macroblockd_plane *const pd = &xd->plane[plane]; |
| 311 | 306 | MODE_INFO *const mi = xd->mi_8x8[0]; |
| 312 | 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 | 323 | if (!mi->mbmi.skip_coeff) { |
| 329 | 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 | 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 | 333 | vp9_reader *r; |
| 339 | 334 | int *eobtotal; |
| 340 | 335 | uint8_t *token_cache; |
| 341 | − const uint8_t *band_translate[2]; | |
| 342 | 336 | }; |
| 343 | 337 | |
| 344 | 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 | 341 | struct inter_args *args = arg; |
| 348 | 342 | VP9_COMMON *const cm = args->cm; |
| 349 | 343 | MACROBLOCKD *const xd = args->xd; |
| 350 | − const uint8_t *band_translate[2] = { | |
| 351 | − args->band_translate[0], args->band_translate[1] | |
| 352 | − }; | |
| 353 | 344 | int x, y; |
| 354 | 345 | txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y); |
| 355 | 346 | |
| 356 | 347 | *args->eobtotal += vp9_decode_block_tokens(cm, xd, plane, block, |
| 357 | 348 | plane_bsize, x, y, tx_size, |
| 358 | − args->r, args->token_cache, | |
| 359 | − band_translate); | |
| 349 | + args->r, args->token_cache); | |
| 360 | 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 | 398 | const TileInfo *const tile, |
| 409 | 399 | int mi_row, int mi_col, |
| 410 | 400 | vp9_reader *r, BLOCK_SIZE bsize, |
| 411 | − uint8_t *token_cache, | |
| 412 | − const uint8_t *band_translate[2]) { | |
| 401 | + uint8_t *token_cache) { | |
| 413 | 402 | const int less8x8 = bsize < BLOCK_8X8; |
| 414 | 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 | 422 | if (!is_inter_block(mbmi)) { |
| 434 | 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 | 426 | foreach_transformed_block(xd, bsize, predict_and_reconstruct_intra_block, |
| 438 | 427 | &arg); |
| @@ -452,8 +441,7 @@ static void decode_modes_b(VP9_COMMON *const cm, MACROBLOCKD *const xd, · 13 unmodified lines | ||
| 452 | 441 | if (!mbmi->skip_coeff) { |
| 453 | 442 | int eobtotal = 0; |
| 454 | 443 | struct inter_args arg = { |
| 455 | − cm, xd, r, &eobtotal, token_cache, | |
| 456 | − {band_translate[0], band_translate[1]} | |
| 444 | + cm, xd, r, &eobtotal, token_cache | |
| 457 | 445 | }; |
| 458 | 446 | foreach_transformed_block(xd, bsize, reconstruct_inter_block, &arg); |
| 459 | 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 | 482 | const TileInfo *const tile, |
| 495 | 483 | int mi_row, int mi_col, |
| 496 | 484 | vp9_reader* r, BLOCK_SIZE bsize, |
| 497 | − uint8_t *token_cache, | |
| 498 | − const uint8_t *band_translate[2]) { | |
| 485 | + uint8_t *token_cache) { | |
| 499 | 486 | const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2; |
| 500 | 487 | PARTITION_TYPE partition; |
| 501 | 488 | BLOCK_SIZE subsize; |
| @@ -506,37 +493,33 @@ static void decode_modes_sb(VP9_COMMON *const cm, MACROBLOCKD *const xd, · 4 unmodified lines | ||
| 506 | 493 | partition = read_partition(cm, xd, hbs, mi_row, mi_col, bsize, r); |
| 507 | 494 | subsize = get_subsize(bsize, partition); |
| 508 | 495 | if (subsize < BLOCK_8X8) { |
| 509 | − decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache, | |
| 510 | − band_translate); | |
| 496 | + decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache); | |
| 511 | 497 | } else { |
| 512 | 498 | switch (partition) { |
| 513 | 499 | case PARTITION_NONE: |
| 514 | − decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache, | |
| 515 | − band_translate); | |
| 500 | + decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache); | |
| 516 | 501 | break; |
| 517 | 502 | case PARTITION_HORZ: |
| 518 | − decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache, | |
| 519 | − band_translate); | |
| 503 | + decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache); | |
| 520 | 504 | if (mi_row + hbs < cm->mi_rows) |
| 521 | 505 | decode_modes_b(cm, xd, tile, mi_row + hbs, mi_col, r, subsize, |
| 522 | − token_cache, band_translate); | |
| 506 | + token_cache); | |
| 523 | 507 | break; |
| 524 | 508 | case PARTITION_VERT: |
| 525 | − decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache, | |
| 526 | − band_translate); | |
| 509 | + decode_modes_b(cm, xd, tile, mi_row, mi_col, r, subsize, token_cache); | |
| 527 | 510 | if (mi_col + hbs < cm->mi_cols) |
| 528 | 511 | decode_modes_b(cm, xd, tile, mi_row, mi_col + hbs, r, subsize, |
| 529 | − token_cache, band_translate); | |
| 512 | + token_cache); | |
| 530 | 513 | break; |
| 531 | 514 | case PARTITION_SPLIT: |
| 532 | 515 | decode_modes_sb(cm, xd, tile, mi_row, mi_col, r, subsize, |
| 533 | − token_cache, band_translate); | |
| 516 | + token_cache); | |
| 534 | 517 | decode_modes_sb(cm, xd, tile, mi_row, mi_col + hbs, r, subsize, |
| 535 | − token_cache, band_translate); | |
| 518 | + token_cache); | |
| 536 | 519 | decode_modes_sb(cm, xd, tile, mi_row + hbs, mi_col, r, subsize, |
| 537 | − token_cache, band_translate); | |
| 520 | + token_cache); | |
| 538 | 521 | decode_modes_sb(cm, xd, tile, mi_row + hbs, mi_col + hbs, r, subsize, |
| 539 | − token_cache, band_translate); | |
| 522 | + token_cache); | |
| 540 | 523 | break; |
| 541 | 524 | default: |
| 542 | 525 | assert(!"Invalid partition type"); |
| @@ -820,11 +803,8 @@ static void decode_tile(VP9D_COMP *pbi, const TileInfo *const tile, · 277 unmodified lines | ||
| 820 | 803 | vp9_zero(xd->left_seg_context); |
| 821 | 804 | for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end; |
| 822 | 805 | mi_col += MI_BLOCK_SIZE) { |
| 823 | − const uint8_t *band_translate[2] = { | |
| 824 | − vp9_coefband_trans_4x4, pbi->coefband_trans_8x8plus | |
| 825 | − }; | |
| 826 | 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 | 810 | if (pbi->do_loopfilter_inline) { |
| @@ -985,8 +965,7 @@ static int tile_worker_hook(void *arg1, void *arg2) { · 154 unmodified lines | ||
| 985 | 965 | mi_col += MI_BLOCK_SIZE) { |
| 986 | 966 | decode_modes_sb(tile_data->cm, &tile_data->xd, tile, |
| 987 | 967 | mi_row, mi_col, &tile_data->bit_reader, BLOCK_64X64, |
| 988 | − tile_data->token_cache, | |
| 989 | − tile_data->band_translate); | |
| 968 | + tile_data->token_cache); | |
| 990 | 969 | } |
| 991 | 970 | } |
| 992 | 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 | 1024 | tile_data->cm = cm; |
| 1046 | 1025 | tile_data->xd = pbi->mb; |
| 1047 | 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 | 1027 | vp9_tile_init(tile, tile_data->cm, 0, tile_col); |
| 1051 | 1028 | |
| 1052 | 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 | 93 | vp9_reader *r, int block_idx, |
| 94 | 94 | PLANE_TYPE type, int seg_eob, int16_t *dqcoeff_ptr, |
| 95 | 95 | TX_SIZE tx_size, const int16_t *dq, int pt, |
| 96 | − uint8_t *token_cache, | |
| 97 | − const uint8_t *band_translate) { | |
| 96 | + uint8_t *token_cache) { | |
| 98 | 97 | const FRAME_CONTEXT *const fc = &cm->fc; |
| 99 | 98 | FRAME_COUNTS *const counts = &cm->counts; |
| 100 | 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 | 109 | counts->eob_branch[tx_size][type][ref]; |
| 111 | 110 | const int16_t *scan, *nb; |
| 112 | 111 | const uint8_t *cat6; |
| 112 | + const uint8_t *band_translate = get_band_translate(tx_size); | |
| 113 | 113 | get_scan(xd, tx_size, type, block_idx, &scan, &nb); |
| 114 | 114 | |
| 115 | 115 | while (c < seg_eob) { |
| @@ -219,8 +219,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, · 103 unmodified lines | ||
| 219 | 219 | int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd, |
| 220 | 220 | int plane, int block, BLOCK_SIZE plane_bsize, |
| 221 | 221 | int x, int y, TX_SIZE tx_size, vp9_reader *r, |
| 222 | − uint8_t *token_cache, | |
| 223 | − const uint8_t *band_translate[2]) { | |
| 222 | + uint8_t *token_cache) { | |
| 224 | 223 | struct macroblockd_plane *const pd = &xd->plane[plane]; |
| 225 | 224 | const int seg_eob = get_tx_eob(&cm->seg, xd->mi_8x8[0]->mbmi.segment_id, |
| 226 | 225 | tx_size); |
| @@ -228,8 +227,7 @@ int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd, · 1 unmodified line | ||
| 228 | 227 | pd->left_context + y); |
| 229 | 228 | const int eob = decode_coefs(cm, xd, r, block, pd->plane_type, seg_eob, |
| 230 | 229 | BLOCK_OFFSET(pd->dqcoeff, block), tx_size, |
| 231 | − pd->dequant, pt, token_cache, | |
| 232 | − band_translate[tx_size != TX_4X4]); | |
| 230 | + pd->dequant, pt, token_cache); | |
| 233 | 231 | set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y); |
| 234 | 232 | pd->eobs[block] = eob; |
| 235 | 233 | return eob; |
| @@ -18,7 +18,6 @@ · 17 unmodified lines | ||
| 18 | 18 | int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd, |
| 19 | 19 | int plane, int block, BLOCK_SIZE plane_bsize, |
| 20 | 20 | int x, int y, TX_SIZE tx_size, vp9_reader *r, |
| 21 | − uint8_t *token_cache, | |
| 22 | − const uint8_t *band_translate[2]); | |
| 21 | + uint8_t *token_cache); | |
| 23 | 22 | |
| 24 | 23 | #endif // VP9_DECODER_VP9_DETOKENIZE_H_ |
| @@ -194,9 +194,6 @@ struct macroblock { · 193 unmodified lines | ||
| 194 | 194 | BLOCK_SIZE sb64_partitioning; |
| 195 | 195 | |
| 196 | 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 | 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 | 137 | const int mul = 1 + (tx_size == TX_32X32); |
| 138 | 138 | uint8_t token_cache[1024]; |
| 139 | 139 | const int16_t *dequant_ptr = pd->dequant; |
| 140 | − const uint8_t *const band_translate = (tx_size == TX_4X4 ? | |
| 141 | − vp9_coefband_trans_4x4 : | |
| 142 | − mb->coefband_trans_8x8plus); | |
| 140 | + const uint8_t *const band_translate = get_band_translate(tx_size); | |
| 143 | 141 | |
| 144 | 142 | assert((!type && !plane) || (type && plane)); |
| 145 | 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 | 1224 | cpi->fixed_divide[0] = 0; |
| 1225 | 1225 | for (i = 1; i < 512; i++) |
| 1226 | 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 | 115 | vp9_coeff_count *const counts = cpi->coef_counts[tx_size]; |
| 116 | 116 | vp9_coeff_probs_model *const coef_probs = cpi->common.fc.coef_probs[tx_size]; |
| 117 | 117 | const int ref = is_inter_block(mbmi); |
| 118 | − const uint8_t *const band_translate = (tx_size == TX_4X4 ? | |
| 119 | − vp9_coefband_trans_4x4 : | |
| 120 | − cpi->mb.coefband_trans_8x8plus); | |
| 118 | + const uint8_t *const band_translate = get_band_translate(tx_size); | |
| 121 | 119 | const int seg_eob = get_tx_eob(&cpi->common.seg, segment_id, tx_size); |
| 122 | 120 | int aoff, loff; |
| 123 | 121 | txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff); |