diff options
author | Tim Kopp <tkopp@google.com> | 2014-06-18 08:30:07 -0700 |
---|---|---|
committer | Tim Kopp <tkopp@google.com> | 2014-07-01 14:07:40 -0700 |
commit | 2f71de77f00c222aab6dfd37e3b8a1273595e0aa (patch) | |
tree | f9d8ecdb5771810ccaa48b474bc33ec599a2b923 /vp9 | |
parent | 19cbf5414394d0a45f06e25556433c0b6976aaca (diff) | |
download | libvpx-2f71de77f00c222aab6dfd37e3b8a1273595e0aa.tar libvpx-2f71de77f00c222aab6dfd37e3b8a1273595e0aa.tar.gz libvpx-2f71de77f00c222aab6dfd37e3b8a1273595e0aa.tar.bz2 libvpx-2f71de77f00c222aab6dfd37e3b8a1273595e0aa.zip |
Denoised output is now grayscale
Grayscale is conditionally compiled.
Change-Id: I482ab237560d0bae8d397fd9999e78d38104f2a1
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/encoder/vp9_denoiser.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/vp9/encoder/vp9_denoiser.c b/vp9/encoder/vp9_denoiser.c index ff66abb0c..4eab79392 100644 --- a/vp9/encoder/vp9_denoiser.c +++ b/vp9/encoder/vp9_denoiser.c @@ -15,6 +15,10 @@ #include "vp9/common/vp9_reconinter.h" #include "vp9/encoder/vp9_denoiser.h" +#ifdef OUTPUT_YUV_DENOISED +static void make_grayscale(YV12_BUFFER_CONFIG *yuv); +#endif + 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}; @@ -325,6 +329,9 @@ int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height, vp9_denoiser_free(denoiser); return 1; } +#ifdef OUTPUT_YUV_DENOISED + make_grayscale(&denoiser->running_avg_y[i]); +#endif } fail = vp9_alloc_frame_buffer(&denoiser->mc_running_avg_y, width, height, @@ -333,7 +340,9 @@ int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height, vp9_denoiser_free(denoiser); return 1; } - +#ifdef OUTPUT_YUV_DENOISED + make_grayscale(&denoiser->running_avg_y[i]); +#endif denoiser->increase_denoising = 0; return 0; @@ -353,3 +362,22 @@ void vp9_denoiser_free(VP9_DENOISER *denoiser) { vp9_free_frame_buffer(&denoiser->mc_running_avg_y); } } + +#ifdef OUTPUT_YUV_DENOISED +static void make_grayscale(YV12_BUFFER_CONFIG *yuv) { + int r, c; + uint8_t *u = yuv->u_buffer; + uint8_t *v = yuv->v_buffer; + + // The '/2's are there because we have a 440 buffer, but we want to output + // 420. + for (r = 0; r < yuv->uv_height / 2; ++r) { + for (c = 0; c < yuv->uv_width / 2; ++c) { + u[c] = UINT8_MAX / 2; + v[c] = UINT8_MAX / 2; + } + u += yuv->uv_stride + yuv->uv_width / 2; + v += yuv->uv_stride + yuv->uv_width / 2; + } +} +#endif |