Preparing vp9_deblock and vp9_denoise to alpha support.
Change-Id: I299feefa64b93bd62263aea1ff1e41e85faeb6ca
This commit is contained in:
Родитель
089ed30d07
Коммит
7bbf716f04
|
@ -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,
|
||||
int src_pixels_per_line,
|
||||
int dst_pixels_per_line,
|
||||
int rows,
|
||||
int cols,
|
||||
int flimit) {
|
||||
uint8_t *p_src, *p_dst;
|
||||
uint8_t const *p_src;
|
||||
uint8_t *p_dst;
|
||||
int row;
|
||||
int col;
|
||||
int i;
|
||||
|
@ -313,51 +314,52 @@ static void deblock_and_de_macro_block(YV12_BUFFER_CONFIG *source,
|
|||
source->uv_height, source->uv_width, ppl);
|
||||
}
|
||||
|
||||
void vp9_deblock(YV12_BUFFER_CONFIG *source,
|
||||
YV12_BUFFER_CONFIG *post,
|
||||
int q,
|
||||
int low_var_thresh,
|
||||
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;
|
||||
void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
|
||||
int q) {
|
||||
const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q
|
||||
+ 0.0065 + 0.5);
|
||||
int i;
|
||||
|
||||
vp9_post_proc_down_and_across(source->y_buffer, post->y_buffer,
|
||||
source->y_stride, post->y_stride,
|
||||
source->y_height, source->y_width, ppl);
|
||||
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(source->u_buffer, post->u_buffer,
|
||||
source->uv_stride, post->uv_stride,
|
||||
source->uv_height, source->uv_width, ppl);
|
||||
uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer};
|
||||
const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride};
|
||||
|
||||
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);
|
||||
for (i = 0; i < MAX_MB_PLANE; ++i)
|
||||
vp9_post_proc_down_and_across(srcs[i], dsts[i],
|
||||
src_strides[i], dst_strides[i],
|
||||
src_heights[i], src_widths[i], ppl);
|
||||
}
|
||||
|
||||
void vp9_denoise(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *post,
|
||||
int q, int low_var_thresh, int flag) {
|
||||
double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
|
||||
int ppl = (int)(level + .5);
|
||||
(void) post;
|
||||
(void) low_var_thresh;
|
||||
(void) flag;
|
||||
void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
|
||||
int q) {
|
||||
const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q
|
||||
+ 0.0065 + 0.5);
|
||||
int i;
|
||||
|
||||
vp9_post_proc_down_and_across(src->y_buffer + 2 * src->y_stride + 2,
|
||||
src->y_buffer + 2 * src->y_stride + 2,
|
||||
src->y_stride, src->y_stride, src->y_height - 4,
|
||||
src->y_width - 4, ppl);
|
||||
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->u_buffer + 2 * src->uv_stride + 2,
|
||||
src->u_buffer + 2 * src->uv_stride + 2,
|
||||
src->uv_stride, src->uv_stride,
|
||||
src->uv_height - 4, src->uv_width - 4, ppl);
|
||||
uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer};
|
||||
const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride};
|
||||
|
||||
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);
|
||||
for (i = 0; i < MAX_MB_PLANE; ++i) {
|
||||
const int src_stride = src_strides[i];
|
||||
const uint8_t *const src = srcs[i] + 2 * src_stride + 2;
|
||||
const int src_width = src_widths[i] - 4;
|
||||
const int src_height = src_heights[i] - 4;
|
||||
|
||||
const int dst_stride = dst_strides[i];
|
||||
uint8_t *const dst = dsts[i] + 2 * dst_stride + 2;
|
||||
|
||||
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) {
|
||||
|
@ -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,
|
||||
q + (deblock_level - 5) * 10, 1, 0);
|
||||
} 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 {
|
||||
vp8_yv12_copy_frame(oci->frame_to_show, &oci->post_proc_buffer);
|
||||
}
|
||||
|
|
|
@ -29,10 +29,8 @@ struct postproc_state {
|
|||
int vp9_post_proc_frame(struct VP9Common *oci, YV12_BUFFER_CONFIG *dest,
|
||||
vp9_ppflags_t *flags);
|
||||
|
||||
void vp9_denoise(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *post,
|
||||
int q, int low_var_thresh, int flag);
|
||||
void vp9_denoise(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);
|
||||
void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q);
|
||||
|
||||
#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
|
|||
specialize vp9_mbpost_proc_across_ip sse2
|
||||
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
|
||||
vp9_post_proc_down_and_across_sse2=vp9_post_proc_down_and_across_xmm
|
||||
|
||||
|
|
|
@ -2881,7 +2881,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
|
|||
break;
|
||||
}
|
||||
|
||||
vp9_denoise(cpi->Source, cpi->Source, l, 1, 0);
|
||||
vp9_denoise(cpi->Source, cpi->Source, l);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -3966,7 +3966,7 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
|
|||
double weight = 0;
|
||||
#if CONFIG_POSTPROC
|
||||
vp9_deblock(cm->frame_to_show, &cm->post_proc_buffer,
|
||||
cm->filter_level * 10 / 6, 1, 0);
|
||||
cm->filter_level * 10 / 6);
|
||||
#endif
|
||||
vp9_clear_system_state();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче