Merge "VP9 denoiser: implemented update_frame_stats()"
This commit is contained in:
Коммит
b0959b8195
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include "vpx_scale/yv12config.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vp9/encoder/vp9_denoiser.h"
|
||||
|
@ -156,7 +157,25 @@ void vp9_denoiser_update_frame_info(VP9_DENOISER *denoiser,
|
|||
}
|
||||
}
|
||||
|
||||
void vp9_denoiser_update_frame_stats() {
|
||||
void vp9_denoiser_reset_frame_stats(VP9_DENOISER *denoiser) {
|
||||
denoiser->zero_mv_sse = UINT_MAX;
|
||||
denoiser->best_sse = UINT_MAX;
|
||||
}
|
||||
|
||||
void vp9_denoiser_update_frame_stats(VP9_DENOISER *denoiser, MB_MODE_INFO *mbmi,
|
||||
unsigned int sse, PREDICTION_MODE mode) {
|
||||
// TODO(tkopp): Use both MVs if possible
|
||||
if (mbmi->mv[0].as_int == 0 && sse < denoiser->zero_mv_sse) {
|
||||
denoiser->zero_mv_sse = sse;
|
||||
denoiser->best_zeromv_reference_frame = mbmi->ref_frame[0];
|
||||
}
|
||||
|
||||
if (mbmi->mv[0].as_int != 0 && sse < denoiser->best_sse) {
|
||||
denoiser->best_sse = sse;
|
||||
denoiser->best_sse_inter_mode = mode;
|
||||
denoiser->best_sse_mv = mbmi->mv[0];
|
||||
denoiser->best_reference_frame = mbmi->ref_frame[0];
|
||||
}
|
||||
}
|
||||
|
||||
int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height,
|
||||
|
@ -180,6 +199,8 @@ int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height,
|
|||
return 1;
|
||||
}
|
||||
|
||||
denoiser->increase_denoising = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,14 @@ enum vp9_denoiser_decision {
|
|||
typedef struct vp9_denoiser {
|
||||
YV12_BUFFER_CONFIG running_avg_y[MAX_REF_FRAMES];
|
||||
YV12_BUFFER_CONFIG mc_running_avg_y;
|
||||
|
||||
unsigned int zero_mv_sse;
|
||||
unsigned int best_sse;
|
||||
int increase_denoising;
|
||||
PREDICTION_MODE best_sse_inter_mode;
|
||||
int_mv best_sse_mv;
|
||||
MV_REFERENCE_FRAME best_reference_frame;
|
||||
MV_REFERENCE_FRAME best_zeromv_reference_frame;
|
||||
} VP9_DENOISER;
|
||||
|
||||
void vp9_denoiser_update_frame_info(VP9_DENOISER *denoiser,
|
||||
|
@ -38,7 +46,10 @@ void vp9_denoiser_update_frame_info(VP9_DENOISER *denoiser,
|
|||
void vp9_denoiser_denoise(VP9_DENOISER *denoiser, MACROBLOCK *mb,
|
||||
int mi_row, int mi_col, BLOCK_SIZE bs);
|
||||
|
||||
void vp9_denoiser_update_frame_stats();
|
||||
void vp9_denoiser_reset_frame_stats(VP9_DENOISER *denoiser);
|
||||
|
||||
void vp9_denoiser_update_frame_stats(VP9_DENOISER *denoiser, MB_MODE_INFO *mbmi,
|
||||
unsigned int sse, PREDICTION_MODE mode);
|
||||
|
||||
int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height,
|
||||
int ssx, int ssy, int border);
|
||||
|
|
|
@ -352,6 +352,10 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
|||
PRED_BUFFER *this_mode_pred = NULL;
|
||||
int i;
|
||||
|
||||
#if CONFIG_DENOISING
|
||||
vp9_denoiser_reset_frame_stats(&cpi->denoiser);
|
||||
#endif
|
||||
|
||||
if (cpi->sf.reuse_inter_pred_sby) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
tmp[i].data = &pred_buf[pixels_in_block * i];
|
||||
|
@ -637,7 +641,7 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
|||
}
|
||||
|
||||
#if CONFIG_DENOISING
|
||||
vp9_denoiser_update_frame_stats();
|
||||
vp9_denoiser_update_frame_stats(&cpi->denoiser, mbmi, sse_y, this_mode);
|
||||
#endif
|
||||
|
||||
if (this_rd < best_rd || x->skip) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче