Unified · Split
| @@ -328,6 +328,15 @@ static void intra_pred_lp_top(uint8_t *d,uint8_t *top,uint8_t *left,int stride) · 327 unmodified lines | ||
| 328 | 328 | |
| 329 | 329 | #undef LOWPASS |
| 330 | 330 | |
| 331 | +static inline void modify_pred(const int8_t *mod_table, int *mode) | |
| 332 | +{ | |
| 333 | + *mode = mod_table[*mode]; | |
| 334 | + if(*mode < 0) { | |
| 335 | + av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n"); | |
| 336 | + *mode = 0; | |
| 337 | + } | |
| 338 | +} | |
| 339 | + | |
| 331 | 340 | void ff_cavs_modify_mb_i(AVSContext *h, int *pred_mode_uv) { |
| 332 | 341 | /* save pred modes before they get modified */ |
| 333 | 342 | h->pred_mode_Y[3] = h->pred_mode_Y[5]; |
| @@ -229,25 +229,6 @@ extern const uint8_t ff_cavs_partition_flags[30]; · 228 unmodified lines | ||
| 229 | 229 | extern const cavs_vector ff_cavs_intra_mv; |
| 230 | 230 | extern const cavs_vector ff_cavs_dir_mv; |
| 231 | 231 | |
| 232 | −static inline void modify_pred(const int8_t *mod_table, int *mode) | |
| 233 | −{ | |
| 234 | − *mode = mod_table[*mode]; | |
| 235 | − if(*mode < 0) { | |
| 236 | − av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n"); | |
| 237 | − *mode = 0; | |
| 238 | − } | |
| 239 | −} | |
| 240 | − | |
| 241 | −static inline void set_intra_mode_default(AVSContext *h) { | |
| 242 | − if(h->stream_revision > 0) { | |
| 243 | − h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL; | |
| 244 | − h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = NOT_AVAIL; | |
| 245 | − } else { | |
| 246 | − h->pred_mode_Y[3] = h->pred_mode_Y[6] = INTRA_L_LP; | |
| 247 | − h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = INTRA_L_LP; | |
| 248 | − } | |
| 249 | −} | |
| 250 | − | |
| 251 | 232 | static inline void set_mvs(cavs_vector *mv, enum cavs_block size) { |
| 252 | 233 | switch(size) { |
| 253 | 234 | case BLK_16X16: |
| @@ -262,35 +243,6 @@ static inline void set_mvs(cavs_vector *mv, enum cavs_block size) { · 8 unmodified lines | ||
| 262 | 243 | } |
| 263 | 244 | } |
| 264 | 245 | |
| 265 | −static inline void set_mv_intra(AVSContext *h) { | |
| 266 | − h->mv[MV_FWD_X0] = ff_cavs_intra_mv; | |
| 267 | − set_mvs(&h->mv[MV_FWD_X0], BLK_16X16); | |
| 268 | − h->mv[MV_BWD_X0] = ff_cavs_intra_mv; | |
| 269 | − set_mvs(&h->mv[MV_BWD_X0], BLK_16X16); | |
| 270 | − if(h->pic_type != AV_PICTURE_TYPE_B) | |
| 271 | − h->col_type_base[h->mbidx] = I_8X8; | |
| 272 | −} | |
| 273 | − | |
| 274 | −static inline int dequant(AVSContext *h, DCTELEM *level_buf, uint8_t *run_buf, | |
| 275 | − DCTELEM *dst, int mul, int shift, int coeff_num) { | |
| 276 | − int round = 1 << (shift - 1); | |
| 277 | − int pos = -1; | |
| 278 | − const uint8_t *scantab = h->scantable.permutated; | |
| 279 | − | |
| 280 | − /* inverse scan and dequantization */ | |
| 281 | − while(--coeff_num >= 0){ | |
| 282 | − pos += run_buf[coeff_num]; | |
| 283 | − if(pos > 63) { | |
| 284 | − av_log(h->s.avctx, AV_LOG_ERROR, | |
| 285 | − "position out of block bounds at pic %d MB(%d,%d)\n", | |
| 286 | − h->picture.poc, h->mbx, h->mby); | |
| 287 | − return -1; | |
| 288 | − } | |
| 289 | − dst[scantab[pos]] = (level_buf[coeff_num]*mul + round) >> shift; | |
| 290 | − } | |
| 291 | − return 0; | |
| 292 | −} | |
| 293 | − | |
| 294 | 246 | void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type); |
| 295 | 247 | void ff_cavs_load_intra_pred_luma(AVSContext *h, uint8_t *top, uint8_t **left, |
| 296 | 248 | int block); |
| @@ -511,6 +511,26 @@ static inline int get_ue_code(GetBitContext *gb, int order) { · 510 unmodified lines | ||
| 511 | 511 | return get_ue_golomb(gb); |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | +static inline int dequant(AVSContext *h, DCTELEM *level_buf, uint8_t *run_buf, | |
| 515 | + DCTELEM *dst, int mul, int shift, int coeff_num) { | |
| 516 | + int round = 1 << (shift - 1); | |
| 517 | + int pos = -1; | |
| 518 | + const uint8_t *scantab = h->scantable.permutated; | |
| 519 | + | |
| 520 | + /* inverse scan and dequantization */ | |
| 521 | + while(--coeff_num >= 0){ | |
| 522 | + pos += run_buf[coeff_num]; | |
| 523 | + if(pos > 63) { | |
| 524 | + av_log(h->s.avctx, AV_LOG_ERROR, | |
| 525 | + "position out of block bounds at pic %d MB(%d,%d)\n", | |
| 526 | + h->picture.poc, h->mbx, h->mby); | |
| 527 | + return -1; | |
| 528 | + } | |
| 529 | + dst[scantab[pos]] = (level_buf[coeff_num]*mul + round) >> shift; | |
| 530 | + } | |
| 531 | + return 0; | |
| 532 | +} | |
| 533 | + | |
| 514 | 534 | /** |
| 515 | 535 | * decode coefficients from one 8x8 block, dequantize, inverse transform |
| 516 | 536 | * and add them to sample block |
| @@ -597,6 +617,15 @@ static inline int decode_residual_inter(AVSContext *h) { · 80 unmodified lines | ||
| 597 | 617 | * |
| 598 | 618 | ****************************************************************************/ |
| 599 | 619 | |
| 620 | +static inline void set_mv_intra(AVSContext *h) { | |
| 621 | + h->mv[MV_FWD_X0] = ff_cavs_intra_mv; | |
| 622 | + set_mvs(&h->mv[MV_FWD_X0], BLK_16X16); | |
| 623 | + h->mv[MV_BWD_X0] = ff_cavs_intra_mv; | |
| 624 | + set_mvs(&h->mv[MV_BWD_X0], BLK_16X16); | |
| 625 | + if(h->pic_type != AV_PICTURE_TYPE_B) | |
| 626 | + h->col_type_base[h->mbidx] = I_8X8; | |
| 627 | +} | |
| 628 | + | |
| 600 | 629 | static int decode_mb_i(AVSContext *h, int cbp_code) { |
| 601 | 630 | GetBitContext *gb = &h->s.gb; |
| 602 | 631 | unsigned pred_mode_uv; |
| @@ -664,6 +693,16 @@ static int decode_mb_i(AVSContext *h, int cbp_code) { · 61 unmodified lines | ||
| 664 | 693 | return 0; |
| 665 | 694 | } |
| 666 | 695 | |
| 696 | +static inline void set_intra_mode_default(AVSContext *h) { | |
| 697 | + if(h->stream_revision > 0) { | |
| 698 | + h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL; | |
| 699 | + h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = NOT_AVAIL; | |
| 700 | + } else { | |
| 701 | + h->pred_mode_Y[3] = h->pred_mode_Y[6] = INTRA_L_LP; | |
| 702 | + h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = INTRA_L_LP; | |
| 703 | + } | |
| 704 | +} | |
| 705 | + | |
| 667 | 706 | static void decode_mb_p(AVSContext *h, enum cavs_mb mb_type) { |
| 668 | 707 | GetBitContext *gb = &h->s.gb; |
| 669 | 708 | int ref[4]; |