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

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

Issue 375983002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_aq_variance.c ('k') | source/libvpx/vp9/encoder/vp9_block.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 if (cm->log2_tile_cols < max_log2_tile_cols) 883 if (cm->log2_tile_cols < max_log2_tile_cols)
884 vp9_wb_write_bit(wb, 0); 884 vp9_wb_write_bit(wb, 0);
885 885
886 // rows 886 // rows
887 vp9_wb_write_bit(wb, cm->log2_tile_rows != 0); 887 vp9_wb_write_bit(wb, cm->log2_tile_rows != 0);
888 if (cm->log2_tile_rows != 0) 888 if (cm->log2_tile_rows != 0)
889 vp9_wb_write_bit(wb, cm->log2_tile_rows != 1); 889 vp9_wb_write_bit(wb, cm->log2_tile_rows != 1);
890 } 890 }
891 891
892 static int get_refresh_mask(VP9_COMP *cpi) { 892 static int get_refresh_mask(VP9_COMP *cpi) {
893 // Should the GF or ARF be updated using the transmitted frame or buffer 893 if (!cpi->multi_arf_allowed && cpi->refresh_golden_frame &&
894 #if CONFIG_MULTIPLE_ARF 894 cpi->rc.is_src_frame_alt_ref && !cpi->use_svc) {
895 if (!cpi->multi_arf_enabled && cpi->refresh_golden_frame &&
896 !cpi->refresh_alt_ref_frame) {
897 #else
898 if (cpi->refresh_golden_frame && !cpi->refresh_alt_ref_frame &&
899 !cpi->use_svc) {
900 #endif
901 // Preserve the previously existing golden frame and update the frame in 895 // Preserve the previously existing golden frame and update the frame in
902 // the alt ref slot instead. This is highly specific to the use of 896 // the alt ref slot instead. This is highly specific to the use of
903 // alt-ref as a forward reference, and this needs to be generalized as 897 // alt-ref as a forward reference, and this needs to be generalized as
904 // other uses are implemented (like RTC/temporal scaling) 898 // other uses are implemented (like RTC/temporal scaling)
905 // 899 //
906 // gld_fb_idx and alt_fb_idx need to be swapped for future frames, but 900 // gld_fb_idx and alt_fb_idx need to be swapped for future frames, but
907 // that happens in vp9_encoder.c:update_reference_frames() so that it can 901 // that happens in vp9_encoder.c:update_reference_frames() so that it can
908 // be done outside of the recode loop. 902 // be done outside of the recode loop.
909 return (cpi->refresh_last_frame << cpi->lst_fb_idx) | 903 return (cpi->refresh_last_frame << cpi->lst_fb_idx) |
910 (cpi->refresh_golden_frame << cpi->alt_fb_idx); 904 (cpi->refresh_golden_frame << cpi->alt_fb_idx);
911 } else { 905 } else {
912 int arf_idx = cpi->alt_fb_idx; 906 int arf_idx = cpi->alt_fb_idx;
913 #if CONFIG_MULTIPLE_ARF 907 if ((cpi->pass == 2) && cpi->multi_arf_allowed) {
914 // Determine which ARF buffer to use to encode this ARF frame. 908 const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
915 if (cpi->multi_arf_enabled) { 909 arf_idx = gf_group->arf_update_idx[gf_group->index];
916 int sn = cpi->sequence_number;
917 arf_idx = (cpi->frame_coding_order[sn] < 0) ?
918 cpi->arf_buffer_idx[sn + 1] :
919 cpi->arf_buffer_idx[sn];
920 } 910 }
921 #endif
922 return (cpi->refresh_last_frame << cpi->lst_fb_idx) | 911 return (cpi->refresh_last_frame << cpi->lst_fb_idx) |
923 (cpi->refresh_golden_frame << cpi->gld_fb_idx) | 912 (cpi->refresh_golden_frame << cpi->gld_fb_idx) |
924 (cpi->refresh_alt_ref_frame << arf_idx); 913 (cpi->refresh_alt_ref_frame << arf_idx);
925 } 914 }
926 } 915 }
927 916
928 static size_t encode_tiles(VP9_COMP *cpi, uint8_t *data_ptr) { 917 static size_t encode_tiles(VP9_COMP *cpi, uint8_t *data_ptr) {
929 VP9_COMMON *const cm = &cpi->common; 918 VP9_COMMON *const cm = &cpi->common;
930 vp9_writer residual_bc; 919 vp9_writer residual_bc;
931 920
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 first_part_size = write_compressed_header(cpi, data); 1204 first_part_size = write_compressed_header(cpi, data);
1216 data += first_part_size; 1205 data += first_part_size;
1217 // TODO(jbb): Figure out what to do if first_part_size > 16 bits. 1206 // TODO(jbb): Figure out what to do if first_part_size > 16 bits.
1218 vp9_wb_write_literal(&saved_wb, (int)first_part_size, 16); 1207 vp9_wb_write_literal(&saved_wb, (int)first_part_size, 16);
1219 1208
1220 data += encode_tiles(cpi, data); 1209 data += encode_tiles(cpi, data);
1221 1210
1222 *size = data - dest; 1211 *size = data - dest;
1223 } 1212 }
1224 1213
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_aq_variance.c ('k') | source/libvpx/vp9/encoder/vp9_block.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698