2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
15 #include "./vpx_dsp_rtcd.h"
16 #include "./vpx_config.h"
17 #include "./vpx_scale_rtcd.h"
18 #include "./vp9_rtcd.h"
20 #include "vpx_dsp/vpx_dsp_common.h"
21 #include "vpx_ports/mem.h"
22 #include "vpx_ports/system_state.h"
23 #include "vpx_scale/vpx_scale.h"
24 #include "vpx_scale/yv12config.h"
26 #include "vp9/common/vp9_onyxc_int.h"
27 #include "vp9/common/vp9_postproc.h"
28 #include "vp9/common/vp9_textblit.h"
30 #if CONFIG_VP9_POSTPROC
31 static const int16_t kernel5[] = {
35 const int16_t vp9_rv[] = {
36 8, 5, 2, 2, 8, 12, 4, 9, 8, 3,
37 0, 3, 9, 0, 0, 0, 8, 3, 14, 4,
38 10, 1, 11, 14, 1, 14, 9, 6, 12, 11,
39 8, 6, 10, 0, 0, 8, 9, 0, 3, 14,
40 8, 11, 13, 4, 2, 9, 0, 3, 9, 6,
41 1, 2, 3, 14, 13, 1, 8, 2, 9, 7,
42 3, 3, 1, 13, 13, 6, 6, 5, 2, 7,
43 11, 9, 11, 8, 7, 3, 2, 0, 13, 13,
44 14, 4, 12, 5, 12, 10, 8, 10, 13, 10,
45 4, 14, 4, 10, 0, 8, 11, 1, 13, 7,
46 7, 14, 6, 14, 13, 2, 13, 5, 4, 4,
47 0, 10, 0, 5, 13, 2, 12, 7, 11, 13,
48 8, 0, 4, 10, 7, 2, 7, 2, 2, 5,
49 3, 4, 7, 3, 3, 14, 14, 5, 9, 13,
50 3, 14, 3, 6, 3, 0, 11, 8, 13, 1,
51 13, 1, 12, 0, 10, 9, 7, 6, 2, 8,
52 5, 2, 13, 7, 1, 13, 14, 7, 6, 7,
53 9, 6, 10, 11, 7, 8, 7, 5, 14, 8,
54 4, 4, 0, 8, 7, 10, 0, 8, 14, 11,
55 3, 12, 5, 7, 14, 3, 14, 5, 2, 6,
56 11, 12, 12, 8, 0, 11, 13, 1, 2, 0,
57 5, 10, 14, 7, 8, 0, 4, 11, 0, 8,
58 0, 3, 10, 5, 8, 0, 11, 6, 7, 8,
59 10, 7, 13, 9, 2, 5, 1, 5, 10, 2,
60 4, 3, 5, 6, 10, 8, 9, 4, 11, 14,
61 0, 10, 0, 5, 13, 2, 12, 7, 11, 13,
62 8, 0, 4, 10, 7, 2, 7, 2, 2, 5,
63 3, 4, 7, 3, 3, 14, 14, 5, 9, 13,
64 3, 14, 3, 6, 3, 0, 11, 8, 13, 1,
65 13, 1, 12, 0, 10, 9, 7, 6, 2, 8,
66 5, 2, 13, 7, 1, 13, 14, 7, 6, 7,
67 9, 6, 10, 11, 7, 8, 7, 5, 14, 8,
68 4, 4, 0, 8, 7, 10, 0, 8, 14, 11,
69 3, 12, 5, 7, 14, 3, 14, 5, 2, 6,
70 11, 12, 12, 8, 0, 11, 13, 1, 2, 0,
71 5, 10, 14, 7, 8, 0, 4, 11, 0, 8,
72 0, 3, 10, 5, 8, 0, 11, 6, 7, 8,
73 10, 7, 13, 9, 2, 5, 1, 5, 10, 2,
74 4, 3, 5, 6, 10, 8, 9, 4, 11, 14,
75 3, 8, 3, 7, 8, 5, 11, 4, 12, 3,
76 11, 9, 14, 8, 14, 13, 4, 3, 1, 2,
77 14, 6, 5, 4, 4, 11, 4, 6, 2, 1,
78 5, 8, 8, 12, 13, 5, 14, 10, 12, 13,
79 0, 9, 5, 5, 11, 10, 13, 9, 10, 13,
82 static const uint8_t q_diff_thresh = 20;
83 static const uint8_t last_q_thresh = 170;
85 void vp9_post_proc_down_and_across_c(const uint8_t *src_ptr,
87 int src_pixels_per_line,
88 int dst_pixels_per_line,
94 int row, col, i, v, kernel;
95 int pitch = src_pixels_per_line;
97 (void)dst_pixels_per_line;
99 for (row = 0; row < rows; row++) {
100 /* post_proc_down for one row */
104 for (col = 0; col < cols; col++) {
108 for (i = -2; i <= 2; i++) {
109 if (abs(v - p_src[col + i * pitch]) > flimit)
110 goto down_skip_convolve;
112 kernel += kernel5[2 + i] * p_src[col + i * pitch];
120 /* now post_proc_across */
124 for (i = 0; i < 8; i++)
127 for (col = 0; col < cols; col++) {
133 for (i = -2; i <= 2; i++) {
134 if (abs(v - p_src[col + i]) > flimit)
135 goto across_skip_convolve;
137 kernel += kernel5[2 + i] * p_src[col + i];
140 d[col & 7] = (kernel >> 3);
141 across_skip_convolve:
144 p_dst[col - 2] = d[(col - 2) & 7];
147 /* handle the last two pixels */
148 p_dst[col - 2] = d[(col - 2) & 7];
149 p_dst[col - 1] = d[(col - 1) & 7];
158 #if CONFIG_VP9_HIGHBITDEPTH
159 void vp9_highbd_post_proc_down_and_across_c(const uint16_t *src_ptr,
161 int src_pixels_per_line,
162 int dst_pixels_per_line,
166 uint16_t const *p_src;
168 int row, col, i, v, kernel;
169 int pitch = src_pixels_per_line;
172 for (row = 0; row < rows; row++) {
173 // post_proc_down for one row.
177 for (col = 0; col < cols; col++) {
181 for (i = -2; i <= 2; i++) {
182 if (abs(v - p_src[col + i * pitch]) > flimit)
183 goto down_skip_convolve;
185 kernel += kernel5[2 + i] * p_src[col + i * pitch];
194 /* now post_proc_across */
198 for (i = 0; i < 8; i++)
201 for (col = 0; col < cols; col++) {
207 for (i = -2; i <= 2; i++) {
208 if (abs(v - p_src[col + i]) > flimit)
209 goto across_skip_convolve;
211 kernel += kernel5[2 + i] * p_src[col + i];
214 d[col & 7] = (kernel >> 3);
216 across_skip_convolve:
218 p_dst[col - 2] = d[(col - 2) & 7];
221 /* handle the last two pixels */
222 p_dst[col - 2] = d[(col - 2) & 7];
223 p_dst[col - 1] = d[(col - 1) & 7];
228 dst_ptr += dst_pixels_per_line;
231 #endif // CONFIG_VP9_HIGHBITDEPTH
233 static int q2mbl(int x) {
236 x = 50 + (x - 50) * 10 / 8;
240 void vp9_mbpost_proc_across_ip_c(uint8_t *src, int pitch,
241 int rows, int cols, int flimit) {
246 for (r = 0; r < rows; r++) {
250 for (i = -8; i <= 6; i++) {
251 sumsq += s[i] * s[i];
256 for (c = 0; c < cols + 8; c++) {
257 int x = s[c + 7] - s[c - 8];
258 int y = s[c + 7] + s[c - 8];
265 if (sumsq * 15 - sum * sum < flimit) {
266 d[c & 15] = (8 + sum + s[c]) >> 4;
269 s[c - 8] = d[(c - 8) & 15];
275 #if CONFIG_VP9_HIGHBITDEPTH
276 void vp9_highbd_mbpost_proc_across_ip_c(uint16_t *src, int pitch,
277 int rows, int cols, int flimit) {
284 for (r = 0; r < rows; r++) {
288 for (i = -8; i <= 6; i++) {
289 sumsq += s[i] * s[i];
294 for (c = 0; c < cols + 8; c++) {
295 int x = s[c + 7] - s[c - 8];
296 int y = s[c + 7] + s[c - 8];
303 if (sumsq * 15 - sum * sum < flimit) {
304 d[c & 15] = (8 + sum + s[c]) >> 4;
307 s[c - 8] = d[(c - 8) & 15];
313 #endif // CONFIG_VP9_HIGHBITDEPTH
315 void vp9_mbpost_proc_down_c(uint8_t *dst, int pitch,
316 int rows, int cols, int flimit) {
318 const short *rv3 = &vp9_rv[63 & rand()]; // NOLINT
320 for (c = 0; c < cols; c++) {
321 uint8_t *s = &dst[c];
325 const int16_t *rv2 = rv3 + ((c * 17) & 127);
327 for (i = -8; i <= 6; i++) {
328 sumsq += s[i * pitch] * s[i * pitch];
332 for (r = 0; r < rows + 8; r++) {
333 sumsq += s[7 * pitch] * s[ 7 * pitch] - s[-8 * pitch] * s[-8 * pitch];
334 sum += s[7 * pitch] - s[-8 * pitch];
337 if (sumsq * 15 - sum * sum < flimit) {
338 d[r & 15] = (rv2[r & 127] + sum + s[0]) >> 4;
341 s[-8 * pitch] = d[(r - 8) & 15];
347 #if CONFIG_VP9_HIGHBITDEPTH
348 void vp9_highbd_mbpost_proc_down_c(uint16_t *dst, int pitch,
349 int rows, int cols, int flimit) {
351 const int16_t *rv3 = &vp9_rv[63 & rand()]; // NOLINT
353 for (c = 0; c < cols; c++) {
354 uint16_t *s = &dst[c];
358 const int16_t *rv2 = rv3 + ((c * 17) & 127);
360 for (i = -8; i <= 6; i++) {
361 sumsq += s[i * pitch] * s[i * pitch];
365 for (r = 0; r < rows + 8; r++) {
366 sumsq += s[7 * pitch] * s[ 7 * pitch] - s[-8 * pitch] * s[-8 * pitch];
367 sum += s[7 * pitch] - s[-8 * pitch];
370 if (sumsq * 15 - sum * sum < flimit) {
371 d[r & 15] = (rv2[r & 127] + sum + s[0]) >> 4;
374 s[-8 * pitch] = d[(r - 8) & 15];
379 #endif // CONFIG_VP9_HIGHBITDEPTH
381 static void deblock_and_de_macro_block(YV12_BUFFER_CONFIG *source,
382 YV12_BUFFER_CONFIG *post,
386 double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
387 int ppl = (int)(level + .5);
388 (void) low_var_thresh;
391 #if CONFIG_VP9_HIGHBITDEPTH
392 if (source->flags & YV12_FLAG_HIGHBITDEPTH) {
393 vp9_highbd_post_proc_down_and_across(CONVERT_TO_SHORTPTR(source->y_buffer),
394 CONVERT_TO_SHORTPTR(post->y_buffer),
395 source->y_stride, post->y_stride,
396 source->y_height, source->y_width,
399 vp9_highbd_mbpost_proc_across_ip(CONVERT_TO_SHORTPTR(post->y_buffer),
400 post->y_stride, post->y_height,
401 post->y_width, q2mbl(q));
403 vp9_highbd_mbpost_proc_down(CONVERT_TO_SHORTPTR(post->y_buffer),
404 post->y_stride, post->y_height,
405 post->y_width, q2mbl(q));
407 vp9_highbd_post_proc_down_and_across(CONVERT_TO_SHORTPTR(source->u_buffer),
408 CONVERT_TO_SHORTPTR(post->u_buffer),
409 source->uv_stride, post->uv_stride,
410 source->uv_height, source->uv_width,
412 vp9_highbd_post_proc_down_and_across(CONVERT_TO_SHORTPTR(source->v_buffer),
413 CONVERT_TO_SHORTPTR(post->v_buffer),
414 source->uv_stride, post->uv_stride,
415 source->uv_height, source->uv_width,
418 vp9_post_proc_down_and_across(source->y_buffer, post->y_buffer,
419 source->y_stride, post->y_stride,
420 source->y_height, source->y_width, ppl);
422 vp9_mbpost_proc_across_ip(post->y_buffer, post->y_stride, post->y_height,
423 post->y_width, q2mbl(q));
425 vp9_mbpost_proc_down(post->y_buffer, post->y_stride, post->y_height,
426 post->y_width, q2mbl(q));
428 vp9_post_proc_down_and_across(source->u_buffer, post->u_buffer,
429 source->uv_stride, post->uv_stride,
430 source->uv_height, source->uv_width, ppl);
431 vp9_post_proc_down_and_across(source->v_buffer, post->v_buffer,
432 source->uv_stride, post->uv_stride,
433 source->uv_height, source->uv_width, ppl);
436 vp9_post_proc_down_and_across(source->y_buffer, post->y_buffer,
437 source->y_stride, post->y_stride,
438 source->y_height, source->y_width, ppl);
440 vp9_mbpost_proc_across_ip(post->y_buffer, post->y_stride, post->y_height,
441 post->y_width, q2mbl(q));
443 vp9_mbpost_proc_down(post->y_buffer, post->y_stride, post->y_height,
444 post->y_width, q2mbl(q));
446 vp9_post_proc_down_and_across(source->u_buffer, post->u_buffer,
447 source->uv_stride, post->uv_stride,
448 source->uv_height, source->uv_width, ppl);
449 vp9_post_proc_down_and_across(source->v_buffer, post->v_buffer,
450 source->uv_stride, post->uv_stride,
451 source->uv_height, source->uv_width, ppl);
452 #endif // CONFIG_VP9_HIGHBITDEPTH
455 void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
457 const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q
461 const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer};
462 const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride};
463 const int src_widths[3] = {src->y_width, src->uv_width, src->uv_width};
464 const int src_heights[3] = {src->y_height, src->uv_height, src->uv_height};
466 uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer};
467 const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride};
469 for (i = 0; i < MAX_MB_PLANE; ++i) {
470 #if CONFIG_VP9_HIGHBITDEPTH
471 assert((src->flags & YV12_FLAG_HIGHBITDEPTH) ==
472 (dst->flags & YV12_FLAG_HIGHBITDEPTH));
473 if (src->flags & YV12_FLAG_HIGHBITDEPTH) {
474 vp9_highbd_post_proc_down_and_across(CONVERT_TO_SHORTPTR(srcs[i]),
475 CONVERT_TO_SHORTPTR(dsts[i]),
476 src_strides[i], dst_strides[i],
477 src_heights[i], src_widths[i], ppl);
479 vp9_post_proc_down_and_across(srcs[i], dsts[i],
480 src_strides[i], dst_strides[i],
481 src_heights[i], src_widths[i], ppl);
484 vp9_post_proc_down_and_across(srcs[i], dsts[i],
485 src_strides[i], dst_strides[i],
486 src_heights[i], src_widths[i], ppl);
487 #endif // CONFIG_VP9_HIGHBITDEPTH
491 void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
493 const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q
497 const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer};
498 const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride};
499 const int src_widths[3] = {src->y_width, src->uv_width, src->uv_width};
500 const int src_heights[3] = {src->y_height, src->uv_height, src->uv_height};
502 uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer};
503 const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride};
505 for (i = 0; i < MAX_MB_PLANE; ++i) {
506 const int src_stride = src_strides[i];
507 const int src_width = src_widths[i] - 4;
508 const int src_height = src_heights[i] - 4;
509 const int dst_stride = dst_strides[i];
511 #if CONFIG_VP9_HIGHBITDEPTH
512 assert((src->flags & YV12_FLAG_HIGHBITDEPTH) ==
513 (dst->flags & YV12_FLAG_HIGHBITDEPTH));
514 if (src->flags & YV12_FLAG_HIGHBITDEPTH) {
515 const uint16_t *const src_plane = CONVERT_TO_SHORTPTR(
516 srcs[i] + 2 * src_stride + 2);
517 uint16_t *const dst_plane = CONVERT_TO_SHORTPTR(
518 dsts[i] + 2 * dst_stride + 2);
519 vp9_highbd_post_proc_down_and_across(src_plane, dst_plane, src_stride,
520 dst_stride, src_height, src_width,
523 const uint8_t *const src_plane = srcs[i] + 2 * src_stride + 2;
524 uint8_t *const dst_plane = dsts[i] + 2 * dst_stride + 2;
526 vp9_post_proc_down_and_across(src_plane, dst_plane, src_stride,
527 dst_stride, src_height, src_width, ppl);
530 const uint8_t *const src_plane = srcs[i] + 2 * src_stride + 2;
531 uint8_t *const dst_plane = dsts[i] + 2 * dst_stride + 2;
532 vp9_post_proc_down_and_across(src_plane, dst_plane, src_stride, dst_stride,
533 src_height, src_width, ppl);
538 static double gaussian(double sigma, double mu, double x) {
539 return 1 / (sigma * sqrt(2.0 * 3.14159265)) *
540 (exp(-(x - mu) * (x - mu) / (2 * sigma * sigma)));
543 static void fillrd(struct postproc_state *state, int q, int a) {
547 int ai = a, qi = q, i;
549 vpx_clear_system_state();
551 sigma = ai + .5 + .6 * (63 - qi) / 63.0;
553 /* set up a lookup table of 256 entries that matches
554 * a gaussian distribution with sigma determined by q.
561 for (i = -32; i < 32; i++) {
562 int a_i = (int)(0.5 + 256 * gaussian(sigma, 0, i));
565 for (j = 0; j < a_i; j++) {
566 char_dist[next + j] = (char) i;
573 for (; next < 256; next++)
577 for (i = 0; i < 3072; i++) {
578 state->noise[i] = char_dist[rand() & 0xff]; // NOLINT
581 for (i = 0; i < 16; i++) {
582 state->blackclamp[i] = -char_dist[0];
583 state->whiteclamp[i] = -char_dist[0];
584 state->bothclamp[i] = -2 * char_dist[0];
588 state->last_noise = a;
591 static void swap_mi_and_prev_mi(VP9_COMMON *cm) {
592 // Current mip will be the prev_mip for the next frame.
593 MODE_INFO *temp = cm->postproc_state.prev_mip;
594 cm->postproc_state.prev_mip = cm->mip;
597 // Update the upper left visible macroblock ptrs.
598 cm->mi = cm->mip + cm->mi_stride + 1;
599 cm->postproc_state.prev_mi = cm->postproc_state.prev_mip + cm->mi_stride + 1;
602 int vp9_post_proc_frame(struct VP9Common *cm,
603 YV12_BUFFER_CONFIG *dest, vp9_ppflags_t *ppflags) {
604 const int q = VPXMIN(105, cm->lf.filter_level * 2);
605 const int flags = ppflags->post_proc_flag;
606 YV12_BUFFER_CONFIG *const ppbuf = &cm->post_proc_buffer;
607 struct postproc_state *const ppstate = &cm->postproc_state;
609 if (!cm->frame_to_show)
613 *dest = *cm->frame_to_show;
617 vpx_clear_system_state();
619 // Alloc memory for prev_mip in the first frame.
620 if (cm->current_video_frame == 1) {
621 cm->postproc_state.last_base_qindex = cm->base_qindex;
622 cm->postproc_state.last_frame_valid = 1;
623 ppstate->prev_mip = vpx_calloc(cm->mi_alloc_size, sizeof(*cm->mip));
624 if (!ppstate->prev_mip) {
627 ppstate->prev_mi = ppstate->prev_mip + cm->mi_stride + 1;
628 memset(ppstate->prev_mip, 0,
629 cm->mi_stride * (cm->mi_rows + 1) * sizeof(*cm->mip));
632 // Allocate post_proc_buffer_int if needed.
633 if ((flags & VP9D_MFQE) && !cm->post_proc_buffer_int.buffer_alloc) {
634 if ((flags & VP9D_DEMACROBLOCK) || (flags & VP9D_DEBLOCK)) {
635 const int width = ALIGN_POWER_OF_TWO(cm->width, 4);
636 const int height = ALIGN_POWER_OF_TWO(cm->height, 4);
638 if (vpx_alloc_frame_buffer(&cm->post_proc_buffer_int, width, height,
639 cm->subsampling_x, cm->subsampling_y,
640 #if CONFIG_VP9_HIGHBITDEPTH
641 cm->use_highbitdepth,
642 #endif // CONFIG_VP9_HIGHBITDEPTH
643 VP9_ENC_BORDER_IN_PIXELS,
644 cm->byte_alignment) < 0) {
645 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
646 "Failed to allocate MFQE framebuffer");
649 // Ensure that postproc is set to all 0s so that post proc
650 // doesn't pull random data in from edge.
651 memset(cm->post_proc_buffer_int.buffer_alloc, 128,
652 cm->post_proc_buffer.frame_size);
656 if (vpx_realloc_frame_buffer(&cm->post_proc_buffer, cm->width, cm->height,
657 cm->subsampling_x, cm->subsampling_y,
658 #if CONFIG_VP9_HIGHBITDEPTH
659 cm->use_highbitdepth,
661 VP9_DEC_BORDER_IN_PIXELS, cm->byte_alignment,
662 NULL, NULL, NULL) < 0)
663 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
664 "Failed to allocate post-processing buffer");
666 if ((flags & VP9D_MFQE) && cm->current_video_frame >= 2 &&
667 cm->postproc_state.last_frame_valid && cm->bit_depth == 8 &&
668 cm->postproc_state.last_base_qindex <= last_q_thresh &&
669 cm->base_qindex - cm->postproc_state.last_base_qindex >= q_diff_thresh) {
671 // TODO(jackychen): Consider whether enable deblocking by default
672 // if mfqe is enabled. Need to take both the quality and the speed
673 // into consideration.
674 if ((flags & VP9D_DEMACROBLOCK) || (flags & VP9D_DEBLOCK)) {
675 vp8_yv12_copy_frame(ppbuf, &cm->post_proc_buffer_int);
677 if ((flags & VP9D_DEMACROBLOCK) && cm->post_proc_buffer_int.buffer_alloc) {
678 deblock_and_de_macro_block(&cm->post_proc_buffer_int, ppbuf,
679 q + (ppflags->deblocking_level - 5) * 10,
681 } else if (flags & VP9D_DEBLOCK) {
682 vp9_deblock(&cm->post_proc_buffer_int, ppbuf, q);
684 vp8_yv12_copy_frame(&cm->post_proc_buffer_int, ppbuf);
686 } else if (flags & VP9D_DEMACROBLOCK) {
687 deblock_and_de_macro_block(cm->frame_to_show, ppbuf,
688 q + (ppflags->deblocking_level - 5) * 10, 1, 0);
689 } else if (flags & VP9D_DEBLOCK) {
690 vp9_deblock(cm->frame_to_show, ppbuf, q);
692 vp8_yv12_copy_frame(cm->frame_to_show, ppbuf);
695 cm->postproc_state.last_base_qindex = cm->base_qindex;
696 cm->postproc_state.last_frame_valid = 1;
698 if (flags & VP9D_ADDNOISE) {
699 const int noise_level = ppflags->noise_level;
700 if (ppstate->last_q != q ||
701 ppstate->last_noise != noise_level) {
702 fillrd(ppstate, 63 - q, noise_level);
704 vpx_plane_add_noise(ppbuf->y_buffer, ppstate->noise, ppstate->blackclamp,
705 ppstate->whiteclamp, ppstate->bothclamp,
706 ppbuf->y_width, ppbuf->y_height, ppbuf->y_stride);
711 /* handle problem with extending borders */
712 dest->y_width = cm->width;
713 dest->y_height = cm->height;
714 dest->uv_width = dest->y_width >> cm->subsampling_x;
715 dest->uv_height = dest->y_height >> cm->subsampling_y;
717 swap_mi_and_prev_mi(cm);
720 #endif // CONFIG_VP9_POSTPROC