Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: source/libvpx/vp9/decoder/vp9_onyxd_if.c

Issue 111463005: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_detokenize.c ('k') | source/libvpx/vp9/decoder/vp9_onyxd_int.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <assert.h> 11 #include <assert.h>
12 #include <limits.h> 12 #include <limits.h>
13 #include <stdio.h> 13 #include <stdio.h>
14 14
15 #include "vp9/common/vp9_onyxc_int.h" 15 #include "vp9/common/vp9_onyxc_int.h"
16 #if CONFIG_VP9_POSTPROC 16 #if CONFIG_VP9_POSTPROC
17 #include "vp9/common/vp9_postproc.h" 17 #include "vp9/common/vp9_postproc.h"
18 #endif 18 #endif
19 #include "vp9/decoder/vp9_onyxd.h" 19 #include "vp9/decoder/vp9_onyxd.h"
20 #include "vp9/decoder/vp9_onyxd_int.h" 20 #include "vp9/decoder/vp9_onyxd_int.h"
21 #include "vpx_mem/vpx_mem.h" 21 #include "vpx_mem/vpx_mem.h"
22 #include "vp9/common/vp9_alloccommon.h" 22 #include "vp9/common/vp9_alloccommon.h"
23 #include "vp9/common/vp9_loopfilter.h" 23 #include "vp9/common/vp9_loopfilter.h"
24 #include "vp9/common/vp9_quant_common.h" 24 #include "vp9/common/vp9_quant_common.h"
25 #include "vpx_scale/vpx_scale.h" 25 #include "vpx_scale/vpx_scale.h"
26 #include "vp9/common/vp9_systemdependent.h" 26 #include "vp9/common/vp9_systemdependent.h"
27 #include "vpx_ports/vpx_timer.h" 27 #include "vpx_ports/vpx_timer.h"
28 #include "vp9/decoder/vp9_decodframe.h" 28 #include "vp9/decoder/vp9_decodeframe.h"
29 #include "vp9/decoder/vp9_detokenize.h" 29 #include "vp9/decoder/vp9_detokenize.h"
30 #include "./vpx_scale_rtcd.h" 30 #include "./vpx_scale_rtcd.h"
31 31
32 #define WRITE_RECON_BUFFER 0 32 #define WRITE_RECON_BUFFER 0
33 #if WRITE_RECON_BUFFER == 1 33 #if WRITE_RECON_BUFFER == 1
34 static void recon_write_yuv_frame(const char *name, 34 static void recon_write_yuv_frame(const char *name,
35 const YV12_BUFFER_CONFIG *s, 35 const YV12_BUFFER_CONFIG *s,
36 int w, int _h) { 36 int w, int _h) {
37 FILE *yuv_file = fopen(name, "ab"); 37 FILE *yuv_file = fopen(name, "ab");
38 const uint8_t *src = s->y_buffer; 38 const uint8_t *src = s->y_buffer;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void vp9_initialize_dec() { 100 void vp9_initialize_dec() {
101 static int init_done = 0; 101 static int init_done = 0;
102 102
103 if (!init_done) { 103 if (!init_done) {
104 vp9_initialize_common(); 104 vp9_initialize_common();
105 vp9_init_quant_tables(); 105 vp9_init_quant_tables();
106 init_done = 1; 106 init_done = 1;
107 } 107 }
108 } 108 }
109 109
110 static void init_macroblockd(VP9D_COMP *const pbi) {
111 MACROBLOCKD *xd = &pbi->mb;
112 struct macroblockd_plane *const pd = xd->plane;
113 int i;
114
115 for (i = 0; i < MAX_MB_PLANE; ++i)
116 pd[i].dqcoeff = pbi->dqcoeff[i];
117 }
118
110 VP9D_PTR vp9_create_decompressor(VP9D_CONFIG *oxcf) { 119 VP9D_PTR vp9_create_decompressor(VP9D_CONFIG *oxcf) {
111 VP9D_COMP *const pbi = vpx_memalign(32, sizeof(VP9D_COMP)); 120 VP9D_COMP *const pbi = vpx_memalign(32, sizeof(VP9D_COMP));
112 VP9_COMMON *const cm = pbi ? &pbi->common : NULL; 121 VP9_COMMON *const cm = pbi ? &pbi->common : NULL;
113 122
114 if (!cm) 123 if (!cm)
115 return NULL; 124 return NULL;
116 125
117 vp9_zero(*pbi); 126 vp9_zero(*pbi);
118 127
128 // Initialize the references to not point to any frame buffers.
129 memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map));
130
119 if (setjmp(cm->error.jmp)) { 131 if (setjmp(cm->error.jmp)) {
120 cm->error.setjmp = 0; 132 cm->error.setjmp = 0;
121 vp9_remove_decompressor(pbi); 133 vp9_remove_decompressor(pbi);
122 return NULL; 134 return NULL;
123 } 135 }
124 136
125 cm->error.setjmp = 1; 137 cm->error.setjmp = 1;
126 vp9_initialize_dec(); 138 vp9_initialize_dec();
127 139
128 vp9_create_common(cm); 140 vp9_create_common(cm);
129 141
130 pbi->oxcf = *oxcf; 142 pbi->oxcf = *oxcf;
131 pbi->ready_for_new_data = 1; 143 pbi->ready_for_new_data = 1;
132 cm->current_video_frame = 0; 144 cm->current_video_frame = 0;
133 145
134 // vp9_init_dequantizer() is first called here. Add check in 146 // vp9_init_dequantizer() is first called here. Add check in
135 // frame_init_dequantizer() to avoid unnecessary calling of 147 // frame_init_dequantizer() to avoid unnecessary calling of
136 // vp9_init_dequantizer() for every frame. 148 // vp9_init_dequantizer() for every frame.
137 vp9_init_dequantizer(cm); 149 vp9_init_dequantizer(cm);
138 150
139 vp9_loop_filter_init(cm); 151 vp9_loop_filter_init(cm);
140 152
141 cm->error.setjmp = 0; 153 cm->error.setjmp = 0;
142 pbi->decoded_key_frame = 0; 154 pbi->decoded_key_frame = 0;
143 155
156 init_macroblockd(pbi);
157
144 vp9_worker_init(&pbi->lf_worker); 158 vp9_worker_init(&pbi->lf_worker);
145 159
146 return pbi; 160 return pbi;
147 } 161 }
148 162
149 void vp9_remove_decompressor(VP9D_PTR ptr) { 163 void vp9_remove_decompressor(VP9D_PTR ptr) {
150 int i; 164 int i;
151 VP9D_COMP *const pbi = (VP9D_COMP *)ptr; 165 VP9D_COMP *const pbi = (VP9D_COMP *)ptr;
152 166
153 if (!pbi) 167 if (!pbi)
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 254 }
241 255
242 return pbi->common.error.error_code; 256 return pbi->common.error.error_code;
243 } 257 }
244 258
245 259
246 int vp9_get_reference_dec(VP9D_PTR ptr, int index, YV12_BUFFER_CONFIG **fb) { 260 int vp9_get_reference_dec(VP9D_PTR ptr, int index, YV12_BUFFER_CONFIG **fb) {
247 VP9D_COMP *pbi = (VP9D_COMP *) ptr; 261 VP9D_COMP *pbi = (VP9D_COMP *) ptr;
248 VP9_COMMON *cm = &pbi->common; 262 VP9_COMMON *cm = &pbi->common;
249 263
250 if (index < 0 || index >= NUM_REF_FRAMES) 264 if (index < 0 || index >= REF_FRAMES)
251 return -1; 265 return -1;
252 266
253 *fb = &cm->yv12_fb[cm->ref_frame_map[index]]; 267 *fb = &cm->yv12_fb[cm->ref_frame_map[index]];
254 return 0; 268 return 0;
255 } 269 }
256 270
257 /* If any buffer updating is signaled it should be done here. */ 271 /* If any buffer updating is signaled it should be done here. */
258 static void swap_frame_buffers(VP9D_COMP *pbi) { 272 static void swap_frame_buffers(VP9D_COMP *pbi) {
259 int ref_index = 0, mask; 273 int ref_index = 0, mask;
260 VP9_COMMON *const cm = &pbi->common; 274 VP9_COMMON *const cm = &pbi->common;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 372
359 #if WRITE_RECON_BUFFER == 2 373 #if WRITE_RECON_BUFFER == 2
360 if (cm->show_frame) 374 if (cm->show_frame)
361 write_dx_frame_to_file(cm->frame_to_show, 375 write_dx_frame_to_file(cm->frame_to_show,
362 cm->current_video_frame + 2000); 376 cm->current_video_frame + 2000);
363 else 377 else
364 write_dx_frame_to_file(cm->frame_to_show, 378 write_dx_frame_to_file(cm->frame_to_show,
365 cm->current_video_frame + 3000); 379 cm->current_video_frame + 3000);
366 #endif 380 #endif
367 381
368 vp9_extend_frame_inner_borders(cm->frame_to_show,
369 cm->subsampling_x,
370 cm->subsampling_y);
371
372 #if WRITE_RECON_BUFFER == 1 382 #if WRITE_RECON_BUFFER == 1
373 if (cm->show_frame) 383 if (cm->show_frame)
374 recon_write_yuv_frame("recon.yuv", cm->frame_to_show, 384 recon_write_yuv_frame("recon.yuv", cm->frame_to_show,
375 cm->width, cm->height); 385 cm->width, cm->height);
376 #endif 386 #endif
377 387
378 vp9_clear_system_state(); 388 vp9_clear_system_state();
379 389
380 cm->last_show_frame = cm->show_frame; 390 cm->last_show_frame = cm->show_frame;
381 if (cm->show_frame) { 391 if (cm->show_frame) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 447
438 ret = 0; 448 ret = 0;
439 } else { 449 } else {
440 ret = -1; 450 ret = -1;
441 } 451 }
442 452
443 #endif /*!CONFIG_POSTPROC*/ 453 #endif /*!CONFIG_POSTPROC*/
444 vp9_clear_system_state(); 454 vp9_clear_system_state();
445 return ret; 455 return ret;
446 } 456 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_detokenize.c ('k') | source/libvpx/vp9/decoder/vp9_onyxd_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698