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

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

Issue 111463005: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years 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_lookahead.c ('k') | source/libvpx/vp9/encoder/vp9_mcomp.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
11 #include <limits.h> 11 #include <limits.h>
12 12
13 #include "vpx_mem/vpx_mem.h" 13 #include "vpx_mem/vpx_mem.h"
14 #include "vp9/encoder/vp9_encodeintra.h"
15 #include "vp9/encoder/vp9_rdopt.h" 14 #include "vp9/encoder/vp9_rdopt.h"
16 #include "vp9/encoder/vp9_segmentation.h" 15 #include "vp9/encoder/vp9_segmentation.h"
17 #include "vp9/encoder/vp9_mcomp.h" 16 #include "vp9/encoder/vp9_mcomp.h"
18 #include "vp9/common/vp9_blockd.h" 17 #include "vp9/common/vp9_blockd.h"
19 #include "vp9/common/vp9_reconinter.h" 18 #include "vp9/common/vp9_reconinter.h"
20 #include "vp9/common/vp9_reconintra.h" 19 #include "vp9/common/vp9_reconintra.h"
21 #include "vp9/common/vp9_systemdependent.h" 20 #include "vp9/common/vp9_systemdependent.h"
22 21
23 22
24 23
(...skipping 11 matching lines...) Expand all
36 const int tmp_col_max = x->mv_col_max; 35 const int tmp_col_max = x->mv_col_max;
37 const int tmp_row_min = x->mv_row_min; 36 const int tmp_row_min = x->mv_row_min;
38 const int tmp_row_max = x->mv_row_max; 37 const int tmp_row_max = x->mv_row_max;
39 int_mv ref_full; 38 int_mv ref_full;
40 39
41 // Further step/diamond searches as necessary 40 // Further step/diamond searches as necessary
42 int step_param = cpi->sf.reduce_first_step_size + 41 int step_param = cpi->sf.reduce_first_step_size +
43 (cpi->speed < 8 ? (cpi->speed > 5 ? 1 : 0) : 2); 42 (cpi->speed < 8 ? (cpi->speed > 5 ? 1 : 0) : 2);
44 step_param = MIN(step_param, (cpi->sf.max_step_search_steps - 2)); 43 step_param = MIN(step_param, (cpi->sf.max_step_search_steps - 2));
45 44
46 vp9_clamp_mv_min_max(x, &ref_mv->as_mv); 45 vp9_set_mv_search_range(x, &ref_mv->as_mv);
47 46
48 ref_full.as_mv.col = ref_mv->as_mv.col >> 3; 47 ref_full.as_mv.col = ref_mv->as_mv.col >> 3;
49 ref_full.as_mv.row = ref_mv->as_mv.row >> 3; 48 ref_full.as_mv.row = ref_mv->as_mv.row >> 3;
50 49
51 /*cpi->sf.search_method == HEX*/ 50 /*cpi->sf.search_method == HEX*/
52 best_err = vp9_hex_search(x, &ref_full.as_mv, step_param, x->errorperbit, 51 best_err = vp9_hex_search(x, &ref_full.as_mv, step_param, x->errorperbit,
53 0, &v_fn_ptr, 52 0, &v_fn_ptr,
54 0, &ref_mv->as_mv, &dst_mv->as_mv); 53 0, &ref_mv->as_mv, &dst_mv->as_mv);
55 54
56 // Try sub-pixel MC 55 // Try sub-pixel MC
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 int ncnt[4] = { 0 }; 316 int ncnt[4] = { 0 };
318 int n_frames = cpi->mbgraph_n_frames; 317 int n_frames = cpi->mbgraph_n_frames;
319 318
320 int *arf_not_zz; 319 int *arf_not_zz;
321 320
322 CHECK_MEM_ERROR(cm, arf_not_zz, 321 CHECK_MEM_ERROR(cm, arf_not_zz,
323 vpx_calloc(cm->mb_rows * cm->mb_cols * sizeof(*arf_not_zz), 322 vpx_calloc(cm->mb_rows * cm->mb_cols * sizeof(*arf_not_zz),
324 1)); 323 1));
325 324
326 // We are not interested in results beyond the alt ref itself. 325 // We are not interested in results beyond the alt ref itself.
327 if (n_frames > cpi->frames_till_gf_update_due) 326 if (n_frames > cpi->rc.frames_till_gf_update_due)
328 n_frames = cpi->frames_till_gf_update_due; 327 n_frames = cpi->rc.frames_till_gf_update_due;
329 328
330 // defer cost to reference frames 329 // defer cost to reference frames
331 for (i = n_frames - 1; i >= 0; i--) { 330 for (i = n_frames - 1; i >= 0; i--) {
332 MBGRAPH_FRAME_STATS *frame_stats = &cpi->mbgraph_stats[i]; 331 MBGRAPH_FRAME_STATS *frame_stats = &cpi->mbgraph_stats[i];
333 332
334 for (offset = 0, mb_row = 0; mb_row < cm->mb_rows; 333 for (offset = 0, mb_row = 0; mb_row < cm->mb_rows;
335 offset += cm->mb_cols, mb_row++) { 334 offset += cm->mb_cols, mb_row++) {
336 for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) { 335 for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
337 MBGRAPH_MB_STATS *mb_stats = &frame_stats->mb_stats[offset + mb_col]; 336 MBGRAPH_MB_STATS *mb_stats = &frame_stats->mb_stats[offset + mb_col];
338 337
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 389 }
391 390
392 void vp9_update_mbgraph_stats(VP9_COMP *cpi) { 391 void vp9_update_mbgraph_stats(VP9_COMP *cpi) {
393 VP9_COMMON *const cm = &cpi->common; 392 VP9_COMMON *const cm = &cpi->common;
394 int i, n_frames = vp9_lookahead_depth(cpi->lookahead); 393 int i, n_frames = vp9_lookahead_depth(cpi->lookahead);
395 YV12_BUFFER_CONFIG *golden_ref = 394 YV12_BUFFER_CONFIG *golden_ref =
396 &cm->yv12_fb[cm->ref_frame_map[cpi->gld_fb_idx]]; 395 &cm->yv12_fb[cm->ref_frame_map[cpi->gld_fb_idx]];
397 396
398 // we need to look ahead beyond where the ARF transitions into 397 // we need to look ahead beyond where the ARF transitions into
399 // being a GF - so exit if we don't look ahead beyond that 398 // being a GF - so exit if we don't look ahead beyond that
400 if (n_frames <= cpi->frames_till_gf_update_due) 399 if (n_frames <= cpi->rc.frames_till_gf_update_due)
401 return; 400 return;
402 if (n_frames > (int)cpi->frames_till_alt_ref_frame) 401 if (n_frames > (int)cpi->frames_till_alt_ref_frame)
403 n_frames = cpi->frames_till_alt_ref_frame; 402 n_frames = cpi->frames_till_alt_ref_frame;
404 if (n_frames > MAX_LAG_BUFFERS) 403 if (n_frames > MAX_LAG_BUFFERS)
405 n_frames = MAX_LAG_BUFFERS; 404 n_frames = MAX_LAG_BUFFERS;
406 405
407 cpi->mbgraph_n_frames = n_frames; 406 cpi->mbgraph_n_frames = n_frames;
408 for (i = 0; i < n_frames; i++) { 407 for (i = 0; i < n_frames; i++) {
409 MBGRAPH_FRAME_STATS *frame_stats = &cpi->mbgraph_stats[i]; 408 MBGRAPH_FRAME_STATS *frame_stats = &cpi->mbgraph_stats[i];
410 vpx_memset(frame_stats->mb_stats, 0, 409 vpx_memset(frame_stats->mb_stats, 0,
(...skipping 12 matching lines...) Expand all
423 assert(q_cur != NULL); 422 assert(q_cur != NULL);
424 423
425 update_mbgraph_frame_stats(cpi, frame_stats, &q_cur->img, 424 update_mbgraph_frame_stats(cpi, frame_stats, &q_cur->img,
426 golden_ref, cpi->Source); 425 golden_ref, cpi->Source);
427 } 426 }
428 427
429 vp9_clear_system_state(); // __asm emms; 428 vp9_clear_system_state(); // __asm emms;
430 429
431 separate_arf_mbs(cpi); 430 separate_arf_mbs(cpi);
432 } 431 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_lookahead.c ('k') | source/libvpx/vp9/encoder/vp9_mcomp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698