Removing redundant code and function arguments.
Change-Id: Ia5cdda0f755befcd1e64397452c42cb7031ca574
This commit is contained in:
parent
125146034e
commit
67fe9d17cb
@ -61,8 +61,9 @@ static void update_sharpness(loop_filter_info_n *const lfi, int sharpness_lvl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp9_loop_filter_init(VP9_COMMON *cm, struct loopfilter *lf) {
|
void vp9_loop_filter_init(VP9_COMMON *cm) {
|
||||||
loop_filter_info_n *lfi = &cm->lf_info;
|
loop_filter_info_n *lfi = &cm->lf_info;
|
||||||
|
struct loopfilter *lf = &cm->lf;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// init limits for given sharpness
|
// init limits for given sharpness
|
||||||
|
@ -60,7 +60,7 @@ typedef struct {
|
|||||||
struct VP9Common;
|
struct VP9Common;
|
||||||
struct macroblockd;
|
struct macroblockd;
|
||||||
|
|
||||||
void vp9_loop_filter_init(struct VP9Common *cm, struct loopfilter *lf);
|
void vp9_loop_filter_init(struct VP9Common *cm);
|
||||||
|
|
||||||
// Update the loop filter for the current frame.
|
// Update the loop filter for the current frame.
|
||||||
// This should be called before vp9_loop_filter_rows(), vp9_loop_filter_frame()
|
// This should be called before vp9_loop_filter_rows(), vp9_loop_filter_frame()
|
||||||
|
@ -631,10 +631,8 @@ static void constrain_line(int x0, int *x1, int y0, int *y1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int vp9_post_proc_frame(struct VP9Common *oci,
|
int vp9_post_proc_frame(struct VP9Common *oci,
|
||||||
struct loopfilter *lf,
|
YV12_BUFFER_CONFIG *dest, vp9_ppflags_t *ppflags) {
|
||||||
YV12_BUFFER_CONFIG *dest,
|
int q = oci->lf.filter_level * 10 / 6;
|
||||||
vp9_ppflags_t *ppflags) {
|
|
||||||
int q = lf->filter_level * 10 / 6;
|
|
||||||
int flags = ppflags->post_proc_flag;
|
int flags = ppflags->post_proc_flag;
|
||||||
int deblock_level = ppflags->deblocking_level;
|
int deblock_level = ppflags->deblocking_level;
|
||||||
int noise_level = ppflags->noise_level;
|
int noise_level = ppflags->noise_level;
|
||||||
|
@ -26,7 +26,7 @@ struct postproc_state {
|
|||||||
#include "vp9/common/vp9_onyxc_int.h"
|
#include "vp9/common/vp9_onyxc_int.h"
|
||||||
#include "vp9/common/vp9_ppflags.h"
|
#include "vp9/common/vp9_ppflags.h"
|
||||||
|
|
||||||
int vp9_post_proc_frame(struct VP9Common *oci, struct loopfilter *lf,
|
int vp9_post_proc_frame(struct VP9Common *oci,
|
||||||
YV12_BUFFER_CONFIG *dest, vp9_ppflags_t *flags);
|
YV12_BUFFER_CONFIG *dest, vp9_ppflags_t *flags);
|
||||||
|
|
||||||
void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q);
|
void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q);
|
||||||
|
@ -110,35 +110,36 @@ void vp9_initialize_dec() {
|
|||||||
|
|
||||||
VP9D_PTR vp9_create_decompressor(VP9D_CONFIG *oxcf) {
|
VP9D_PTR vp9_create_decompressor(VP9D_CONFIG *oxcf) {
|
||||||
VP9D_COMP *const pbi = vpx_memalign(32, sizeof(VP9D_COMP));
|
VP9D_COMP *const pbi = vpx_memalign(32, sizeof(VP9D_COMP));
|
||||||
|
VP9_COMMON *const cm = pbi ? &pbi->common : NULL;
|
||||||
|
|
||||||
if (!pbi)
|
if (!cm)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
vp9_zero(*pbi);
|
vp9_zero(*pbi);
|
||||||
|
|
||||||
if (setjmp(pbi->common.error.jmp)) {
|
if (setjmp(cm->error.jmp)) {
|
||||||
pbi->common.error.setjmp = 0;
|
cm->error.setjmp = 0;
|
||||||
vp9_remove_decompressor(pbi);
|
vp9_remove_decompressor(pbi);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pbi->common.error.setjmp = 1;
|
cm->error.setjmp = 1;
|
||||||
vp9_initialize_dec();
|
vp9_initialize_dec();
|
||||||
|
|
||||||
vp9_create_common(&pbi->common);
|
vp9_create_common(cm);
|
||||||
|
|
||||||
pbi->oxcf = *oxcf;
|
pbi->oxcf = *oxcf;
|
||||||
pbi->common.current_video_frame = 0;
|
|
||||||
pbi->ready_for_new_data = 1;
|
pbi->ready_for_new_data = 1;
|
||||||
|
cm->current_video_frame = 0;
|
||||||
|
|
||||||
// vp9_init_dequantizer() is first called here. Add check in
|
// vp9_init_dequantizer() is first called here. Add check in
|
||||||
// frame_init_dequantizer() to avoid unnecessary calling of
|
// frame_init_dequantizer() to avoid unnecessary calling of
|
||||||
// vp9_init_dequantizer() for every frame.
|
// vp9_init_dequantizer() for every frame.
|
||||||
vp9_init_dequantizer(&pbi->common);
|
vp9_init_dequantizer(cm);
|
||||||
|
|
||||||
vp9_loop_filter_init(&pbi->common, &pbi->common.lf);
|
vp9_loop_filter_init(cm);
|
||||||
|
|
||||||
pbi->common.error.setjmp = 0;
|
cm->error.setjmp = 0;
|
||||||
pbi->decoded_key_frame = 0;
|
pbi->decoded_key_frame = 0;
|
||||||
|
|
||||||
if (pbi->oxcf.max_threads > 1) {
|
if (pbi->oxcf.max_threads > 1) {
|
||||||
@ -424,7 +425,7 @@ int vp9_get_raw_frame(VP9D_PTR ptr, YV12_BUFFER_CONFIG *sd,
|
|||||||
*time_end_stamp = 0;
|
*time_end_stamp = 0;
|
||||||
|
|
||||||
#if CONFIG_POSTPROC
|
#if CONFIG_POSTPROC
|
||||||
ret = vp9_post_proc_frame(&pbi->common, &pbi->common.lf, sd, flags);
|
ret = vp9_post_proc_frame(&pbi->common, sd, flags);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
if (pbi->common.frame_to_show) {
|
if (pbi->common.frame_to_show) {
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
extern void print_tree_update_probs();
|
extern void print_tree_update_probs();
|
||||||
|
|
||||||
static void set_default_lf_deltas(VP9_COMP *cpi);
|
static void set_default_lf_deltas(struct loopfilter *lf);
|
||||||
|
|
||||||
#define DEFAULT_INTERP_FILTER SWITCHABLE
|
#define DEFAULT_INTERP_FILTER SWITCHABLE
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ static void setup_features(VP9_COMP *cpi) {
|
|||||||
vp9_zero(lf->last_ref_deltas);
|
vp9_zero(lf->last_ref_deltas);
|
||||||
vp9_zero(lf->last_mode_deltas);
|
vp9_zero(lf->last_mode_deltas);
|
||||||
|
|
||||||
set_default_lf_deltas(cpi);
|
set_default_lf_deltas(lf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dealloc_compressor_data(VP9_COMP *cpi) {
|
static void dealloc_compressor_data(VP9_COMP *cpi) {
|
||||||
@ -542,9 +542,7 @@ static void update_reference_segmentation_map(VP9_COMP *cpi) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_default_lf_deltas(VP9_COMP *cpi) {
|
static void set_default_lf_deltas(struct loopfilter *lf) {
|
||||||
struct loopfilter *lf = &cpi->common.lf;
|
|
||||||
|
|
||||||
lf->mode_ref_delta_enabled = 1;
|
lf->mode_ref_delta_enabled = 1;
|
||||||
lf->mode_ref_delta_update = 1;
|
lf->mode_ref_delta_update = 1;
|
||||||
|
|
||||||
@ -1705,7 +1703,7 @@ VP9_PTR vp9_create_compressor(VP9_CONFIG *oxcf) {
|
|||||||
*/
|
*/
|
||||||
vp9_init_quantizer(cpi);
|
vp9_init_quantizer(cpi);
|
||||||
|
|
||||||
vp9_loop_filter_init(cm, &cpi->common.lf);
|
vp9_loop_filter_init(cm);
|
||||||
|
|
||||||
cpi->common.error.setjmp = 0;
|
cpi->common.error.setjmp = 0;
|
||||||
|
|
||||||
@ -3990,7 +3988,7 @@ int vp9_get_preview_raw_frame(VP9_PTR comp, YV12_BUFFER_CONFIG *dest,
|
|||||||
else {
|
else {
|
||||||
int ret;
|
int ret;
|
||||||
#if CONFIG_POSTPROC
|
#if CONFIG_POSTPROC
|
||||||
ret = vp9_post_proc_frame(&cpi->common, &cpi->common.lf, dest, flags);
|
ret = vp9_post_proc_frame(&cpi->common, dest, flags);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
if (cpi->common.frame_to_show) {
|
if (cpi->common.frame_to_show) {
|
||||||
|
@ -21,29 +21,15 @@
|
|||||||
#include "./vpx_scale_rtcd.h"
|
#include "./vpx_scale_rtcd.h"
|
||||||
|
|
||||||
void vp9_yv12_copy_partial_frame_c(YV12_BUFFER_CONFIG *src_ybc,
|
void vp9_yv12_copy_partial_frame_c(YV12_BUFFER_CONFIG *src_ybc,
|
||||||
YV12_BUFFER_CONFIG *dst_ybc, int Fraction) {
|
YV12_BUFFER_CONFIG *dst_ybc, int fraction) {
|
||||||
uint8_t *src_y, *dst_y;
|
const int height = src_ybc->y_height;
|
||||||
int yheight;
|
const int stride = src_ybc->y_stride;
|
||||||
int ystride;
|
const int offset = stride * ((height >> 5) * 16 - 8);
|
||||||
int yoffset;
|
const int lines_to_copy = MAX(height >> (fraction + 4), 1) << 4;
|
||||||
int linestocopy;
|
|
||||||
|
|
||||||
assert(src_ybc->y_stride == dst_ybc->y_stride);
|
assert(src_ybc->y_stride == dst_ybc->y_stride);
|
||||||
yheight = src_ybc->y_height;
|
vpx_memcpy(dst_ybc->y_buffer + offset, src_ybc->y_buffer + offset,
|
||||||
ystride = src_ybc->y_stride;
|
stride * (lines_to_copy + 16));
|
||||||
|
|
||||||
linestocopy = (yheight >> (Fraction + 4));
|
|
||||||
|
|
||||||
if (linestocopy < 1)
|
|
||||||
linestocopy = 1;
|
|
||||||
|
|
||||||
linestocopy <<= 4;
|
|
||||||
|
|
||||||
yoffset = ystride * ((yheight >> 5) * 16 - 8);
|
|
||||||
src_y = src_ybc->y_buffer + yoffset;
|
|
||||||
dst_y = dst_ybc->y_buffer + yoffset;
|
|
||||||
|
|
||||||
vpx_memcpy(dst_y, src_y, ystride * (linestocopy + 16));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int calc_partial_ssl_err(YV12_BUFFER_CONFIG *source,
|
static int calc_partial_ssl_err(YV12_BUFFER_CONFIG *source,
|
||||||
@ -126,13 +112,13 @@ void vp9_set_alt_lf_level(VP9_COMP *cpi, int filt_val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi, int partial) {
|
void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi, int partial) {
|
||||||
VP9_COMMON *cm = &cpi->common;
|
VP9_COMMON *const cm = &cpi->common;
|
||||||
struct loopfilter *lf = &cpi->common.lf;
|
struct loopfilter *const lf = &cm->lf;
|
||||||
|
|
||||||
int best_err = 0;
|
int best_err = 0;
|
||||||
int filt_err = 0;
|
int filt_err = 0;
|
||||||
int min_filter_level = get_min_filter_level(cpi, cm->base_qindex);
|
const int min_filter_level = get_min_filter_level(cpi, cm->base_qindex);
|
||||||
int max_filter_level = get_max_filter_level(cpi, cm->base_qindex);
|
const int max_filter_level = get_max_filter_level(cpi, cm->base_qindex);
|
||||||
|
|
||||||
int filter_step;
|
int filter_step;
|
||||||
int filt_high = 0;
|
int filt_high = 0;
|
||||||
@ -147,21 +133,14 @@ void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi, int partial) {
|
|||||||
// Make a copy of the unfiltered / processed recon buffer
|
// Make a copy of the unfiltered / processed recon buffer
|
||||||
vpx_yv12_copy_y(cm->frame_to_show, &cpi->last_frame_uf);
|
vpx_yv12_copy_y(cm->frame_to_show, &cpi->last_frame_uf);
|
||||||
|
|
||||||
if (cm->frame_type == KEY_FRAME)
|
lf->sharpness_level = cm->frame_type == KEY_FRAME ? 0
|
||||||
lf->sharpness_level = 0;
|
: cpi->oxcf.Sharpness;
|
||||||
else
|
|
||||||
lf->sharpness_level = cpi->oxcf.Sharpness;
|
|
||||||
|
|
||||||
// Start the search at the previous frame filter level unless it is now out of range.
|
// Start the search at the previous frame filter level unless it is now out of range.
|
||||||
filt_mid = lf->filter_level;
|
filt_mid = clamp(lf->filter_level, min_filter_level, max_filter_level);
|
||||||
|
|
||||||
if (filt_mid < min_filter_level)
|
|
||||||
filt_mid = min_filter_level;
|
|
||||||
else if (filt_mid > max_filter_level)
|
|
||||||
filt_mid = max_filter_level;
|
|
||||||
|
|
||||||
// Define the initial step size
|
// Define the initial step size
|
||||||
filter_step = (filt_mid < 16) ? 4 : filt_mid / 4;
|
filter_step = filt_mid < 16 ? 4 : filt_mid / 4;
|
||||||
|
|
||||||
// Get baseline error score
|
// Get baseline error score
|
||||||
vp9_set_alt_lf_level(cpi, filt_mid);
|
vp9_set_alt_lf_level(cpi, filt_mid);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user