Merge "Added skeleton for VP9 denoiser"
This commit is contained in:
commit
123cd3a52c
1
configure
vendored
1
configure
vendored
@ -272,6 +272,7 @@ EXPERIMENT_LIST="
|
||||
alpha
|
||||
multiple_arf
|
||||
spatial_svc
|
||||
denoising
|
||||
"
|
||||
CONFIG_LIST="
|
||||
external_build
|
||||
|
49
vp9/encoder/vp9_denoiser.c
Normal file
49
vp9/encoder/vp9_denoiser.c
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "vp9/encoder/vp9_denoiser.h"
|
||||
#include "vpx_scale/yv12config.h"
|
||||
|
||||
static const int widths[] = {4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64};
|
||||
static const int heights[] = {4, 8, 4, 8, 16, 8, 16, 32, 16, 32, 64, 32, 64};
|
||||
|
||||
int vp9_denoiser_filter() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vp9_denoiser_denoise(VP9_DENOISER *denoiser,
|
||||
MACROBLOCK *mb, MODE_INFO **grid,
|
||||
int mi_row, int mi_col, BLOCK_SIZE bs) {
|
||||
return;
|
||||
}
|
||||
|
||||
void vp9_denoiser_update_frame_info(VP9_DENOISER *denoiser,
|
||||
FRAME_TYPE frame_type,
|
||||
int refresh_alt_ref_frame,
|
||||
int refresh_golden_frame,
|
||||
int refresh_last_frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
void vp9_denoiser_update_frame_stats() {
|
||||
return;
|
||||
}
|
||||
|
||||
int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height,
|
||||
int border) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vp9_denoiser_free(VP9_DENOISER *denoiser) {
|
||||
return;
|
||||
}
|
||||
|
51
vp9/encoder/vp9_denoiser.h
Normal file
51
vp9/encoder/vp9_denoiser.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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_DENOISER_H_
|
||||
#define VP9_ENCODER_DENOISER_H_
|
||||
|
||||
#include "vp9/encoder/vp9_block.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum vp9_denoiser_decision {
|
||||
COPY_BLOCK,
|
||||
FILTER_BLOCK
|
||||
};
|
||||
|
||||
typedef struct vp9_denoiser {
|
||||
struct buf_2d running_avg_y;
|
||||
struct buf_2d mc_running_avg_y;
|
||||
} VP9_DENOISER;
|
||||
|
||||
void vp9_denoiser_update_frame_info(VP9_DENOISER *denoiser,
|
||||
FRAME_TYPE frame_type,
|
||||
int refresh_alt_ref_frame,
|
||||
int refresh_golden_frame,
|
||||
int refresh_last_frame);
|
||||
|
||||
void vp9_denoiser_denoise(VP9_DENOISER *denoiser,
|
||||
MACROBLOCK *mb, MODE_INFO **grid,
|
||||
int mi_row, int mi_col, BLOCK_SIZE bs);
|
||||
|
||||
void vp9_denoiser_update_frame_stats();
|
||||
|
||||
int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height,
|
||||
int border);
|
||||
|
||||
void vp9_denoiser_free(VP9_DENOISER *denoiser);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // VP9_ENCODER_DENOISER_H_
|
@ -680,6 +680,11 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
||||
|
||||
cpi->ext_refresh_frame_flags_pending = 0;
|
||||
cpi->ext_refresh_frame_context_pending = 0;
|
||||
|
||||
#if CONFIG_DENOISING
|
||||
vp9_denoiser_alloc(&(cpi->denoiser), cm->width, cm->height,
|
||||
VP9_ENC_BORDER_IN_PIXELS);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef M_LOG2_E
|
||||
@ -1085,6 +1090,10 @@ void vp9_remove_compressor(VP9_COMP *cpi) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_DENOISING
|
||||
vp9_denoiser_free(&(cpi->denoiser));
|
||||
#endif
|
||||
|
||||
dealloc_compressor_data(cpi);
|
||||
vpx_free(cpi->tok);
|
||||
|
||||
@ -1547,6 +1556,13 @@ void vp9_update_reference_frames(VP9_COMP *cpi) {
|
||||
ref_cnt_fb(cm->frame_bufs,
|
||||
&cm->ref_frame_map[cpi->lst_fb_idx], cm->new_fb_idx);
|
||||
}
|
||||
#if CONFIG_DENOISING
|
||||
vp9_denoiser_update_frame_info(&cpi->denoiser,
|
||||
cpi->common.frame_type,
|
||||
cpi->refresh_alt_ref_frame,
|
||||
cpi->refresh_golden_frame,
|
||||
cpi->refresh_last_frame);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) {
|
||||
|
@ -36,6 +36,9 @@
|
||||
#include "vp9/encoder/vp9_svc_layercontext.h"
|
||||
#include "vp9/encoder/vp9_tokenize.h"
|
||||
#include "vp9/encoder/vp9_variance.h"
|
||||
#if CONFIG_DENOISING
|
||||
#include "vp9/encoder/vp9_denoiser.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -526,6 +529,10 @@ typedef struct VP9_COMP {
|
||||
int this_frame_weight;
|
||||
int max_arf_level;
|
||||
#endif
|
||||
|
||||
#if CONFIG_DENOISING
|
||||
VP9_DENOISER denoiser;
|
||||
#endif
|
||||
} VP9_COMP;
|
||||
|
||||
void vp9_initialize_enc();
|
||||
|
@ -438,6 +438,10 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_DENOISING
|
||||
vp9_denoiser_update_frame_stats();
|
||||
#endif
|
||||
|
||||
if (this_rd < best_rd || x->skip) {
|
||||
best_rd = this_rd;
|
||||
*returnrate = rate;
|
||||
@ -453,6 +457,7 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mbmi->mode = best_mode;
|
||||
mbmi->interp_filter = best_pred_filter;
|
||||
mbmi->ref_frame[0] = best_ref_frame;
|
||||
@ -488,6 +493,10 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
}
|
||||
}
|
||||
}
|
||||
#if CONFIG_DENOISING
|
||||
vp9_denoiser_denoise(&cpi->denoiser, x, cpi->common.mi_grid_visible, mi_row,
|
||||
mi_col, bsize);
|
||||
#endif
|
||||
|
||||
return INT64_MAX;
|
||||
}
|
||||
|
@ -23,6 +23,8 @@ VP9_CX_SRCS-yes += encoder/vp9_context_tree.h
|
||||
VP9_CX_SRCS-yes += encoder/vp9_cost.h
|
||||
VP9_CX_SRCS-yes += encoder/vp9_cost.c
|
||||
VP9_CX_SRCS-yes += encoder/vp9_dct.c
|
||||
VP9_CX_SRCS-$(CONFIG_DENOISING) += encoder/vp9_denoiser.c
|
||||
VP9_CX_SRCS-$(CONFIG_DENOISING) += encoder/vp9_denoiser.h
|
||||
VP9_CX_SRCS-yes += encoder/vp9_encodeframe.c
|
||||
VP9_CX_SRCS-yes += encoder/vp9_encodeframe.h
|
||||
VP9_CX_SRCS-yes += encoder/vp9_encodemb.c
|
||||
|
Loading…
Reference in New Issue
Block a user