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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 } | 604 } |
605 } | 605 } |
606 } | 606 } |
607 } | 607 } |
608 return; | 608 return; |
609 } | 609 } |
610 | 610 |
611 case ONE_LOOP_REDUCED: { | 611 case ONE_LOOP_REDUCED: { |
612 int updates = 0; | 612 int updates = 0; |
613 int noupdates_before_first = 0; | 613 int noupdates_before_first = 0; |
| 614 |
| 615 if (tx_size >= TX_16X16 && cpi->sf.tx_size_search_method == USE_TX_8X8) { |
| 616 vp9_write_bit(bc, 0); |
| 617 return; |
| 618 } |
| 619 |
614 for (i = 0; i < PLANE_TYPES; ++i) { | 620 for (i = 0; i < PLANE_TYPES; ++i) { |
615 for (j = 0; j < REF_TYPES; ++j) { | 621 for (j = 0; j < REF_TYPES; ++j) { |
616 for (k = 0; k < COEF_BANDS; ++k) { | 622 for (k = 0; k < COEF_BANDS; ++k) { |
617 for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) { | 623 for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) { |
618 // calc probs and branch cts for this frame only | 624 // calc probs and branch cts for this frame only |
619 for (t = 0; t < entropy_nodes_update; ++t) { | 625 for (t = 0; t < entropy_nodes_update; ++t) { |
620 vp9_prob newp = new_coef_probs[i][j][k][l][t]; | 626 vp9_prob newp = new_coef_probs[i][j][k][l][t]; |
621 vp9_prob *oldp = old_coef_probs[i][j][k][l] + t; | 627 vp9_prob *oldp = old_coef_probs[i][j][k][l] + t; |
622 int s; | 628 int s; |
623 int u = 0; | 629 int u = 0; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 } | 661 } |
656 } | 662 } |
657 } | 663 } |
658 } | 664 } |
659 } | 665 } |
660 if (updates == 0) { | 666 if (updates == 0) { |
661 vp9_write_bit(bc, 0); // no updates | 667 vp9_write_bit(bc, 0); // no updates |
662 } | 668 } |
663 return; | 669 return; |
664 } | 670 } |
| 671 |
665 default: | 672 default: |
666 assert(0); | 673 assert(0); |
667 } | 674 } |
668 } | 675 } |
669 | 676 |
670 static void update_coef_probs(VP9_COMP *cpi, vp9_writer* w) { | 677 static void update_coef_probs(VP9_COMP *cpi, vp9_writer* w) { |
671 const TX_MODE tx_mode = cpi->common.tx_mode; | 678 const TX_MODE tx_mode = cpi->common.tx_mode; |
672 const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode]; | 679 const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode]; |
673 TX_SIZE tx_size; | 680 TX_SIZE tx_size; |
674 for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size) { | 681 vp9_coeff_stats frame_branch_ct[TX_SIZES][PLANE_TYPES]; |
675 vp9_coeff_stats frame_branch_ct[PLANE_TYPES]; | 682 vp9_coeff_probs_model frame_coef_probs[TX_SIZES][PLANE_TYPES]; |
676 vp9_coeff_probs_model frame_coef_probs[PLANE_TYPES]; | 683 |
677 if (cpi->td.counts->tx.tx_totals[tx_size] <= 20 || | 684 for (tx_size = TX_4X4; tx_size <= TX_32X32; ++tx_size) |
678 (tx_size >= TX_16X16 && cpi->sf.tx_size_search_method == USE_TX_8X8)) { | 685 build_tree_distribution(cpi, tx_size, frame_branch_ct[tx_size], |
679 vp9_write_bit(w, 0); | 686 frame_coef_probs[tx_size]); |
680 } else { | 687 |
681 build_tree_distribution(cpi, tx_size, frame_branch_ct, | 688 for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size) |
682 frame_coef_probs); | 689 update_coef_probs_common(w, cpi, tx_size, frame_branch_ct[tx_size], |
683 update_coef_probs_common(w, cpi, tx_size, frame_branch_ct, | 690 frame_coef_probs[tx_size]); |
684 frame_coef_probs); | |
685 } | |
686 } | |
687 } | 691 } |
688 | 692 |
689 static void encode_loopfilter(struct loopfilter *lf, | 693 static void encode_loopfilter(struct loopfilter *lf, |
690 struct vp9_write_bit_buffer *wb) { | 694 struct vp9_write_bit_buffer *wb) { |
691 int i; | 695 int i; |
692 | 696 |
693 // Encode the loop filter level and type | 697 // Encode the loop filter level and type |
694 vp9_wb_write_literal(wb, lf->filter_level, 6); | 698 vp9_wb_write_literal(wb, lf->filter_level, 6); |
695 vp9_wb_write_literal(wb, lf->sharpness_level, 3); | 699 vp9_wb_write_literal(wb, lf->sharpness_level, 3); |
696 | 700 |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 | 1240 |
1237 first_part_size = write_compressed_header(cpi, data); | 1241 first_part_size = write_compressed_header(cpi, data); |
1238 data += first_part_size; | 1242 data += first_part_size; |
1239 // TODO(jbb): Figure out what to do if first_part_size > 16 bits. | 1243 // TODO(jbb): Figure out what to do if first_part_size > 16 bits. |
1240 vp9_wb_write_literal(&saved_wb, (int)first_part_size, 16); | 1244 vp9_wb_write_literal(&saved_wb, (int)first_part_size, 16); |
1241 | 1245 |
1242 data += encode_tiles(cpi, data); | 1246 data += encode_tiles(cpi, data); |
1243 | 1247 |
1244 *size = data - dest; | 1248 *size = data - dest; |
1245 } | 1249 } |
OLD | NEW |