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

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

Issue 1169543007: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_aq_variance.c ('k') | source/libvpx/vp9/encoder/vp9_encoder.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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 set_offsets(cpi, tile, x, mi_row, mi_col, BLOCK_64X64); 680 set_offsets(cpi, tile, x, mi_row, mi_col, BLOCK_64X64);
681 681
682 if (xd->mb_to_right_edge < 0) 682 if (xd->mb_to_right_edge < 0)
683 pixels_wide += (xd->mb_to_right_edge >> 3); 683 pixels_wide += (xd->mb_to_right_edge >> 3);
684 if (xd->mb_to_bottom_edge < 0) 684 if (xd->mb_to_bottom_edge < 0)
685 pixels_high += (xd->mb_to_bottom_edge >> 3); 685 pixels_high += (xd->mb_to_bottom_edge >> 3);
686 686
687 s = x->plane[0].src.buf; 687 s = x->plane[0].src.buf;
688 sp = x->plane[0].src.stride; 688 sp = x->plane[0].src.stride;
689 689
690 if (!is_key_frame) { 690 if (!is_key_frame && !(is_one_pass_cbr_svc(cpi) &&
691 cpi->svc.layer_context[cpi->svc.temporal_layer_id].is_key_frame)) {
692 // In the case of spatial/temporal scalable coding, the assumption here is
693 // that the temporal reference frame will always be of type LAST_FRAME.
694 // TODO(marpan): If that assumption is broken, we need to revisit this code.
691 MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; 695 MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
692 unsigned int uv_sad; 696 unsigned int uv_sad;
693 const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, LAST_FRAME); 697 const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, LAST_FRAME);
694 698
695 const YV12_BUFFER_CONFIG *yv12_g = get_ref_frame_buffer(cpi, GOLDEN_FRAME); 699 const YV12_BUFFER_CONFIG *yv12_g = NULL;
696 unsigned int y_sad, y_sad_g; 700 unsigned int y_sad, y_sad_g;
697 const BLOCK_SIZE bsize = BLOCK_32X32 701 const BLOCK_SIZE bsize = BLOCK_32X32
698 + (mi_col + 4 < cm->mi_cols) * 2 + (mi_row + 4 < cm->mi_rows); 702 + (mi_col + 4 < cm->mi_cols) * 2 + (mi_row + 4 < cm->mi_rows);
699 703
700 assert(yv12 != NULL); 704 assert(yv12 != NULL);
705
706 if (!(is_one_pass_cbr_svc(cpi) && cpi->svc.spatial_layer_id)) {
707 // For now, GOLDEN will not be used for non-zero spatial layers, since
708 // it may not be a temporal reference.
709 yv12_g = get_ref_frame_buffer(cpi, GOLDEN_FRAME);
710 }
711
701 if (yv12_g && yv12_g != yv12) { 712 if (yv12_g && yv12_g != yv12) {
702 vp9_setup_pre_planes(xd, 0, yv12_g, mi_row, mi_col, 713 vp9_setup_pre_planes(xd, 0, yv12_g, mi_row, mi_col,
703 &cm->frame_refs[GOLDEN_FRAME - 1].sf); 714 &cm->frame_refs[GOLDEN_FRAME - 1].sf);
704 y_sad_g = cpi->fn_ptr[bsize].sdf(x->plane[0].src.buf, 715 y_sad_g = cpi->fn_ptr[bsize].sdf(x->plane[0].src.buf,
705 x->plane[0].src.stride, 716 x->plane[0].src.stride,
706 xd->plane[0].pre[0].buf, 717 xd->plane[0].pre[0].buf,
707 xd->plane[0].pre[0].stride); 718 xd->plane[0].pre[0].stride);
708 } else { 719 } else {
709 y_sad_g = UINT_MAX; 720 y_sad_g = UINT_MAX;
710 } 721 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 xd->cur_buf->flags, 836 xd->cur_buf->flags,
826 #endif 837 #endif
827 pixels_wide, pixels_high); 838 pixels_wide, pixels_high);
828 if (minmax > cpi->vbp_threshold_minmax) { 839 if (minmax > cpi->vbp_threshold_minmax) {
829 force_split[split_index] = 1; 840 force_split[split_index] = 1;
830 force_split[i + 1] = 1; 841 force_split[i + 1] = 1;
831 force_split[0] = 1; 842 force_split[0] = 1;
832 } 843 }
833 } 844 }
834 } 845 }
835 if (is_key_frame || (low_res && 846 // TODO(marpan): There is an issue with variance based on 4x4 average in
847 // svc mode, don't allow it for now.
848 if (is_key_frame || (low_res && !cpi->use_svc &&
836 vt.split[i].split[j].part_variances.none.variance > 849 vt.split[i].split[j].part_variances.none.variance >
837 (thresholds[1] << 1))) { 850 (thresholds[1] << 1))) {
838 force_split[split_index] = 0; 851 force_split[split_index] = 0;
839 // Go down to 4x4 down-sampling for variance. 852 // Go down to 4x4 down-sampling for variance.
840 variance4x4downsample[i2 + j] = 1; 853 variance4x4downsample[i2 + j] = 1;
841 for (k = 0; k < 4; k++) { 854 for (k = 0; k < 4; k++) {
842 int x8_idx = x16_idx + ((k & 1) << 3); 855 int x8_idx = x16_idx + ((k & 1) << 3);
843 int y8_idx = y16_idx + ((k >> 1) << 3); 856 int y8_idx = y16_idx + ((k >> 1) << 3);
844 v8x8 *vst2 = is_key_frame ? &vst->split[k] : 857 v8x8 *vst2 = is_key_frame ? &vst->split[k] :
845 &vt2[i2 + j].split[k]; 858 &vt2[i2 + j].split[k];
(...skipping 3368 matching lines...) Expand 10 before | Expand all | Expand 10 after
4214 4227
4215 for (y = 0; y < mi_height; y++) 4228 for (y = 0; y < mi_height; y++)
4216 for (x = 0; x < mi_width; x++) 4229 for (x = 0; x < mi_width; x++)
4217 if (mi_col + x < cm->mi_cols && mi_row + y < cm->mi_rows) 4230 if (mi_col + x < cm->mi_cols && mi_row + y < cm->mi_rows)
4218 mi_8x8[mis * y + x]->mbmi.tx_size = tx_size; 4231 mi_8x8[mis * y + x]->mbmi.tx_size = tx_size;
4219 } 4232 }
4220 ++td->counts->tx.tx_totals[mbmi->tx_size]; 4233 ++td->counts->tx.tx_totals[mbmi->tx_size];
4221 ++td->counts->tx.tx_totals[get_uv_tx_size(mbmi, &xd->plane[1])]; 4234 ++td->counts->tx.tx_totals[get_uv_tx_size(mbmi, &xd->plane[1])];
4222 } 4235 }
4223 } 4236 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_aq_variance.c ('k') | source/libvpx/vp9/encoder/vp9_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698