OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include <math.h> | 11 #include <math.h> |
12 #include <stdlib.h> | 12 #include <stdlib.h> |
13 #include <stdio.h> | 13 #include <stdio.h> |
14 | 14 |
15 #include "./vpx_config.h" | 15 #include "./vpx_config.h" |
16 #include "./vpx_scale_rtcd.h" | 16 #include "./vpx_scale_rtcd.h" |
17 #include "./vp9_rtcd.h" | 17 #include "./vp9_rtcd.h" |
18 | 18 |
19 #include "vpx_scale/vpx_scale.h" | 19 #include "vpx_scale/vpx_scale.h" |
20 #include "vpx_scale/yv12config.h" | 20 #include "vpx_scale/yv12config.h" |
21 | 21 |
| 22 #if CONFIG_VP9_HIGHBITDEPTH |
| 23 #include "vp9/common/vp9_common.h" |
| 24 #endif |
22 #include "vp9/common/vp9_onyxc_int.h" | 25 #include "vp9/common/vp9_onyxc_int.h" |
23 #include "vp9/common/vp9_postproc.h" | 26 #include "vp9/common/vp9_postproc.h" |
24 #include "vp9/common/vp9_systemdependent.h" | 27 #include "vp9/common/vp9_systemdependent.h" |
25 #include "vp9/common/vp9_textblit.h" | 28 #include "vp9/common/vp9_textblit.h" |
26 | 29 |
27 #if CONFIG_VP9_POSTPROC | 30 #if CONFIG_VP9_POSTPROC |
28 static const short kernel5[] = { | 31 static const short kernel5[] = { |
29 1, 1, 4, 1, 1 | 32 1, 1, 4, 1, 1 |
30 }; | 33 }; |
31 | 34 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 p_dst[col - 2] = d[(col - 2) & 7]; | 148 p_dst[col - 2] = d[(col - 2) & 7]; |
146 p_dst[col - 1] = d[(col - 1) & 7]; | 149 p_dst[col - 1] = d[(col - 1) & 7]; |
147 | 150 |
148 | 151 |
149 /* next row */ | 152 /* next row */ |
150 src_ptr += pitch; | 153 src_ptr += pitch; |
151 dst_ptr += pitch; | 154 dst_ptr += pitch; |
152 } | 155 } |
153 } | 156 } |
154 | 157 |
| 158 #if CONFIG_VP9_HIGHBITDEPTH |
| 159 void vp9_highbd_post_proc_down_and_across_c(const uint16_t *src_ptr, |
| 160 uint16_t *dst_ptr, |
| 161 int src_pixels_per_line, |
| 162 int dst_pixels_per_line, |
| 163 int rows, |
| 164 int cols, |
| 165 int flimit) { |
| 166 uint16_t const *p_src; |
| 167 uint16_t *p_dst; |
| 168 int row; |
| 169 int col; |
| 170 int i; |
| 171 int v; |
| 172 int pitch = src_pixels_per_line; |
| 173 uint16_t d[8]; |
| 174 |
| 175 for (row = 0; row < rows; row++) { |
| 176 // post_proc_down for one row. |
| 177 p_src = src_ptr; |
| 178 p_dst = dst_ptr; |
| 179 |
| 180 for (col = 0; col < cols; col++) { |
| 181 int kernel = 4; |
| 182 int v = p_src[col]; |
| 183 |
| 184 for (i = -2; i <= 2; i++) { |
| 185 if (abs(v - p_src[col + i * pitch]) > flimit) |
| 186 goto down_skip_convolve; |
| 187 |
| 188 kernel += kernel5[2 + i] * p_src[col + i * pitch]; |
| 189 } |
| 190 |
| 191 v = (kernel >> 3); |
| 192 |
| 193 down_skip_convolve: |
| 194 p_dst[col] = v; |
| 195 } |
| 196 |
| 197 /* now post_proc_across */ |
| 198 p_src = dst_ptr; |
| 199 p_dst = dst_ptr; |
| 200 |
| 201 for (i = 0; i < 8; i++) |
| 202 d[i] = p_src[i]; |
| 203 |
| 204 for (col = 0; col < cols; col++) { |
| 205 int kernel = 4; |
| 206 v = p_src[col]; |
| 207 |
| 208 d[col & 7] = v; |
| 209 |
| 210 for (i = -2; i <= 2; i++) { |
| 211 if (abs(v - p_src[col + i]) > flimit) |
| 212 goto across_skip_convolve; |
| 213 |
| 214 kernel += kernel5[2 + i] * p_src[col + i]; |
| 215 } |
| 216 |
| 217 d[col & 7] = (kernel >> 3); |
| 218 |
| 219 across_skip_convolve: |
| 220 if (col >= 2) |
| 221 p_dst[col - 2] = d[(col - 2) & 7]; |
| 222 } |
| 223 |
| 224 /* handle the last two pixels */ |
| 225 p_dst[col - 2] = d[(col - 2) & 7]; |
| 226 p_dst[col - 1] = d[(col - 1) & 7]; |
| 227 |
| 228 |
| 229 /* next row */ |
| 230 src_ptr += pitch; |
| 231 dst_ptr += dst_pixels_per_line; |
| 232 } |
| 233 } |
| 234 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 235 |
155 static int q2mbl(int x) { | 236 static int q2mbl(int x) { |
156 if (x < 20) x = 20; | 237 if (x < 20) x = 20; |
157 | 238 |
158 x = 50 + (x - 50) * 10 / 8; | 239 x = 50 + (x - 50) * 10 / 8; |
159 return x * x / 3; | 240 return x * x / 3; |
160 } | 241 } |
161 | 242 |
162 void vp9_mbpost_proc_across_ip_c(uint8_t *src, int pitch, | 243 void vp9_mbpost_proc_across_ip_c(uint8_t *src, int pitch, |
163 int rows, int cols, int flimit) { | 244 int rows, int cols, int flimit) { |
164 int r, c, i; | 245 int r, c, i; |
165 | |
166 uint8_t *s = src; | 246 uint8_t *s = src; |
167 uint8_t d[16]; | 247 uint8_t d[16]; |
168 | 248 |
| 249 for (r = 0; r < rows; r++) { |
| 250 int sumsq = 0; |
| 251 int sum = 0; |
| 252 |
| 253 for (i = -8; i <= 6; i++) { |
| 254 sumsq += s[i] * s[i]; |
| 255 sum += s[i]; |
| 256 d[i + 8] = 0; |
| 257 } |
| 258 |
| 259 for (c = 0; c < cols + 8; c++) { |
| 260 int x = s[c + 7] - s[c - 8]; |
| 261 int y = s[c + 7] + s[c - 8]; |
| 262 |
| 263 sum += x; |
| 264 sumsq += x * y; |
| 265 |
| 266 d[c & 15] = s[c]; |
| 267 |
| 268 if (sumsq * 15 - sum * sum < flimit) { |
| 269 d[c & 15] = (8 + sum + s[c]) >> 4; |
| 270 } |
| 271 |
| 272 s[c - 8] = d[(c - 8) & 15]; |
| 273 } |
| 274 s += pitch; |
| 275 } |
| 276 } |
| 277 |
| 278 #if CONFIG_VP9_HIGHBITDEPTH |
| 279 void vp9_highbd_mbpost_proc_across_ip_c(uint16_t *src, int pitch, |
| 280 int rows, int cols, int flimit) { |
| 281 int r, c, i; |
| 282 |
| 283 uint16_t *s = src; |
| 284 uint16_t d[16]; |
| 285 |
169 | 286 |
170 for (r = 0; r < rows; r++) { | 287 for (r = 0; r < rows; r++) { |
171 int sumsq = 0; | 288 int sumsq = 0; |
172 int sum = 0; | 289 int sum = 0; |
173 | 290 |
174 for (i = -8; i <= 6; i++) { | 291 for (i = -8; i <= 6; i++) { |
175 sumsq += s[i] * s[i]; | 292 sumsq += s[i] * s[i]; |
176 sum += s[i]; | 293 sum += s[i]; |
177 d[i + 8] = 0; | 294 d[i + 8] = 0; |
178 } | 295 } |
(...skipping 10 matching lines...) Expand all Loading... |
189 if (sumsq * 15 - sum * sum < flimit) { | 306 if (sumsq * 15 - sum * sum < flimit) { |
190 d[c & 15] = (8 + sum + s[c]) >> 4; | 307 d[c & 15] = (8 + sum + s[c]) >> 4; |
191 } | 308 } |
192 | 309 |
193 s[c - 8] = d[(c - 8) & 15]; | 310 s[c - 8] = d[(c - 8) & 15]; |
194 } | 311 } |
195 | 312 |
196 s += pitch; | 313 s += pitch; |
197 } | 314 } |
198 } | 315 } |
| 316 #endif // CONFIG_VP9_HIGHBITDEPTH |
199 | 317 |
200 void vp9_mbpost_proc_down_c(uint8_t *dst, int pitch, | 318 void vp9_mbpost_proc_down_c(uint8_t *dst, int pitch, |
201 int rows, int cols, int flimit) { | 319 int rows, int cols, int flimit) { |
202 int r, c, i; | 320 int r, c, i; |
203 const short *rv3 = &vp9_rv[63 & rand()]; // NOLINT | 321 const short *rv3 = &vp9_rv[63 & rand()]; // NOLINT |
204 | 322 |
205 for (c = 0; c < cols; c++) { | 323 for (c = 0; c < cols; c++) { |
206 uint8_t *s = &dst[c]; | 324 uint8_t *s = &dst[c]; |
207 int sumsq = 0; | 325 int sumsq = 0; |
208 int sum = 0; | 326 int sum = 0; |
(...skipping 13 matching lines...) Expand all Loading... |
222 if (sumsq * 15 - sum * sum < flimit) { | 340 if (sumsq * 15 - sum * sum < flimit) { |
223 d[r & 15] = (rv2[r & 127] + sum + s[0]) >> 4; | 341 d[r & 15] = (rv2[r & 127] + sum + s[0]) >> 4; |
224 } | 342 } |
225 | 343 |
226 s[-8 * pitch] = d[(r - 8) & 15]; | 344 s[-8 * pitch] = d[(r - 8) & 15]; |
227 s += pitch; | 345 s += pitch; |
228 } | 346 } |
229 } | 347 } |
230 } | 348 } |
231 | 349 |
| 350 #if CONFIG_VP9_HIGHBITDEPTH |
| 351 void vp9_highbd_mbpost_proc_down_c(uint16_t *dst, int pitch, |
| 352 int rows, int cols, int flimit) { |
| 353 int r, c, i; |
| 354 const int16_t *rv3 = &vp9_rv[63 & rand()]; // NOLINT |
| 355 |
| 356 for (c = 0; c < cols; c++) { |
| 357 uint16_t *s = &dst[c]; |
| 358 int sumsq = 0; |
| 359 int sum = 0; |
| 360 uint16_t d[16]; |
| 361 const int16_t *rv2 = rv3 + ((c * 17) & 127); |
| 362 |
| 363 for (i = -8; i <= 6; i++) { |
| 364 sumsq += s[i * pitch] * s[i * pitch]; |
| 365 sum += s[i * pitch]; |
| 366 } |
| 367 |
| 368 for (r = 0; r < rows + 8; r++) { |
| 369 sumsq += s[7 * pitch] * s[ 7 * pitch] - s[-8 * pitch] * s[-8 * pitch]; |
| 370 sum += s[7 * pitch] - s[-8 * pitch]; |
| 371 d[r & 15] = s[0]; |
| 372 |
| 373 if (sumsq * 15 - sum * sum < flimit) { |
| 374 d[r & 15] = (rv2[r & 127] + sum + s[0]) >> 4; |
| 375 } |
| 376 |
| 377 s[-8 * pitch] = d[(r - 8) & 15]; |
| 378 s += pitch; |
| 379 } |
| 380 } |
| 381 } |
| 382 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 383 |
232 static void deblock_and_de_macro_block(YV12_BUFFER_CONFIG *source, | 384 static void deblock_and_de_macro_block(YV12_BUFFER_CONFIG *source, |
233 YV12_BUFFER_CONFIG *post, | 385 YV12_BUFFER_CONFIG *post, |
234 int q, | 386 int q, |
235 int low_var_thresh, | 387 int low_var_thresh, |
236 int flag) { | 388 int flag) { |
237 double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065; | 389 double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065; |
238 int ppl = (int)(level + .5); | 390 int ppl = (int)(level + .5); |
239 (void) low_var_thresh; | 391 (void) low_var_thresh; |
240 (void) flag; | 392 (void) flag; |
241 | 393 |
| 394 #if CONFIG_VP9_HIGHBITDEPTH |
| 395 if (source->flags & YV12_FLAG_HIGHBITDEPTH) { |
| 396 vp9_highbd_post_proc_down_and_across(CONVERT_TO_SHORTPTR(source->y_buffer), |
| 397 CONVERT_TO_SHORTPTR(post->y_buffer), |
| 398 source->y_stride, post->y_stride, |
| 399 source->y_height, source->y_width, |
| 400 ppl); |
| 401 |
| 402 vp9_highbd_mbpost_proc_across_ip(CONVERT_TO_SHORTPTR(post->y_buffer), |
| 403 post->y_stride, post->y_height, |
| 404 post->y_width, q2mbl(q)); |
| 405 |
| 406 vp9_highbd_mbpost_proc_down(CONVERT_TO_SHORTPTR(post->y_buffer), |
| 407 post->y_stride, post->y_height, |
| 408 post->y_width, q2mbl(q)); |
| 409 |
| 410 vp9_highbd_post_proc_down_and_across(CONVERT_TO_SHORTPTR(source->u_buffer), |
| 411 CONVERT_TO_SHORTPTR(post->u_buffer), |
| 412 source->uv_stride, post->uv_stride, |
| 413 source->uv_height, source->uv_width, |
| 414 ppl); |
| 415 vp9_highbd_post_proc_down_and_across(CONVERT_TO_SHORTPTR(source->v_buffer), |
| 416 CONVERT_TO_SHORTPTR(post->v_buffer), |
| 417 source->uv_stride, post->uv_stride, |
| 418 source->uv_height, source->uv_width, |
| 419 ppl); |
| 420 } else { |
| 421 vp9_post_proc_down_and_across(source->y_buffer, post->y_buffer, |
| 422 source->y_stride, post->y_stride, |
| 423 source->y_height, source->y_width, ppl); |
| 424 |
| 425 vp9_mbpost_proc_across_ip(post->y_buffer, post->y_stride, post->y_height, |
| 426 post->y_width, q2mbl(q)); |
| 427 |
| 428 vp9_mbpost_proc_down(post->y_buffer, post->y_stride, post->y_height, |
| 429 post->y_width, q2mbl(q)); |
| 430 |
| 431 vp9_post_proc_down_and_across(source->u_buffer, post->u_buffer, |
| 432 source->uv_stride, post->uv_stride, |
| 433 source->uv_height, source->uv_width, ppl); |
| 434 vp9_post_proc_down_and_across(source->v_buffer, post->v_buffer, |
| 435 source->uv_stride, post->uv_stride, |
| 436 source->uv_height, source->uv_width, ppl); |
| 437 } |
| 438 #else |
242 vp9_post_proc_down_and_across(source->y_buffer, post->y_buffer, | 439 vp9_post_proc_down_and_across(source->y_buffer, post->y_buffer, |
243 source->y_stride, post->y_stride, | 440 source->y_stride, post->y_stride, |
244 source->y_height, source->y_width, ppl); | 441 source->y_height, source->y_width, ppl); |
245 | 442 |
246 vp9_mbpost_proc_across_ip(post->y_buffer, post->y_stride, post->y_height, | 443 vp9_mbpost_proc_across_ip(post->y_buffer, post->y_stride, post->y_height, |
247 post->y_width, q2mbl(q)); | 444 post->y_width, q2mbl(q)); |
248 | 445 |
249 vp9_mbpost_proc_down(post->y_buffer, post->y_stride, post->y_height, | 446 vp9_mbpost_proc_down(post->y_buffer, post->y_stride, post->y_height, |
250 post->y_width, q2mbl(q)); | 447 post->y_width, q2mbl(q)); |
251 | 448 |
252 vp9_post_proc_down_and_across(source->u_buffer, post->u_buffer, | 449 vp9_post_proc_down_and_across(source->u_buffer, post->u_buffer, |
253 source->uv_stride, post->uv_stride, | 450 source->uv_stride, post->uv_stride, |
254 source->uv_height, source->uv_width, ppl); | 451 source->uv_height, source->uv_width, ppl); |
255 vp9_post_proc_down_and_across(source->v_buffer, post->v_buffer, | 452 vp9_post_proc_down_and_across(source->v_buffer, post->v_buffer, |
256 source->uv_stride, post->uv_stride, | 453 source->uv_stride, post->uv_stride, |
257 source->uv_height, source->uv_width, ppl); | 454 source->uv_height, source->uv_width, ppl); |
| 455 #endif // CONFIG_VP9_HIGHBITDEPTH |
258 } | 456 } |
259 | 457 |
260 void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, | 458 void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, |
261 int q) { | 459 int q) { |
262 const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q | 460 const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q |
263 + 0.0065 + 0.5); | 461 + 0.0065 + 0.5); |
264 int i; | 462 int i; |
265 | 463 |
266 const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer}; | 464 const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer}; |
267 const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride}; | 465 const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride}; |
268 const int src_widths[3] = {src->y_width, src->uv_width, src->uv_width}; | 466 const int src_widths[3] = {src->y_width, src->uv_width, src->uv_width}; |
269 const int src_heights[3] = {src->y_height, src->uv_height, src->uv_height}; | 467 const int src_heights[3] = {src->y_height, src->uv_height, src->uv_height}; |
270 | 468 |
271 uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer}; | 469 uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer}; |
272 const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride}; | 470 const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride}; |
273 | 471 |
274 for (i = 0; i < MAX_MB_PLANE; ++i) | 472 for (i = 0; i < MAX_MB_PLANE; ++i) { |
| 473 #if CONFIG_VP9_HIGHBITDEPTH |
| 474 assert((src->flags & YV12_FLAG_HIGHBITDEPTH) == |
| 475 (dst->flags & YV12_FLAG_HIGHBITDEPTH)); |
| 476 if (src->flags & YV12_FLAG_HIGHBITDEPTH) { |
| 477 vp9_highbd_post_proc_down_and_across(CONVERT_TO_SHORTPTR(srcs[i]), |
| 478 CONVERT_TO_SHORTPTR(dsts[i]), |
| 479 src_strides[i], dst_strides[i], |
| 480 src_heights[i], src_widths[i], ppl); |
| 481 } else { |
| 482 vp9_post_proc_down_and_across(srcs[i], dsts[i], |
| 483 src_strides[i], dst_strides[i], |
| 484 src_heights[i], src_widths[i], ppl); |
| 485 } |
| 486 #else |
275 vp9_post_proc_down_and_across(srcs[i], dsts[i], | 487 vp9_post_proc_down_and_across(srcs[i], dsts[i], |
276 src_strides[i], dst_strides[i], | 488 src_strides[i], dst_strides[i], |
277 src_heights[i], src_widths[i], ppl); | 489 src_heights[i], src_widths[i], ppl); |
| 490 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 491 } |
278 } | 492 } |
279 | 493 |
280 void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, | 494 void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, |
281 int q) { | 495 int q) { |
282 const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q | 496 const int ppl = (int)(6.0e-05 * q * q * q - 0.0067 * q * q + 0.306 * q |
283 + 0.0065 + 0.5); | 497 + 0.0065 + 0.5); |
284 int i; | 498 int i; |
285 | 499 |
286 const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer}; | 500 const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer}; |
287 const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride}; | 501 const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride}; |
288 const int src_widths[3] = {src->y_width, src->uv_width, src->uv_width}; | 502 const int src_widths[3] = {src->y_width, src->uv_width, src->uv_width}; |
289 const int src_heights[3] = {src->y_height, src->uv_height, src->uv_height}; | 503 const int src_heights[3] = {src->y_height, src->uv_height, src->uv_height}; |
290 | 504 |
291 uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer}; | 505 uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer}; |
292 const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride}; | 506 const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride}; |
293 | 507 |
294 for (i = 0; i < MAX_MB_PLANE; ++i) { | 508 for (i = 0; i < MAX_MB_PLANE; ++i) { |
295 const int src_stride = src_strides[i]; | 509 const int src_stride = src_strides[i]; |
296 const uint8_t *const src = srcs[i] + 2 * src_stride + 2; | |
297 const int src_width = src_widths[i] - 4; | 510 const int src_width = src_widths[i] - 4; |
298 const int src_height = src_heights[i] - 4; | 511 const int src_height = src_heights[i] - 4; |
| 512 const int dst_stride = dst_strides[i]; |
299 | 513 |
300 const int dst_stride = dst_strides[i]; | 514 #if CONFIG_VP9_HIGHBITDEPTH |
| 515 assert((src->flags & YV12_FLAG_HIGHBITDEPTH) == |
| 516 (dst->flags & YV12_FLAG_HIGHBITDEPTH)); |
| 517 if (src->flags & YV12_FLAG_HIGHBITDEPTH) { |
| 518 const uint16_t *const src = CONVERT_TO_SHORTPTR(srcs[i] + 2 * src_stride |
| 519 + 2); |
| 520 uint16_t *const dst = CONVERT_TO_SHORTPTR(dsts[i] + 2 * dst_stride + 2); |
| 521 vp9_highbd_post_proc_down_and_across(src, dst, src_stride, dst_stride, |
| 522 src_height, src_width, ppl); |
| 523 } else { |
| 524 const uint8_t *const src = srcs[i] + 2 * src_stride + 2; |
| 525 uint8_t *const dst = dsts[i] + 2 * dst_stride + 2; |
| 526 |
| 527 vp9_post_proc_down_and_across(src, dst, src_stride, dst_stride, |
| 528 src_height, src_width, ppl); |
| 529 } |
| 530 #else |
| 531 const uint8_t *const src = srcs[i] + 2 * src_stride + 2; |
301 uint8_t *const dst = dsts[i] + 2 * dst_stride + 2; | 532 uint8_t *const dst = dsts[i] + 2 * dst_stride + 2; |
302 | |
303 vp9_post_proc_down_and_across(src, dst, src_stride, dst_stride, | 533 vp9_post_proc_down_and_across(src, dst, src_stride, dst_stride, |
304 src_height, src_width, ppl); | 534 src_height, src_width, ppl); |
| 535 #endif |
305 } | 536 } |
306 } | 537 } |
307 | 538 |
308 static double gaussian(double sigma, double mu, double x) { | 539 static double gaussian(double sigma, double mu, double x) { |
309 return 1 / (sigma * sqrt(2.0 * 3.14159265)) * | 540 return 1 / (sigma * sqrt(2.0 * 3.14159265)) * |
310 (exp(-(x - mu) * (x - mu) / (2 * sigma * sigma))); | 541 (exp(-(x - mu) * (x - mu) / (2 * sigma * sigma))); |
311 } | 542 } |
312 | 543 |
313 static void fillrd(struct postproc_state *state, int q, int a) { | 544 static void fillrd(struct postproc_state *state, int q, int a) { |
314 char char_dist[300]; | 545 char char_dist[300]; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (!flags) { | 629 if (!flags) { |
399 *dest = *cm->frame_to_show; | 630 *dest = *cm->frame_to_show; |
400 return 0; | 631 return 0; |
401 } | 632 } |
402 | 633 |
403 vp9_clear_system_state(); | 634 vp9_clear_system_state(); |
404 | 635 |
405 #if CONFIG_VP9_POSTPROC || CONFIG_INTERNAL_STATS | 636 #if CONFIG_VP9_POSTPROC || CONFIG_INTERNAL_STATS |
406 if (vp9_realloc_frame_buffer(&cm->post_proc_buffer, cm->width, cm->height, | 637 if (vp9_realloc_frame_buffer(&cm->post_proc_buffer, cm->width, cm->height, |
407 cm->subsampling_x, cm->subsampling_y, | 638 cm->subsampling_x, cm->subsampling_y, |
| 639 #if CONFIG_VP9_HIGHBITDEPTH |
| 640 cm->use_highbitdepth, |
| 641 #endif |
408 VP9_DEC_BORDER_IN_PIXELS, NULL, NULL, NULL) < 0) | 642 VP9_DEC_BORDER_IN_PIXELS, NULL, NULL, NULL) < 0) |
409 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, | 643 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, |
410 "Failed to allocate post-processing buffer"); | 644 "Failed to allocate post-processing buffer"); |
411 #endif | 645 #endif |
412 | 646 |
413 if (flags & VP9D_DEMACROBLOCK) { | 647 if (flags & VP9D_DEMACROBLOCK) { |
414 deblock_and_de_macro_block(cm->frame_to_show, ppbuf, | 648 deblock_and_de_macro_block(cm->frame_to_show, ppbuf, |
415 q + (ppflags->deblocking_level - 5) * 10, 1, 0); | 649 q + (ppflags->deblocking_level - 5) * 10, 1, 0); |
416 } else if (flags & VP9D_DEBLOCK) { | 650 } else if (flags & VP9D_DEBLOCK) { |
417 vp9_deblock(cm->frame_to_show, ppbuf, q); | 651 vp9_deblock(cm->frame_to_show, ppbuf, q); |
(...skipping 17 matching lines...) Expand all Loading... |
435 | 669 |
436 /* handle problem with extending borders */ | 670 /* handle problem with extending borders */ |
437 dest->y_width = cm->width; | 671 dest->y_width = cm->width; |
438 dest->y_height = cm->height; | 672 dest->y_height = cm->height; |
439 dest->uv_width = dest->y_width >> cm->subsampling_x; | 673 dest->uv_width = dest->y_width >> cm->subsampling_x; |
440 dest->uv_height = dest->y_height >> cm->subsampling_y; | 674 dest->uv_height = dest->y_height >> cm->subsampling_y; |
441 | 675 |
442 return 0; | 676 return 0; |
443 } | 677 } |
444 #endif | 678 #endif |
OLD | NEW |