4d2c376923
In the partition search, the encoder checks all possible partitionings in the superblock's partition search tree. This patch proposed a set of criteria for partition search early termination, which effectively decided whether or not to terminate the search in current branch based on the "skippable" result of the quantized transform coefficients. The "skippable" information was gathered during the partition mode search, and no overhead calculations were introduced. This patch gives significant encoding speed gains without sacrificing the quality. Borg test results: 1. At speed 1, stdhd set: psnr: +0.074%, ssim: +0.093%; derf set: psnr: -0.024%, ssim: +0.011%; 2. At speed 2, stdhd set: psnr: +0.033%, ssim: +0.100%; derf set: psnr: -0.062%, ssim: +0.003%; 3. At speed 3, stdhd set: psnr: +0.060%, ssim: +0.190%; derf set: psnr: -0.064%, ssim: -0.002%; 4. At speed 4, stdhd set: psnr: +0.070%, ssim: +0.143%; derf set: psnr: -0.104%, ssim: +0.039%; The speedup ranges from several percent to 60+%. speed1 speed2 speed3 speed4 (1080p, 100f): old_town_cross: 48.2% 23.9% 20.8% 16.5% park_joy: 11.4% 17.8% 29.4% 18.2% pedestrian_area: 10.7% 4.0% 4.2% 2.4% (720p, 200f): mobcal: 68.1% 36.3% 34.4% 17.7% parkrun: 15.8% 24.2% 37.1% 16.8% shields: 45.1% 32.8% 30.1% 9.6% (cif, 300f) bus: 3.7% 10.4% 14.0% 7.9% deadline: 13.6% 14.8% 12.6% 10.9% mobile: 5.3% 11.5% 14.7% 10.7% Change-Id: I246c38fb952ad762ce5e365711235b605f470a66
79 lines
2.3 KiB
C
79 lines
2.3 KiB
C
/*
|
|
* Copyright (c) 2014 The WebM project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef VP9_ENCODER_VP9_CONTEXT_TREE_H_
|
|
#define VP9_ENCODER_VP9_CONTEXT_TREE_H_
|
|
|
|
#include "vp9/common/vp9_onyxc_int.h"
|
|
|
|
struct VP9_COMP;
|
|
|
|
// Structure to hold snapshot of coding context during the mode picking process
|
|
typedef struct {
|
|
MODE_INFO mic;
|
|
uint8_t *zcoeff_blk;
|
|
int16_t *coeff[MAX_MB_PLANE][3];
|
|
int16_t *qcoeff[MAX_MB_PLANE][3];
|
|
int16_t *dqcoeff[MAX_MB_PLANE][3];
|
|
uint16_t *eobs[MAX_MB_PLANE][3];
|
|
|
|
// dual buffer pointers, 0: in use, 1: best in store
|
|
int16_t *coeff_pbuf[MAX_MB_PLANE][3];
|
|
int16_t *qcoeff_pbuf[MAX_MB_PLANE][3];
|
|
int16_t *dqcoeff_pbuf[MAX_MB_PLANE][3];
|
|
uint16_t *eobs_pbuf[MAX_MB_PLANE][3];
|
|
|
|
int is_coded;
|
|
int num_4x4_blk;
|
|
int skip;
|
|
int skip_txfm[MAX_MB_PLANE];
|
|
// For current partition, only if all Y, U, and V transform blocks'
|
|
// coefficients are quantized to 0, skippable is set to 0.
|
|
int skippable;
|
|
int best_mode_index;
|
|
int hybrid_pred_diff;
|
|
int comp_pred_diff;
|
|
int single_pred_diff;
|
|
int64_t tx_rd_diff[TX_MODES];
|
|
int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
|
|
|
|
#if CONFIG_VP9_TEMPORAL_DENOISING
|
|
unsigned int newmv_sse;
|
|
unsigned int zeromv_sse;
|
|
PREDICTION_MODE best_sse_inter_mode;
|
|
int_mv best_sse_mv;
|
|
MV_REFERENCE_FRAME best_reference_frame;
|
|
MV_REFERENCE_FRAME best_zeromv_reference_frame;
|
|
#endif
|
|
|
|
// motion vector cache for adaptive motion search control in partition
|
|
// search loop
|
|
MV pred_mv[MAX_REF_FRAMES];
|
|
INTERP_FILTER pred_interp_filter;
|
|
} PICK_MODE_CONTEXT;
|
|
|
|
typedef struct PC_TREE {
|
|
int index;
|
|
PARTITION_TYPE partitioning;
|
|
BLOCK_SIZE block_size;
|
|
PICK_MODE_CONTEXT none;
|
|
PICK_MODE_CONTEXT horizontal[2];
|
|
PICK_MODE_CONTEXT vertical[2];
|
|
union {
|
|
struct PC_TREE *split[4];
|
|
PICK_MODE_CONTEXT *leaf_split[4];
|
|
};
|
|
} PC_TREE;
|
|
|
|
void vp9_setup_pc_tree(struct VP9Common *cm, struct VP9_COMP *cpi);
|
|
void vp9_free_pc_tree(struct VP9_COMP *cpi);
|
|
|
|
#endif /* VP9_ENCODER_VP9_CONTEXT_TREE_H_ */
|