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 | 11 |
12 #include "vpx_ports/config.h" | 12 #include "./vpx_config.h" |
13 #include "vpx_scale/yv12config.h" | 13 #include "vpx_scale/yv12config.h" |
14 #include "vp9/common/vp9_postproc.h" | 14 #include "vp9/common/vp9_postproc.h" |
15 #include "vp9/common/vp9_textblit.h" | 15 #include "vp9/common/vp9_textblit.h" |
16 #include "vpx_scale/vpxscale.h" | 16 #include "vpx_scale/vpx_scale.h" |
17 #include "vp9/common/vp9_systemdependent.h" | 17 #include "vp9/common/vp9_systemdependent.h" |
18 #include "./vp9_rtcd.h" | 18 #include "./vp9_rtcd.h" |
19 #include "./vpx_scale_rtcd.h" | 19 #include "./vpx_scale_rtcd.h" |
20 | 20 |
21 | 21 |
22 #include <math.h> | 22 #include <math.h> |
23 #include <stdlib.h> | 23 #include <stdlib.h> |
24 #include <stdio.h> | 24 #include <stdio.h> |
25 | 25 |
26 #define RGB_TO_YUV(t) \ | 26 #define RGB_TO_YUV(t) \ |
27 ( (0.257*(float)(t >> 16)) + (0.504*(float)(t >> 8 & 0xff)) + \ | 27 ( (0.257*(float)(t >> 16)) + (0.504*(float)(t >> 8 & 0xff)) + \ |
28 (0.098*(float)(t & 0xff)) + 16), \ | 28 (0.098*(float)(t & 0xff)) + 16), \ |
29 (-(0.148*(float)(t >> 16)) - (0.291*(float)(t >> 8 & 0xff)) + \ | 29 (-(0.148*(float)(t >> 16)) - (0.291*(float)(t >> 8 & 0xff)) + \ |
30 (0.439*(float)(t & 0xff)) + 128), \ | 30 (0.439*(float)(t & 0xff)) + 128), \ |
31 ( (0.439*(float)(t >> 16)) - (0.368*(float)(t >> 8 & 0xff)) - \ | 31 ( (0.439*(float)(t >> 16)) - (0.368*(float)(t >> 8 & 0xff)) - \ |
32 (0.071*(float)(t & 0xff)) + 128) | 32 (0.071*(float)(t & 0xff)) + 128) |
33 | 33 |
34 /* global constants */ | 34 /* global constants */ |
35 #if CONFIG_POSTPROC_VISUALIZER | 35 #if 0 && CONFIG_POSTPROC_VISUALIZER |
36 static const unsigned char MB_PREDICTION_MODE_colors[MB_MODE_COUNT][3] = { | 36 static const unsigned char MB_PREDICTION_MODE_colors[MB_MODE_COUNT][3] = { |
37 { RGB_TO_YUV(0x98FB98) }, /* PaleGreen */ | 37 { RGB_TO_YUV(0x98FB98) }, /* PaleGreen */ |
38 { RGB_TO_YUV(0x00FF00) }, /* Green */ | 38 { RGB_TO_YUV(0x00FF00) }, /* Green */ |
39 { RGB_TO_YUV(0xADFF2F) }, /* GreenYellow */ | 39 { RGB_TO_YUV(0xADFF2F) }, /* GreenYellow */ |
40 { RGB_TO_YUV(0x8F0000) }, /* Dark Red */ | 40 { RGB_TO_YUV(0x8F0000) }, /* Dark Red */ |
41 { RGB_TO_YUV(0x008F8F) }, /* Dark Cyan */ | 41 { RGB_TO_YUV(0x008F8F) }, /* Dark Cyan */ |
42 { RGB_TO_YUV(0x008F8F) }, /* Dark Cyan */ | 42 { RGB_TO_YUV(0x008F8F) }, /* Dark Cyan */ |
43 { RGB_TO_YUV(0x008F8F) }, /* Dark Cyan */ | 43 { RGB_TO_YUV(0x008F8F) }, /* Dark Cyan */ |
44 { RGB_TO_YUV(0x8F0000) }, /* Dark Red */ | 44 { RGB_TO_YUV(0x8F0000) }, /* Dark Red */ |
45 { RGB_TO_YUV(0x8F0000) }, /* Dark Red */ | 45 { RGB_TO_YUV(0x8F0000) }, /* Dark Red */ |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 3, 8, 3, 7, 8, 5, 11, 4, 12, 3, | 125 3, 8, 3, 7, 8, 5, 11, 4, 12, 3, |
126 11, 9, 14, 8, 14, 13, 4, 3, 1, 2, | 126 11, 9, 14, 8, 14, 13, 4, 3, 1, 2, |
127 14, 6, 5, 4, 4, 11, 4, 6, 2, 1, | 127 14, 6, 5, 4, 4, 11, 4, 6, 2, 1, |
128 5, 8, 8, 12, 13, 5, 14, 10, 12, 13, | 128 5, 8, 8, 12, 13, 5, 14, 10, 12, 13, |
129 0, 9, 5, 5, 11, 10, 13, 9, 10, 13, | 129 0, 9, 5, 5, 11, 10, 13, 9, 10, 13, |
130 }; | 130 }; |
131 | 131 |
132 | 132 |
133 /**************************************************************************** | 133 /**************************************************************************** |
134 */ | 134 */ |
135 void vp9_post_proc_down_and_across_c(unsigned char *src_ptr, | 135 void vp9_post_proc_down_and_across_c(uint8_t *src_ptr, |
136 unsigned char *dst_ptr, | 136 uint8_t *dst_ptr, |
137 int src_pixels_per_line, | 137 int src_pixels_per_line, |
138 int dst_pixels_per_line, | 138 int dst_pixels_per_line, |
139 int rows, | 139 int rows, |
140 int cols, | 140 int cols, |
141 int flimit) { | 141 int flimit) { |
142 unsigned char *p_src, *p_dst; | 142 uint8_t *p_src, *p_dst; |
143 int row; | 143 int row; |
144 int col; | 144 int col; |
145 int i; | 145 int i; |
146 int v; | 146 int v; |
147 int pitch = src_pixels_per_line; | 147 int pitch = src_pixels_per_line; |
148 unsigned char d[8]; | 148 uint8_t d[8]; |
149 (void)dst_pixels_per_line; | 149 (void)dst_pixels_per_line; |
150 | 150 |
151 for (row = 0; row < rows; row++) { | 151 for (row = 0; row < rows; row++) { |
152 /* post_proc_down for one row */ | 152 /* post_proc_down for one row */ |
153 p_src = src_ptr; | 153 p_src = src_ptr; |
154 p_dst = dst_ptr; | 154 p_dst = dst_ptr; |
155 | 155 |
156 for (col = 0; col < cols; col++) { | 156 for (col = 0; col < cols; col++) { |
157 | 157 |
158 int kernel = 4; | 158 int kernel = 4; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 } | 208 } |
209 } | 209 } |
210 | 210 |
211 static int q2mbl(int x) { | 211 static int q2mbl(int x) { |
212 if (x < 20) x = 20; | 212 if (x < 20) x = 20; |
213 | 213 |
214 x = 50 + (x - 50) * 10 / 8; | 214 x = 50 + (x - 50) * 10 / 8; |
215 return x * x / 3; | 215 return x * x / 3; |
216 } | 216 } |
217 | 217 |
218 void vp9_mbpost_proc_across_ip_c(unsigned char *src, int pitch, | 218 void vp9_mbpost_proc_across_ip_c(uint8_t *src, int pitch, |
219 int rows, int cols, int flimit) { | 219 int rows, int cols, int flimit) { |
220 int r, c, i; | 220 int r, c, i; |
221 | 221 |
222 unsigned char *s = src; | 222 uint8_t *s = src; |
223 unsigned char d[16]; | 223 uint8_t d[16]; |
224 | 224 |
225 | 225 |
226 for (r = 0; r < rows; r++) { | 226 for (r = 0; r < rows; r++) { |
227 int sumsq = 0; | 227 int sumsq = 0; |
228 int sum = 0; | 228 int sum = 0; |
229 | 229 |
230 for (i = -8; i <= 6; i++) { | 230 for (i = -8; i <= 6; i++) { |
231 sumsq += s[i] * s[i]; | 231 sumsq += s[i] * s[i]; |
232 sum += s[i]; | 232 sum += s[i]; |
233 d[i + 8] = 0; | 233 d[i + 8] = 0; |
(...skipping 12 matching lines...) Expand all Loading... |
246 d[c & 15] = (8 + sum + s[c]) >> 4; | 246 d[c & 15] = (8 + sum + s[c]) >> 4; |
247 } | 247 } |
248 | 248 |
249 s[c - 8] = d[(c - 8) & 15]; | 249 s[c - 8] = d[(c - 8) & 15]; |
250 } | 250 } |
251 | 251 |
252 s += pitch; | 252 s += pitch; |
253 } | 253 } |
254 } | 254 } |
255 | 255 |
256 void vp9_mbpost_proc_down_c(unsigned char *dst, int pitch, | 256 void vp9_mbpost_proc_down_c(uint8_t *dst, int pitch, |
257 int rows, int cols, int flimit) { | 257 int rows, int cols, int flimit) { |
258 int r, c, i; | 258 int r, c, i; |
259 const short *rv3 = &vp9_rv[63 & rand()]; | 259 const short *rv3 = &vp9_rv[63 & rand()]; |
260 | 260 |
261 for (c = 0; c < cols; c++) { | 261 for (c = 0; c < cols; c++) { |
262 unsigned char *s = &dst[c]; | 262 uint8_t *s = &dst[c]; |
263 int sumsq = 0; | 263 int sumsq = 0; |
264 int sum = 0; | 264 int sum = 0; |
265 unsigned char d[16]; | 265 uint8_t d[16]; |
266 const short *rv2 = rv3 + ((c * 17) & 127); | 266 const short *rv2 = rv3 + ((c * 17) & 127); |
267 | 267 |
268 for (i = -8; i <= 6; i++) { | 268 for (i = -8; i <= 6; i++) { |
269 sumsq += s[i * pitch] * s[i * pitch]; | 269 sumsq += s[i * pitch] * s[i * pitch]; |
270 sum += s[i * pitch]; | 270 sum += s[i * pitch]; |
271 } | 271 } |
272 | 272 |
273 for (r = 0; r < rows + 8; r++) { | 273 for (r = 0; r < rows + 8; r++) { |
274 sumsq += s[7 * pitch] * s[ 7 * pitch] - s[-8 * pitch] * s[-8 * pitch]; | 274 sumsq += s[7 * pitch] * s[ 7 * pitch] - s[-8 * pitch] * s[-8 * pitch]; |
275 sum += s[7 * pitch] - s[-8 * pitch]; | 275 sum += s[7 * pitch] - s[-8 * pitch]; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 * | 432 * |
433 * OUTPUTS : None. | 433 * OUTPUTS : None. |
434 * | 434 * |
435 * RETURNS : void. | 435 * RETURNS : void. |
436 * | 436 * |
437 * FUNCTION : adds gaussian noise to a plane of pixels | 437 * FUNCTION : adds gaussian noise to a plane of pixels |
438 * | 438 * |
439 * SPECIAL NOTES : None. | 439 * SPECIAL NOTES : None. |
440 * | 440 * |
441 ****************************************************************************/ | 441 ****************************************************************************/ |
442 void vp9_plane_add_noise_c(unsigned char *Start, char *noise, | 442 void vp9_plane_add_noise_c(uint8_t *Start, char *noise, |
443 char blackclamp[16], | 443 char blackclamp[16], |
444 char whiteclamp[16], | 444 char whiteclamp[16], |
445 char bothclamp[16], | 445 char bothclamp[16], |
446 unsigned int Width, unsigned int Height, int Pitch) { | 446 unsigned int Width, unsigned int Height, int Pitch) { |
447 unsigned int i, j; | 447 unsigned int i, j; |
448 | 448 |
449 for (i = 0; i < Height; i++) { | 449 for (i = 0; i < Height; i++) { |
450 unsigned char *Pos = Start + i * Pitch; | 450 uint8_t *Pos = Start + i * Pitch; |
451 char *Ref = (char *)(noise + (rand() & 0xff)); | 451 char *Ref = (char *)(noise + (rand() & 0xff)); |
452 | 452 |
453 for (j = 0; j < Width; j++) { | 453 for (j = 0; j < Width; j++) { |
454 if (Pos[j] < blackclamp[0]) | 454 if (Pos[j] < blackclamp[0]) |
455 Pos[j] = blackclamp[0]; | 455 Pos[j] = blackclamp[0]; |
456 | 456 |
457 if (Pos[j] > 255 + whiteclamp[0]) | 457 if (Pos[j] > 255 + whiteclamp[0]) |
458 Pos[j] = 255 + whiteclamp[0]; | 458 Pos[j] = 255 + whiteclamp[0]; |
459 | 459 |
460 Pos[j] += Ref[j]; | 460 Pos[j] += Ref[j]; |
461 } | 461 } |
462 } | 462 } |
463 } | 463 } |
464 | 464 |
465 /* Blend the macro block with a solid colored square. Leave the | 465 /* Blend the macro block with a solid colored square. Leave the |
466 * edges unblended to give distinction to macro blocks in areas | 466 * edges unblended to give distinction to macro blocks in areas |
467 * filled with the same color block. | 467 * filled with the same color block. |
468 */ | 468 */ |
469 void vp9_blend_mb_inner_c(unsigned char *y, unsigned char *u, unsigned char *v, | 469 void vp9_blend_mb_inner_c(uint8_t *y, uint8_t *u, uint8_t *v, |
470 int y1, int u1, int v1, int alpha, int stride) { | 470 int y1, int u1, int v1, int alpha, int stride) { |
471 int i, j; | 471 int i, j; |
472 int y1_const = y1 * ((1 << 16) - alpha); | 472 int y1_const = y1 * ((1 << 16) - alpha); |
473 int u1_const = u1 * ((1 << 16) - alpha); | 473 int u1_const = u1 * ((1 << 16) - alpha); |
474 int v1_const = v1 * ((1 << 16) - alpha); | 474 int v1_const = v1 * ((1 << 16) - alpha); |
475 | 475 |
476 y += 2 * stride + 2; | 476 y += 2 * stride + 2; |
477 for (i = 0; i < 12; i++) { | 477 for (i = 0; i < 12; i++) { |
478 for (j = 0; j < 12; j++) { | 478 for (j = 0; j < 12; j++) { |
479 y[j] = (y[j] * alpha + y1_const) >> 16; | 479 y[j] = (y[j] * alpha + y1_const) >> 16; |
(...skipping 12 matching lines...) Expand all Loading... |
492 v[j] = (v[j] * alpha + v1_const) >> 16; | 492 v[j] = (v[j] * alpha + v1_const) >> 16; |
493 } | 493 } |
494 u += stride; | 494 u += stride; |
495 v += stride; | 495 v += stride; |
496 } | 496 } |
497 } | 497 } |
498 | 498 |
499 /* Blend only the edge of the macro block. Leave center | 499 /* Blend only the edge of the macro block. Leave center |
500 * unblended to allow for other visualizations to be layered. | 500 * unblended to allow for other visualizations to be layered. |
501 */ | 501 */ |
502 void vp9_blend_mb_outer_c(unsigned char *y, unsigned char *u, unsigned char *v, | 502 void vp9_blend_mb_outer_c(uint8_t *y, uint8_t *u, uint8_t *v, |
503 int y1, int u1, int v1, int alpha, int stride) { | 503 int y1, int u1, int v1, int alpha, int stride) { |
504 int i, j; | 504 int i, j; |
505 int y1_const = y1 * ((1 << 16) - alpha); | 505 int y1_const = y1 * ((1 << 16) - alpha); |
506 int u1_const = u1 * ((1 << 16) - alpha); | 506 int u1_const = u1 * ((1 << 16) - alpha); |
507 int v1_const = v1 * ((1 << 16) - alpha); | 507 int v1_const = v1 * ((1 << 16) - alpha); |
508 | 508 |
509 for (i = 0; i < 2; i++) { | 509 for (i = 0; i < 2; i++) { |
510 for (j = 0; j < 16; j++) { | 510 for (j = 0; j < 16; j++) { |
511 y[j] = (y[j] * alpha + y1_const) >> 16; | 511 y[j] = (y[j] * alpha + y1_const) >> 16; |
512 } | 512 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 u += stride; | 547 u += stride; |
548 v += stride; | 548 v += stride; |
549 } | 549 } |
550 | 550 |
551 for (j = 0; j < 8; j++) { | 551 for (j = 0; j < 8; j++) { |
552 u[j] = (u[j] * alpha + u1_const) >> 16; | 552 u[j] = (u[j] * alpha + u1_const) >> 16; |
553 v[j] = (v[j] * alpha + v1_const) >> 16; | 553 v[j] = (v[j] * alpha + v1_const) >> 16; |
554 } | 554 } |
555 } | 555 } |
556 | 556 |
557 void vp9_blend_b_c(unsigned char *y, unsigned char *u, unsigned char *v, | 557 void vp9_blend_b_c(uint8_t *y, uint8_t *u, uint8_t *v, |
558 int y1, int u1, int v1, int alpha, int stride) { | 558 int y1, int u1, int v1, int alpha, int stride) { |
559 int i, j; | 559 int i, j; |
560 int y1_const = y1 * ((1 << 16) - alpha); | 560 int y1_const = y1 * ((1 << 16) - alpha); |
561 int u1_const = u1 * ((1 << 16) - alpha); | 561 int u1_const = u1 * ((1 << 16) - alpha); |
562 int v1_const = v1 * ((1 << 16) - alpha); | 562 int v1_const = v1 * ((1 << 16) - alpha); |
563 | 563 |
564 for (i = 0; i < 4; i++) { | 564 for (i = 0; i < 4; i++) { |
565 for (j = 0; j < 4; j++) { | 565 for (j = 0; j < 4; j++) { |
566 y[j] = (y[j] * alpha + y1_const) >> 16; | 566 y[j] = (y[j] * alpha + y1_const) >> 16; |
567 } | 567 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 vp9_plane_add_noise(oci->post_proc_buffer.y_buffer, | 665 vp9_plane_add_noise(oci->post_proc_buffer.y_buffer, |
666 oci->postproc_state.noise, | 666 oci->postproc_state.noise, |
667 oci->postproc_state.blackclamp, | 667 oci->postproc_state.blackclamp, |
668 oci->postproc_state.whiteclamp, | 668 oci->postproc_state.whiteclamp, |
669 oci->postproc_state.bothclamp, | 669 oci->postproc_state.bothclamp, |
670 oci->post_proc_buffer.y_width, | 670 oci->post_proc_buffer.y_width, |
671 oci->post_proc_buffer.y_height, | 671 oci->post_proc_buffer.y_height, |
672 oci->post_proc_buffer.y_stride); | 672 oci->post_proc_buffer.y_stride); |
673 } | 673 } |
674 | 674 |
675 #if CONFIG_POSTPROC_VISUALIZER | 675 #if 0 && CONFIG_POSTPROC_VISUALIZER |
676 if (flags & VP9D_DEBUG_TXT_FRAME_INFO) { | 676 if (flags & VP9D_DEBUG_TXT_FRAME_INFO) { |
677 char message[512]; | 677 char message[512]; |
678 sprintf(message, "F%1dG%1dQ%3dF%3dP%d_s%dx%d", | 678 sprintf(message, "F%1dG%1dQ%3dF%3dP%d_s%dx%d", |
679 (oci->frame_type == KEY_FRAME), | 679 (oci->frame_type == KEY_FRAME), |
680 oci->refresh_golden_frame, | 680 oci->refresh_golden_frame, |
681 oci->base_qindex, | 681 oci->base_qindex, |
682 oci->filter_level, | 682 oci->filter_level, |
683 flags, | 683 flags, |
684 oci->mb_cols, oci->mb_rows); | 684 oci->mb_cols, oci->mb_rows); |
685 vp9_blit_text(message, oci->post_proc_buffer.y_buffer, | 685 vp9_blit_text(message, oci->post_proc_buffer.y_buffer, |
686 oci->post_proc_buffer.y_stride); | 686 oci->post_proc_buffer.y_stride); |
687 } | 687 } |
688 | 688 |
689 if (flags & VP9D_DEBUG_TXT_MBLK_MODES) { | 689 if (flags & VP9D_DEBUG_TXT_MBLK_MODES) { |
690 int i, j; | 690 int i, j; |
691 unsigned char *y_ptr; | 691 uint8_t *y_ptr; |
692 YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer; | 692 YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer; |
693 int mb_rows = post->y_height >> 4; | 693 int mb_rows = post->y_height >> 4; |
694 int mb_cols = post->y_width >> 4; | 694 int mb_cols = post->y_width >> 4; |
695 int mb_index = 0; | 695 int mb_index = 0; |
696 MODE_INFO *mi = oci->mi; | 696 MODE_INFO *mi = oci->mi; |
697 | 697 |
698 y_ptr = post->y_buffer + 4 * post->y_stride + 4; | 698 y_ptr = post->y_buffer + 4 * post->y_stride + 4; |
699 | 699 |
700 /* vp9_filter each macro block */ | 700 /* vp9_filter each macro block */ |
701 for (i = 0; i < mb_rows; i++) { | 701 for (i = 0; i < mb_rows; i++) { |
702 for (j = 0; j < mb_cols; j++) { | 702 for (j = 0; j < mb_cols; j++) { |
703 char zz[4]; | 703 char zz[4]; |
704 | 704 |
705 sprintf(zz, "%c", mi[mb_index].mbmi.mode + 'a'); | 705 sprintf(zz, "%c", mi[mb_index].mbmi.mode + 'a'); |
706 | 706 |
707 vp9_blit_text(zz, y_ptr, post->y_stride); | 707 vp9_blit_text(zz, y_ptr, post->y_stride); |
708 mb_index++; | 708 mb_index++; |
709 y_ptr += 16; | 709 y_ptr += 16; |
710 } | 710 } |
711 | 711 |
712 mb_index++; /* border */ | 712 mb_index++; /* border */ |
713 y_ptr += post->y_stride * 16 - post->y_width; | 713 y_ptr += post->y_stride * 16 - post->y_width; |
714 | 714 |
715 } | 715 } |
716 } | 716 } |
717 | 717 |
718 if (flags & VP9D_DEBUG_TXT_DC_DIFF) { | 718 if (flags & VP9D_DEBUG_TXT_DC_DIFF) { |
719 int i, j; | 719 int i, j; |
720 unsigned char *y_ptr; | 720 uint8_t *y_ptr; |
721 YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer; | 721 YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer; |
722 int mb_rows = post->y_height >> 4; | 722 int mb_rows = post->y_height >> 4; |
723 int mb_cols = post->y_width >> 4; | 723 int mb_cols = post->y_width >> 4; |
724 int mb_index = 0; | 724 int mb_index = 0; |
725 MODE_INFO *mi = oci->mi; | 725 MODE_INFO *mi = oci->mi; |
726 | 726 |
727 y_ptr = post->y_buffer + 4 * post->y_stride + 4; | 727 y_ptr = post->y_buffer + 4 * post->y_stride + 4; |
728 | 728 |
729 /* vp9_filter each macro block */ | 729 /* vp9_filter each macro block */ |
730 for (i = 0; i < mb_rows; i++) { | 730 for (i = 0; i < mb_rows; i++) { |
(...skipping 26 matching lines...) Expand all Loading... |
757 oci->bitrate, oci->framerate); | 757 oci->bitrate, oci->framerate); |
758 vp9_blit_text(message, oci->post_proc_buffer.y_buffer, | 758 vp9_blit_text(message, oci->post_proc_buffer.y_buffer, |
759 oci->post_proc_buffer.y_stride); | 759 oci->post_proc_buffer.y_stride); |
760 } | 760 } |
761 | 761 |
762 /* Draw motion vectors */ | 762 /* Draw motion vectors */ |
763 if ((flags & VP9D_DEBUG_DRAW_MV) && ppflags->display_mv_flag) { | 763 if ((flags & VP9D_DEBUG_DRAW_MV) && ppflags->display_mv_flag) { |
764 YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer; | 764 YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer; |
765 int width = post->y_width; | 765 int width = post->y_width; |
766 int height = post->y_height; | 766 int height = post->y_height; |
767 unsigned char *y_buffer = oci->post_proc_buffer.y_buffer; | 767 uint8_t *y_buffer = oci->post_proc_buffer.y_buffer; |
768 int y_stride = oci->post_proc_buffer.y_stride; | 768 int y_stride = oci->post_proc_buffer.y_stride; |
769 MODE_INFO *mi = oci->mi; | 769 MODE_INFO *mi = oci->mi; |
770 int x0, y0; | 770 int x0, y0; |
771 | 771 |
772 for (y0 = 0; y0 < height; y0 += 16) { | 772 for (y0 = 0; y0 < height; y0 += 16) { |
773 for (x0 = 0; x0 < width; x0 += 16) { | 773 for (x0 = 0; x0 < width; x0 += 16) { |
774 int x1, y1; | 774 int x1, y1; |
775 | 775 |
776 if (!(ppflags->display_mv_flag & (1 << mi->mbmi.mode))) { | 776 if (!(ppflags->display_mv_flag & (1 << mi->mbmi.mode))) { |
777 mi++; | 777 mi++; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 } | 899 } |
900 } | 900 } |
901 | 901 |
902 /* Color in block modes */ | 902 /* Color in block modes */ |
903 if ((flags & VP9D_DEBUG_CLR_BLK_MODES) | 903 if ((flags & VP9D_DEBUG_CLR_BLK_MODES) |
904 && (ppflags->display_mb_modes_flag || ppflags->display_b_modes_flag)) { | 904 && (ppflags->display_mb_modes_flag || ppflags->display_b_modes_flag)) { |
905 int y, x; | 905 int y, x; |
906 YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer; | 906 YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer; |
907 int width = post->y_width; | 907 int width = post->y_width; |
908 int height = post->y_height; | 908 int height = post->y_height; |
909 unsigned char *y_ptr = oci->post_proc_buffer.y_buffer; | 909 uint8_t *y_ptr = oci->post_proc_buffer.y_buffer; |
910 unsigned char *u_ptr = oci->post_proc_buffer.u_buffer; | 910 uint8_t *u_ptr = oci->post_proc_buffer.u_buffer; |
911 unsigned char *v_ptr = oci->post_proc_buffer.v_buffer; | 911 uint8_t *v_ptr = oci->post_proc_buffer.v_buffer; |
912 int y_stride = oci->post_proc_buffer.y_stride; | 912 int y_stride = oci->post_proc_buffer.y_stride; |
913 MODE_INFO *mi = oci->mi; | 913 MODE_INFO *mi = oci->mi; |
914 | 914 |
915 for (y = 0; y < height; y += 16) { | 915 for (y = 0; y < height; y += 16) { |
916 for (x = 0; x < width; x += 16) { | 916 for (x = 0; x < width; x += 16) { |
917 int Y = 0, U = 0, V = 0; | 917 int Y = 0, U = 0, V = 0; |
918 | 918 |
919 if (mi->mbmi.mode == B_PRED && | 919 if (mi->mbmi.mode == B_PRED && |
920 ((ppflags->display_mb_modes_flag & B_PRED) || | 920 ((ppflags->display_mb_modes_flag & B_PRED) || |
921 ppflags->display_b_modes_flag)) { | 921 ppflags->display_b_modes_flag)) { |
922 int by, bx; | 922 int by, bx; |
923 unsigned char *yl, *ul, *vl; | 923 uint8_t *yl, *ul, *vl; |
924 union b_mode_info *bmi = mi->bmi; | 924 union b_mode_info *bmi = mi->bmi; |
925 | 925 |
926 yl = y_ptr + x; | 926 yl = y_ptr + x; |
927 ul = u_ptr + (x >> 1); | 927 ul = u_ptr + (x >> 1); |
928 vl = v_ptr + (x >> 1); | 928 vl = v_ptr + (x >> 1); |
929 | 929 |
930 for (by = 0; by < 16; by += 4) { | 930 for (by = 0; by < 16; by += 4) { |
931 for (bx = 0; bx < 16; bx += 4) { | 931 for (bx = 0; bx < 16; bx += 4) { |
932 if ((ppflags->display_b_modes_flag & (1 << mi->mbmi.mode)) | 932 if ((ppflags->display_b_modes_flag & (1 << mi->mbmi.mode)) |
933 || (ppflags->display_mb_modes_flag & B_PRED)) { | 933 || (ppflags->display_mb_modes_flag & B_PRED)) { |
(...skipping 30 matching lines...) Expand all Loading... |
964 } | 964 } |
965 } | 965 } |
966 | 966 |
967 /* Color in frame reference blocks */ | 967 /* Color in frame reference blocks */ |
968 if ((flags & VP9D_DEBUG_CLR_FRM_REF_BLKS) && | 968 if ((flags & VP9D_DEBUG_CLR_FRM_REF_BLKS) && |
969 ppflags->display_ref_frame_flag) { | 969 ppflags->display_ref_frame_flag) { |
970 int y, x; | 970 int y, x; |
971 YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer; | 971 YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer; |
972 int width = post->y_width; | 972 int width = post->y_width; |
973 int height = post->y_height; | 973 int height = post->y_height; |
974 unsigned char *y_ptr = oci->post_proc_buffer.y_buffer; | 974 uint8_t *y_ptr = oci->post_proc_buffer.y_buffer; |
975 unsigned char *u_ptr = oci->post_proc_buffer.u_buffer; | 975 uint8_t *u_ptr = oci->post_proc_buffer.u_buffer; |
976 unsigned char *v_ptr = oci->post_proc_buffer.v_buffer; | 976 uint8_t *v_ptr = oci->post_proc_buffer.v_buffer; |
977 int y_stride = oci->post_proc_buffer.y_stride; | 977 int y_stride = oci->post_proc_buffer.y_stride; |
978 MODE_INFO *mi = oci->mi; | 978 MODE_INFO *mi = oci->mi; |
979 | 979 |
980 for (y = 0; y < height; y += 16) { | 980 for (y = 0; y < height; y += 16) { |
981 for (x = 0; x < width; x += 16) { | 981 for (x = 0; x < width; x += 16) { |
982 int Y = 0, U = 0, V = 0; | 982 int Y = 0, U = 0, V = 0; |
983 | 983 |
984 if (ppflags->display_ref_frame_flag & (1 << mi->mbmi.ref_frame)) { | 984 if (ppflags->display_ref_frame_flag & (1 << mi->mbmi.ref_frame)) { |
985 Y = MV_REFERENCE_FRAME_colors[mi->mbmi.ref_frame][0]; | 985 Y = MV_REFERENCE_FRAME_colors[mi->mbmi.ref_frame][0]; |
986 U = MV_REFERENCE_FRAME_colors[mi->mbmi.ref_frame][1]; | 986 U = MV_REFERENCE_FRAME_colors[mi->mbmi.ref_frame][1]; |
(...skipping 16 matching lines...) Expand all Loading... |
1003 | 1003 |
1004 *dest = oci->post_proc_buffer; | 1004 *dest = oci->post_proc_buffer; |
1005 | 1005 |
1006 /* handle problem with extending borders */ | 1006 /* handle problem with extending borders */ |
1007 dest->y_width = oci->Width; | 1007 dest->y_width = oci->Width; |
1008 dest->y_height = oci->Height; | 1008 dest->y_height = oci->Height; |
1009 dest->uv_height = dest->y_height / 2; | 1009 dest->uv_height = dest->y_height / 2; |
1010 | 1010 |
1011 return 0; | 1011 return 0; |
1012 } | 1012 } |
OLD | NEW |