Commit d31a632d authored by John Koleszar's avatar John Koleszar Committed by Gerrit Code Review

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

parents 724769d4 56efb73b
...@@ -132,15 +132,14 @@ const short vp9_rv[] = { ...@@ -132,15 +132,14 @@ const short vp9_rv[] = {
/**************************************************************************** /****************************************************************************
*/ */
void vp9_post_proc_down_and_across_c(const uint8_t *src_ptr, void vp9_post_proc_down_and_across_c(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 const *p_src; uint8_t *p_src, *p_dst;
uint8_t *p_dst;
int row; int row;
int col; int col;
int i; int i;
...@@ -314,44 +313,51 @@ static void deblock_and_de_macro_block(YV12_BUFFER_CONFIG *source, ...@@ -314,44 +313,51 @@ 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(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, void vp9_deblock(YV12_BUFFER_CONFIG *source,
int q) { YV12_BUFFER_CONFIG *post,
const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q int q,
+ 0.0065 + 0.5); int low_var_thresh,
int i; int flag) {
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;
const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer}; vp9_post_proc_down_and_across(source->y_buffer, post->y_buffer,
uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer}; source->y_stride, post->y_stride,
const int strides[3] = {src->y_stride, src->uv_stride, src->uv_stride}; source->y_height, source->y_width, ppl);
const int widths[3] = {src->y_width, src->uv_width, src->uv_width};
const int heights[3] = {src->y_height, src->uv_height, src->uv_height};
for (i = 0; i < MAX_MB_PLANE; ++i) vp9_post_proc_down_and_across(source->u_buffer, post->u_buffer,
vp9_post_proc_down_and_across(srcs[i], dsts[i], strides[i], strides[i], source->uv_stride, post->uv_stride,
heights[i], widths[i], ppl); source->uv_height, source->uv_width, ppl);
vp9_post_proc_down_and_across(source->v_buffer, post->v_buffer,
source->uv_stride, post->uv_stride,
source->uv_height, source->uv_width, ppl);
} }
void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, void vp9_denoise(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *post,
int q) { int q, int low_var_thresh, int flag) {
const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
+ 0.0065 + 0.5); int ppl = (int)(level + .5);
int i; (void) post;
(void) low_var_thresh;
(void) flag;
const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer}; 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 strides[3] = {src->y_stride, src->uv_stride, src->uv_stride}; src->y_stride, src->y_stride, src->y_height - 4,
const int widths[3] = {src->y_width, src->uv_width, src->uv_width}; src->y_width - 4, ppl);
const int heights[3] = {src->y_height, src->uv_height, src->uv_height};
for (i = 0; i < MAX_MB_PLANE; ++i) { vp9_post_proc_down_and_across(src->u_buffer + 2 * src->uv_stride + 2,
const int stride = strides[i]; src->u_buffer + 2 * src->uv_stride + 2,
const int width = widths[i] - 4; src->uv_stride, src->uv_stride,
const int height = heights[i] - 4; src->uv_height - 4, src->uv_width - 4, ppl);
const uint8_t *const src = srcs[i] + 2 * stride + 2;
uint8_t *const dst = dsts[i] + 2 * stride + 2;
vp9_post_proc_down_and_across(src, dst, stride, stride, height, width, ppl); vp9_post_proc_down_and_across(src->v_buffer + 2 * src->uv_stride + 2,
} src->v_buffer + 2 * src->uv_stride + 2,
src->uv_stride, src->uv_stride,
src->uv_height - 4, src->uv_width - 4, ppl);
} }
double vp9_gaussian(double sigma, double mu, double x) { double vp9_gaussian(double sigma, double mu, double x) {
...@@ -636,7 +642,7 @@ int vp9_post_proc_frame(VP9_COMMON *oci, YV12_BUFFER_CONFIG *dest, ...@@ -636,7 +642,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); vp9_deblock(oci->frame_to_show, &oci->post_proc_buffer, q, 1, 0);
} 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,8 +29,10 @@ struct postproc_state { ...@@ -29,8 +29,10 @@ 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(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q); void vp9_denoise(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *post,
int q, int low_var_thresh, int flag);
void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q); void vp9_deblock(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *post,
int q, int low_var_thresh, int flag);
#endif // VP9_COMMON_VP9_POSTPROC_H_ #endif // VP9_COMMON_VP9_POSTPROC_H_
...@@ -146,7 +146,7 @@ prototype void vp9_mbpost_proc_across_ip "uint8_t *src, int pitch, int rows, int ...@@ -146,7 +146,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 "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" 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"
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); vp9_denoise(cpi->Source, cpi->Source, l, 1, 0);
} }
#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); cm->filter_level * 10 / 6, 1, 0);
#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