OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, int type, ENTROPY_CONTEXT *a,
ENTROPY_CONTEXT *l) | 521 static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, int type, ENTROPY_CONTEXT *a,
ENTROPY_CONTEXT *l) |
522 { | 522 { |
523 int c = !type; /* start at coef 0, unless Y with Y2 */ | 523 int c = !type; /* start at coef 0, unless Y with Y2 */ |
524 int eob = (int)(*b->eob); | 524 int eob = (int)(*b->eob); |
525 int pt ; /* surrounding block/prev coef predictor */ | 525 int pt ; /* surrounding block/prev coef predictor */ |
526 int cost = 0; | 526 int cost = 0; |
527 short *qcoeff_ptr = b->qcoeff; | 527 short *qcoeff_ptr = b->qcoeff; |
528 | 528 |
529 VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l); | 529 VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l); |
530 | 530 |
531 # define QC( I) ( qcoeff_ptr [vp8_default_zig_zag1d[I]] ) | 531 assert(eob <= 16); |
532 | |
533 for (; c < eob; c++) | 532 for (; c < eob; c++) |
534 { | 533 { |
535 int v = QC(c); | 534 const int v = qcoeff_ptr[vp8_default_zig_zag1d[c]]; |
536 int t = vp8_dct_value_tokens_ptr[v].Token; | 535 const int t = vp8_dct_value_tokens_ptr[v].Token; |
537 cost += mb->token_costs [type] [vp8_coef_bands[c]] [pt] [t]; | 536 cost += mb->token_costs [type] [vp8_coef_bands[c]] [pt] [t]; |
538 cost += vp8_dct_value_cost_ptr[v]; | 537 cost += vp8_dct_value_cost_ptr[v]; |
539 pt = vp8_prev_token_class[t]; | 538 pt = vp8_prev_token_class[t]; |
540 } | 539 } |
541 | 540 |
542 # undef QC | |
543 | |
544 if (c < 16) | 541 if (c < 16) |
545 cost += mb->token_costs [type] [vp8_coef_bands[c]] [pt] [DCT_EOB_TOKEN]; | 542 cost += mb->token_costs [type] [vp8_coef_bands[c]] [pt] [DCT_EOB_TOKEN]; |
546 | 543 |
547 pt = (c != !type); /* is eob first coefficient; */ | 544 pt = (c != !type); /* is eob first coefficient; */ |
548 *a = *l = pt; | 545 *a = *l = pt; |
549 | 546 |
550 return cost; | 547 return cost; |
551 } | 548 } |
552 | 549 |
553 static int vp8_rdcost_mby(MACROBLOCK *mb) | 550 static int vp8_rdcost_mby(MACROBLOCK *mb) |
(...skipping 2079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2633 x->e_mbd.mode_info_context->mbmi.mode = B_PRED; | 2630 x->e_mbd.mode_info_context->mbmi.mode = B_PRED; |
2634 rate += rate4x4; | 2631 rate += rate4x4; |
2635 } | 2632 } |
2636 else | 2633 else |
2637 { | 2634 { |
2638 rate += rate16x16; | 2635 rate += rate16x16; |
2639 } | 2636 } |
2640 | 2637 |
2641 *rate_ = rate; | 2638 *rate_ = rate; |
2642 } | 2639 } |
OLD | NEW |