Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: source/libvpx/vp9/encoder/vp9_bitstream.c

Issue 898943004: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
620 for (i = 0; i < PLANE_TYPES; ++i) { 614 for (i = 0; i < PLANE_TYPES; ++i) {
621 for (j = 0; j < REF_TYPES; ++j) { 615 for (j = 0; j < REF_TYPES; ++j) {
622 for (k = 0; k < COEF_BANDS; ++k) { 616 for (k = 0; k < COEF_BANDS; ++k) {
623 for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) { 617 for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
624 // calc probs and branch cts for this frame only 618 // calc probs and branch cts for this frame only
625 for (t = 0; t < entropy_nodes_update; ++t) { 619 for (t = 0; t < entropy_nodes_update; ++t) {
626 vp9_prob newp = new_coef_probs[i][j][k][l][t]; 620 vp9_prob newp = new_coef_probs[i][j][k][l][t];
627 vp9_prob *oldp = old_coef_probs[i][j][k][l] + t; 621 vp9_prob *oldp = old_coef_probs[i][j][k][l] + t;
628 int s; 622 int s;
629 int u = 0; 623 int u = 0;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 } 655 }
662 } 656 }
663 } 657 }
664 } 658 }
665 } 659 }
666 if (updates == 0) { 660 if (updates == 0) {
667 vp9_write_bit(bc, 0); // no updates 661 vp9_write_bit(bc, 0); // no updates
668 } 662 }
669 return; 663 return;
670 } 664 }
671
672 default: 665 default:
673 assert(0); 666 assert(0);
674 } 667 }
675 } 668 }
676 669
677 static void update_coef_probs(VP9_COMP *cpi, vp9_writer* w) { 670 static void update_coef_probs(VP9_COMP *cpi, vp9_writer* w) {
678 const TX_MODE tx_mode = cpi->common.tx_mode; 671 const TX_MODE tx_mode = cpi->common.tx_mode;
679 const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode]; 672 const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode];
680 TX_SIZE tx_size; 673 TX_SIZE tx_size;
681 vp9_coeff_stats frame_branch_ct[TX_SIZES][PLANE_TYPES]; 674 for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size) {
682 vp9_coeff_probs_model frame_coef_probs[TX_SIZES][PLANE_TYPES]; 675 vp9_coeff_stats frame_branch_ct[PLANE_TYPES];
683 676 vp9_coeff_probs_model frame_coef_probs[PLANE_TYPES];
684 for (tx_size = TX_4X4; tx_size <= TX_32X32; ++tx_size) 677 if (cpi->td.counts->tx.tx_totals[tx_size] <= 20 ||
685 build_tree_distribution(cpi, tx_size, frame_branch_ct[tx_size], 678 (tx_size >= TX_16X16 && cpi->sf.tx_size_search_method == USE_TX_8X8)) {
686 frame_coef_probs[tx_size]); 679 vp9_write_bit(w, 0);
687 680 } else {
688 for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size) 681 build_tree_distribution(cpi, tx_size, frame_branch_ct,
689 update_coef_probs_common(w, cpi, tx_size, frame_branch_ct[tx_size], 682 frame_coef_probs);
690 frame_coef_probs[tx_size]); 683 update_coef_probs_common(w, cpi, tx_size, frame_branch_ct,
684 frame_coef_probs);
685 }
686 }
691 } 687 }
692 688
693 static void encode_loopfilter(struct loopfilter *lf, 689 static void encode_loopfilter(struct loopfilter *lf,
694 struct vp9_write_bit_buffer *wb) { 690 struct vp9_write_bit_buffer *wb) {
695 int i; 691 int i;
696 692
697 // Encode the loop filter level and type 693 // Encode the loop filter level and type
698 vp9_wb_write_literal(wb, lf->filter_level, 6); 694 vp9_wb_write_literal(wb, lf->filter_level, 6);
699 vp9_wb_write_literal(wb, lf->sharpness_level, 3); 695 vp9_wb_write_literal(wb, lf->sharpness_level, 3);
700 696
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 1236
1241 first_part_size = write_compressed_header(cpi, data); 1237 first_part_size = write_compressed_header(cpi, data);
1242 data += first_part_size; 1238 data += first_part_size;
1243 // TODO(jbb): Figure out what to do if first_part_size > 16 bits. 1239 // TODO(jbb): Figure out what to do if first_part_size > 16 bits.
1244 vp9_wb_write_literal(&saved_wb, (int)first_part_size, 16); 1240 vp9_wb_write_literal(&saved_wb, (int)first_part_size, 16);
1245 1241
1246 data += encode_tiles(cpi, data); 1242 data += encode_tiles(cpi, data);
1247 1243
1248 *size = data - dest; 1244 *size = data - dest;
1249 } 1245 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_aq_cyclicrefresh.c ('k') | source/libvpx/vp9/encoder/vp9_denoiser.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698