Commit cd16fe91 authored by Dmitry Kovalev's avatar Dmitry Kovalev Committed by Gerrit Code Review

Merge "Preparing vp9_deblock and vp9_denoise to alpha support." into experimental

parents 80c07153 7bbf716f
...@@ -132,14 +132,15 @@ const short vp9_rv[] = { ...@@ -132,14 +132,15 @@ const short vp9_rv[] = {
/**************************************************************************** /****************************************************************************
*/ */
void vp9_post_proc_down_and_across_c(uint8_t *src_ptr, void vp9_post_proc_down_and_across_c(const uint8_t *src_ptr,
uint8_t *dst_ptr, uint8_t *dst_ptr,
int src_pixels_per_line, int src_pixels_per_line,
int dst_pixels_per_line, int dst_pixels_per_line,
int rows, int rows,
int cols, int cols,
int flimit) { int flimit) {
uint8_t *p_src, *p_dst; uint8_t const *p_src;
uint8_t *p_dst;
int row; int row;
int col; int col;
int i; int i;
...@@ -313,51 +314,52 @@ static void deblock_and_de_macro_block(YV12_BUFFER_CONFIG *source, ...@@ -313,51 +314,52 @@ static void deblock_and_de_macro_block(YV12_BUFFER_CONFIG *source,
source->uv_height, source->uv_width, ppl); source->uv_height, source->uv_width, ppl);
} }
void vp9_deblock(YV12_BUFFER_CONFIG *source, void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
YV12_BUFFER_CONFIG *post, int q) {
int q, const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q
int low_var_thresh, + 0.0065 + 0.5);
int flag) { int i;
double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
int ppl = (int)(level + .5);
(void) low_var_thresh;
(void) flag;
vp9_post_proc_down_and_across(source->y_buffer, post->y_buffer, const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer};
source->y_stride, post->y_stride, const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride};
source->y_height, source->y_width, ppl); const int src_widths[3] = {src->y_width, src->uv_width, src->uv_width};
const int src_heights[3] = {src->y_height, src->uv_height, src->uv_height};
vp9_post_proc_down_and_across(source->u_buffer, post->u_buffer, uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer};
source->uv_stride, post->uv_stride, const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride};
source->uv_height, source->uv_width, ppl);
vp9_post_proc_down_and_across(source->v_buffer, post->v_buffer, for (i = 0; i < MAX_MB_PLANE; ++i)
source->uv_stride, post->uv_stride, vp9_post_proc_down_and_across(srcs[i], dsts[i],
source->uv_height, source->uv_width, ppl); src_strides[i], dst_strides[i],
src_heights[i], src_widths[i], ppl);
} }
void vp9_denoise(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *post, void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
int q, int low_var_thresh, int flag) { int q) {
double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065; const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q
int ppl = (int)(level + .5); + 0.0065 + 0.5);
(void) post; int i;
(void) low_var_thresh;
(void) flag; const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer};
const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride};
const int src_widths[3] = {src->y_width, src->uv_width, src->uv_width};
const int src_heights[3] = {src->y_height, src->uv_height, src->uv_height};
vp9_post_proc_down_and_across(src->y_buffer + 2 * src->y_stride + 2, uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer};
src->y_buffer + 2 * src->y_stride + 2, const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride};
src->y_stride, src->y_stride, src->y_height - 4,
src->y_width - 4, ppl);
vp9_post_proc_down_and_across(src->u_buffer + 2 * src->uv_stride + 2, for (i = 0; i < MAX_MB_PLANE; ++i) {
src->u_buffer + 2 * src->uv_stride + 2, const int src_stride = src_strides[i];
src->uv_stride, src->uv_stride, const uint8_t *const src = srcs[i] + 2 * src_stride + 2;
src->uv_height - 4, src->uv_width - 4, ppl); const int src_width = src_widths[i] - 4;
const int src_height = src_heights[i] - 4;
vp9_post_proc_down_and_across(src->v_buffer + 2 * src->uv_stride + 2, const int dst_stride = dst_strides[i];
src->v_buffer + 2 * src->uv_stride + 2, uint8_t *const dst = dsts[i] + 2 * dst_stride + 2;
src->uv_stride, src->uv_stride,
src->uv_height - 4, src->uv_width - 4, ppl); vp9_post_proc_down_and_across(src, dst, src_stride, dst_stride,
src_height, src_width, ppl);
}
} }
double vp9_gaussian(double sigma, double mu, double x) { double vp9_gaussian(double sigma, double mu, double x) {
...@@ -642,7 +644,7 @@ int vp9_post_proc_frame(VP9_COMMON *oci, YV12_BUFFER_CONFIG *dest, ...@@ -642,7 +644,7 @@ int vp9_post_proc_frame(VP9_COMMON *oci, YV12_BUFFER_CONFIG *dest,
deblock_and_de_macro_block(oci->frame_to_show, &oci->post_proc_buffer, deblock_and_de_macro_block(oci->frame_to_show, &oci->post_proc_buffer,
q + (deblock_level - 5) * 10, 1, 0); q + (deblock_level - 5) * 10, 1, 0);
} else if (flags & VP9D_DEBLOCK) { } else if (flags & VP9D_DEBLOCK) {
vp9_deblock(oci->frame_to_show, &oci->post_proc_buffer, q, 1, 0); vp9_deblock(oci->frame_to_show, &oci->post_proc_buffer, q);
} else { } else {
vp8_yv12_copy_frame(oci->frame_to_show, &oci->post_proc_buffer); vp8_yv12_copy_frame(oci->frame_to_show, &oci->post_proc_buffer);
} }
......
...@@ -29,10 +29,8 @@ struct postproc_state { ...@@ -29,10 +29,8 @@ struct postproc_state {
int vp9_post_proc_frame(struct VP9Common *oci, YV12_BUFFER_CONFIG *dest, int vp9_post_proc_frame(struct VP9Common *oci, YV12_BUFFER_CONFIG *dest,
vp9_ppflags_t *flags); vp9_ppflags_t *flags);
void vp9_denoise(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *post, void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q);
int q, int low_var_thresh, int flag);
void vp9_deblock(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *post, void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q);
int q, int low_var_thresh, int flag);
#endif // VP9_COMMON_VP9_POSTPROC_H_ #endif // VP9_COMMON_VP9_POSTPROC_H_
...@@ -140,7 +140,7 @@ prototype void vp9_mbpost_proc_across_ip "uint8_t *src, int pitch, int rows, int ...@@ -140,7 +140,7 @@ prototype void vp9_mbpost_proc_across_ip "uint8_t *src, int pitch, int rows, int
specialize vp9_mbpost_proc_across_ip sse2 specialize vp9_mbpost_proc_across_ip sse2
vp9_mbpost_proc_across_ip_sse2=vp9_mbpost_proc_across_ip_xmm vp9_mbpost_proc_across_ip_sse2=vp9_mbpost_proc_across_ip_xmm
prototype void vp9_post_proc_down_and_across "uint8_t *src_ptr, uint8_t *dst_ptr, int src_pixels_per_line, int dst_pixels_per_line, int rows, int cols, int flimit" prototype void vp9_post_proc_down_and_across "const uint8_t *src_ptr, uint8_t *dst_ptr, int src_pixels_per_line, int dst_pixels_per_line, int rows, int cols, int flimit"
specialize vp9_post_proc_down_and_across mmx sse2 specialize vp9_post_proc_down_and_across mmx sse2
vp9_post_proc_down_and_across_sse2=vp9_post_proc_down_and_across_xmm vp9_post_proc_down_and_across_sse2=vp9_post_proc_down_and_across_xmm
......
...@@ -2863,7 +2863,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, ...@@ -2863,7 +2863,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
break; break;
} }
vp9_denoise(cpi->Source, cpi->Source, l, 1, 0); vp9_denoise(cpi->Source, cpi->Source, l);
} }
#endif #endif
...@@ -3948,7 +3948,7 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags, ...@@ -3948,7 +3948,7 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
double weight = 0; double weight = 0;
#if CONFIG_POSTPROC #if CONFIG_POSTPROC
vp9_deblock(cm->frame_to_show, &cm->post_proc_buffer, vp9_deblock(cm->frame_to_show, &cm->post_proc_buffer,
cm->filter_level * 10 / 6, 1, 0); cm->filter_level * 10 / 6);
#endif #endif
vp9_clear_system_state(); vp9_clear_system_state();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment