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

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

Issue 958693004: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 10 months 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
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_decoder.h ('k') | source/libvpx/vp9/decoder/vp9_detokenize.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
(...skipping 10 matching lines...) Expand all
21 21
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_onyxc_int.h" 24 #include "vp9/common/vp9_onyxc_int.h"
25 #if CONFIG_VP9_POSTPROC 25 #if CONFIG_VP9_POSTPROC
26 #include "vp9/common/vp9_postproc.h" 26 #include "vp9/common/vp9_postproc.h"
27 #endif 27 #endif
28 #include "vp9/common/vp9_quant_common.h" 28 #include "vp9/common/vp9_quant_common.h"
29 #include "vp9/common/vp9_reconintra.h" 29 #include "vp9/common/vp9_reconintra.h"
30 #include "vp9/common/vp9_systemdependent.h" 30 #include "vp9/common/vp9_systemdependent.h"
31 #include "vp9/common/vp9_thread.h"
31 32
32 #include "vp9/decoder/vp9_decodeframe.h" 33 #include "vp9/decoder/vp9_decodeframe.h"
33 #include "vp9/decoder/vp9_decoder.h" 34 #include "vp9/decoder/vp9_decoder.h"
34 #include "vp9/decoder/vp9_detokenize.h" 35 #include "vp9/decoder/vp9_detokenize.h"
35 36
36 static void initialize_dec(void) { 37 static void initialize_dec(void) {
37 static volatile int init_done = 0; 38 static volatile int init_done = 0;
38 39
39 if (!init_done) { 40 if (!init_done) {
40 vp9_rtcd(); 41 vp9_rtcd();
(...skipping 13 matching lines...) Expand all
54 return 1; 55 return 1;
55 cm->mi_alloc_size = mi_size; 56 cm->mi_alloc_size = mi_size;
56 return 0; 57 return 0;
57 } 58 }
58 59
59 static void vp9_dec_free_mi(VP9_COMMON *cm) { 60 static void vp9_dec_free_mi(VP9_COMMON *cm) {
60 vpx_free(cm->mip); 61 vpx_free(cm->mip);
61 cm->mip = NULL; 62 cm->mip = NULL;
62 } 63 }
63 64
64 VP9Decoder *vp9_decoder_create() { 65 VP9Decoder *vp9_decoder_create(BufferPool *const pool) {
65 VP9Decoder *volatile const pbi = vpx_memalign(32, sizeof(*pbi)); 66 VP9Decoder *volatile const pbi = vpx_memalign(32, sizeof(*pbi));
66 VP9_COMMON *volatile const cm = pbi ? &pbi->common : NULL; 67 VP9_COMMON *volatile const cm = pbi ? &pbi->common : NULL;
67 68
68 if (!cm) 69 if (!cm)
69 return NULL; 70 return NULL;
70 71
71 vp9_zero(*pbi); 72 vp9_zero(*pbi);
72 73
73 if (setjmp(cm->error.jmp)) { 74 if (setjmp(cm->error.jmp)) {
74 cm->error.setjmp = 0; 75 cm->error.setjmp = 0;
75 vp9_decoder_remove(pbi); 76 vp9_decoder_remove(pbi);
76 return NULL; 77 return NULL;
77 } 78 }
78 79
79 cm->error.setjmp = 1; 80 cm->error.setjmp = 1;
80 81
81 CHECK_MEM_ERROR(cm, cm->fc, 82 CHECK_MEM_ERROR(cm, cm->fc,
82 (FRAME_CONTEXT *)vpx_calloc(1, sizeof(*cm->fc))); 83 (FRAME_CONTEXT *)vpx_calloc(1, sizeof(*cm->fc)));
83 CHECK_MEM_ERROR(cm, cm->frame_contexts, 84 CHECK_MEM_ERROR(cm, cm->frame_contexts,
84 (FRAME_CONTEXT *)vpx_calloc(FRAME_CONTEXTS, 85 (FRAME_CONTEXT *)vpx_calloc(FRAME_CONTEXTS,
85 sizeof(*cm->frame_contexts))); 86 sizeof(*cm->frame_contexts)));
86 87
87 pbi->need_resync = 1; 88 pbi->need_resync = 1;
88 once(initialize_dec); 89 once(initialize_dec);
89 90
90 // Initialize the references to not point to any frame buffers. 91 // Initialize the references to not point to any frame buffers.
91 vpx_memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map)); 92 vpx_memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map));
93 vpx_memset(&cm->next_ref_frame_map, -1, sizeof(cm->next_ref_frame_map));
92 94
93 cm->current_video_frame = 0; 95 cm->current_video_frame = 0;
94 pbi->ready_for_new_data = 1; 96 pbi->ready_for_new_data = 1;
97 pbi->common.buffer_pool = pool;
98
95 cm->bit_depth = VPX_BITS_8; 99 cm->bit_depth = VPX_BITS_8;
96 cm->dequant_bit_depth = VPX_BITS_8; 100 cm->dequant_bit_depth = VPX_BITS_8;
97 101
98 cm->alloc_mi = vp9_dec_alloc_mi; 102 cm->alloc_mi = vp9_dec_alloc_mi;
99 cm->free_mi = vp9_dec_free_mi; 103 cm->free_mi = vp9_dec_free_mi;
100 cm->setup_mi = vp9_dec_setup_mi; 104 cm->setup_mi = vp9_dec_setup_mi;
101 105
102 // vp9_init_dequantizer() is first called here. Add check in
103 // frame_init_dequantizer() to avoid unnecessary calling of
104 // vp9_init_dequantizer() for every frame.
105 vp9_init_dequantizer(cm);
106
107 vp9_loop_filter_init(cm); 106 vp9_loop_filter_init(cm);
108 107
109 cm->error.setjmp = 0; 108 cm->error.setjmp = 0;
110 109
111 vp9_get_worker_interface()->init(&pbi->lf_worker); 110 vp9_get_worker_interface()->init(&pbi->lf_worker);
112 111
113 return pbi; 112 return pbi;
114 } 113 }
115 114
116 void vp9_decoder_remove(VP9Decoder *pbi) { 115 void vp9_decoder_remove(VP9Decoder *pbi) {
117 VP9_COMMON *const cm = &pbi->common;
118 int i; 116 int i;
119 117
120 vp9_get_worker_interface()->end(&pbi->lf_worker); 118 vp9_get_worker_interface()->end(&pbi->lf_worker);
121 vpx_free(pbi->lf_worker.data1); 119 vpx_free(pbi->lf_worker.data1);
122 vpx_free(pbi->tile_data); 120 vpx_free(pbi->tile_data);
123 for (i = 0; i < pbi->num_tile_workers; ++i) { 121 for (i = 0; i < pbi->num_tile_workers; ++i) {
124 VP9Worker *const worker = &pbi->tile_workers[i]; 122 VP9Worker *const worker = &pbi->tile_workers[i];
125 vp9_get_worker_interface()->end(worker); 123 vp9_get_worker_interface()->end(worker);
126 } 124 }
127 vpx_free(pbi->tile_worker_data); 125 vpx_free(pbi->tile_worker_data);
128 vpx_free(pbi->tile_worker_info); 126 vpx_free(pbi->tile_worker_info);
129 vpx_free(pbi->tile_workers); 127 vpx_free(pbi->tile_workers);
130 128
131 if (pbi->num_tile_workers > 0) { 129 if (pbi->num_tile_workers > 0) {
132 vp9_loop_filter_dealloc(&pbi->lf_row_sync); 130 vp9_loop_filter_dealloc(&pbi->lf_row_sync);
133 } 131 }
134 132
135 vp9_remove_common(cm);
136 vpx_free(pbi); 133 vpx_free(pbi);
137 } 134 }
138 135
139 static int equal_dimensions(const YV12_BUFFER_CONFIG *a, 136 static int equal_dimensions(const YV12_BUFFER_CONFIG *a,
140 const YV12_BUFFER_CONFIG *b) { 137 const YV12_BUFFER_CONFIG *b) {
141 return a->y_height == b->y_height && a->y_width == b->y_width && 138 return a->y_height == b->y_height && a->y_width == b->y_width &&
142 a->uv_height == b->uv_height && a->uv_width == b->uv_width; 139 a->uv_height == b->uv_height && a->uv_width == b->uv_width;
143 } 140 }
144 141
145 vpx_codec_err_t vp9_copy_reference_dec(VP9Decoder *pbi, 142 vpx_codec_err_t vp9_copy_reference_dec(VP9Decoder *pbi,
(...skipping 24 matching lines...) Expand all
170 } 167 }
171 168
172 return cm->error.error_code; 169 return cm->error.error_code;
173 } 170 }
174 171
175 172
176 vpx_codec_err_t vp9_set_reference_dec(VP9_COMMON *cm, 173 vpx_codec_err_t vp9_set_reference_dec(VP9_COMMON *cm,
177 VP9_REFFRAME ref_frame_flag, 174 VP9_REFFRAME ref_frame_flag,
178 YV12_BUFFER_CONFIG *sd) { 175 YV12_BUFFER_CONFIG *sd) {
179 RefBuffer *ref_buf = NULL; 176 RefBuffer *ref_buf = NULL;
177 RefCntBuffer *const frame_bufs = cm->buffer_pool->frame_bufs;
180 178
181 // TODO(jkoleszar): The decoder doesn't have any real knowledge of what the 179 // TODO(jkoleszar): The decoder doesn't have any real knowledge of what the
182 // encoder is using the frame buffers for. This is just a stub to keep the 180 // encoder is using the frame buffers for. This is just a stub to keep the
183 // vpxenc --test-decode functionality working, and will be replaced in a 181 // vpxenc --test-decode functionality working, and will be replaced in a
184 // later commit that adds VP9-specific controls for this functionality. 182 // later commit that adds VP9-specific controls for this functionality.
185 if (ref_frame_flag == VP9_LAST_FLAG) { 183 if (ref_frame_flag == VP9_LAST_FLAG) {
186 ref_buf = &cm->frame_refs[0]; 184 ref_buf = &cm->frame_refs[0];
187 } else if (ref_frame_flag == VP9_GOLD_FLAG) { 185 } else if (ref_frame_flag == VP9_GOLD_FLAG) {
188 ref_buf = &cm->frame_refs[1]; 186 ref_buf = &cm->frame_refs[1];
189 } else if (ref_frame_flag == VP9_ALT_FLAG) { 187 } else if (ref_frame_flag == VP9_ALT_FLAG) {
190 ref_buf = &cm->frame_refs[2]; 188 ref_buf = &cm->frame_refs[2];
191 } else { 189 } else {
192 vpx_internal_error(&cm->error, VPX_CODEC_ERROR, 190 vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
193 "Invalid reference frame"); 191 "Invalid reference frame");
194 return cm->error.error_code; 192 return cm->error.error_code;
195 } 193 }
196 194
197 if (!equal_dimensions(ref_buf->buf, sd)) { 195 if (!equal_dimensions(ref_buf->buf, sd)) {
198 vpx_internal_error(&cm->error, VPX_CODEC_ERROR, 196 vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
199 "Incorrect buffer dimensions"); 197 "Incorrect buffer dimensions");
200 } else { 198 } else {
201 int *ref_fb_ptr = &ref_buf->idx; 199 int *ref_fb_ptr = &ref_buf->idx;
202 200
203 // Find an empty frame buffer. 201 // Find an empty frame buffer.
204 const int free_fb = get_free_fb(cm); 202 const int free_fb = get_free_fb(cm);
205 // Decrease ref_count since it will be increased again in 203 // Decrease ref_count since it will be increased again in
206 // ref_cnt_fb() below. 204 // ref_cnt_fb() below.
207 cm->frame_bufs[free_fb].ref_count--; 205 --frame_bufs[free_fb].ref_count;
208 206
209 // Manage the reference counters and copy image. 207 // Manage the reference counters and copy image.
210 ref_cnt_fb(cm->frame_bufs, ref_fb_ptr, free_fb); 208 ref_cnt_fb(frame_bufs, ref_fb_ptr, free_fb);
211 ref_buf->buf = &cm->frame_bufs[*ref_fb_ptr].buf; 209 ref_buf->buf = &frame_bufs[*ref_fb_ptr].buf;
212 vp8_yv12_copy_frame(sd, ref_buf->buf); 210 vp8_yv12_copy_frame(sd, ref_buf->buf);
213 } 211 }
214 212
215 return cm->error.error_code; 213 return cm->error.error_code;
216 } 214 }
217 215
218 /* If any buffer updating is signaled it should be done here. */ 216 /* If any buffer updating is signaled it should be done here. */
219 static void swap_frame_buffers(VP9Decoder *pbi) { 217 static void swap_frame_buffers(VP9Decoder *pbi) {
220 int ref_index = 0, mask; 218 int ref_index = 0, mask;
221 VP9_COMMON *const cm = &pbi->common; 219 VP9_COMMON *const cm = &pbi->common;
220 BufferPool *const pool = cm->buffer_pool;
221 RefCntBuffer *const frame_bufs = cm->buffer_pool->frame_bufs;
222 222
223 lock_buffer_pool(pool);
223 for (mask = pbi->refresh_frame_flags; mask; mask >>= 1) { 224 for (mask = pbi->refresh_frame_flags; mask; mask >>= 1) {
224 if (mask & 1) { 225 const int old_idx = cm->ref_frame_map[ref_index];
225 const int old_idx = cm->ref_frame_map[ref_index]; 226 // Current thread releases the holding of reference frame.
226 ref_cnt_fb(cm->frame_bufs, &cm->ref_frame_map[ref_index], 227 decrease_ref_count(old_idx, frame_bufs, pool);
227 cm->new_fb_idx); 228
228 if (old_idx >= 0 && cm->frame_bufs[old_idx].ref_count == 0) 229 // Release the reference frame in reference map.
229 cm->release_fb_cb(cm->cb_priv, 230 if ((mask & 1) && old_idx >= 0) {
230 &cm->frame_bufs[old_idx].raw_frame_buffer); 231 decrease_ref_count(old_idx, frame_bufs, pool);
231 } 232 }
233 cm->ref_frame_map[ref_index] = cm->next_ref_frame_map[ref_index];
232 ++ref_index; 234 ++ref_index;
233 } 235 }
234 236
237 // Current thread releases the holding of reference frame.
238 for (; ref_index < REF_FRAMES && !cm->show_existing_frame; ++ref_index) {
239 const int old_idx = cm->ref_frame_map[ref_index];
240 decrease_ref_count(old_idx, frame_bufs, pool);
241 cm->ref_frame_map[ref_index] = cm->next_ref_frame_map[ref_index];
242 }
243 unlock_buffer_pool(pool);
244 pbi->hold_ref_buf = 0;
235 cm->frame_to_show = get_frame_new_buffer(cm); 245 cm->frame_to_show = get_frame_new_buffer(cm);
236 cm->frame_bufs[cm->new_fb_idx].ref_count--; 246
247 if (!pbi->frame_parallel_decode || !cm->show_frame) {
248 lock_buffer_pool(pool);
249 --frame_bufs[cm->new_fb_idx].ref_count;
250 unlock_buffer_pool(pool);
251 }
237 252
238 // Invalidate these references until the next frame starts. 253 // Invalidate these references until the next frame starts.
239 for (ref_index = 0; ref_index < 3; ref_index++) 254 for (ref_index = 0; ref_index < 3; ref_index++)
240 cm->frame_refs[ref_index].idx = -1; 255 cm->frame_refs[ref_index].idx = -1;
241 } 256 }
242 257
243 int vp9_receive_compressed_data(VP9Decoder *pbi, 258 int vp9_receive_compressed_data(VP9Decoder *pbi,
244 size_t size, const uint8_t **psource) { 259 size_t size, const uint8_t **psource) {
245 VP9_COMMON *volatile const cm = &pbi->common; 260 VP9_COMMON *volatile const cm = &pbi->common;
261 BufferPool *volatile const pool = cm->buffer_pool;
262 RefCntBuffer *volatile const frame_bufs = cm->buffer_pool->frame_bufs;
246 const uint8_t *source = *psource; 263 const uint8_t *source = *psource;
247 int retcode = 0; 264 int retcode = 0;
248
249 cm->error.error_code = VPX_CODEC_OK; 265 cm->error.error_code = VPX_CODEC_OK;
250 266
251 if (size == 0) { 267 if (size == 0) {
252 // This is used to signal that we are missing frames. 268 // This is used to signal that we are missing frames.
253 // We do not know if the missing frame(s) was supposed to update 269 // We do not know if the missing frame(s) was supposed to update
254 // any of the reference buffers, but we act conservative and 270 // any of the reference buffers, but we act conservative and
255 // mark only the last buffer as corrupted. 271 // mark only the last buffer as corrupted.
256 // 272 //
257 // TODO(jkoleszar): Error concealment is undefined and non-normative 273 // TODO(jkoleszar): Error concealment is undefined and non-normative
258 // at this point, but if it becomes so, [0] may not always be the correct 274 // at this point, but if it becomes so, [0] may not always be the correct
259 // thing to do here. 275 // thing to do here.
260 if (cm->frame_refs[0].idx > 0) 276 if (cm->frame_refs[0].idx > 0) {
277 assert(cm->frame_refs[0].buf != NULL);
261 cm->frame_refs[0].buf->corrupted = 1; 278 cm->frame_refs[0].buf->corrupted = 1;
279 }
262 } 280 }
263 281
264 pbi->ready_for_new_data = 0; 282 pbi->ready_for_new_data = 0;
265 283
266 // Check if the previous frame was a frame without any references to it. 284 // Check if the previous frame was a frame without any references to it.
267 if (cm->new_fb_idx >= 0 && cm->frame_bufs[cm->new_fb_idx].ref_count == 0) 285 // Release frame buffer if not decoding in frame parallel mode.
268 cm->release_fb_cb(cm->cb_priv, 286 if (!pbi->frame_parallel_decode && cm->new_fb_idx >= 0
269 &cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer); 287 && frame_bufs[cm->new_fb_idx].ref_count == 0)
288 pool->release_fb_cb(pool->cb_priv,
289 &frame_bufs[cm->new_fb_idx].raw_frame_buffer);
270 cm->new_fb_idx = get_free_fb(cm); 290 cm->new_fb_idx = get_free_fb(cm);
271 291
272 // Assign a MV array to the frame buffer. 292 // Assign a MV array to the frame buffer.
273 cm->cur_frame = &cm->frame_bufs[cm->new_fb_idx]; 293 cm->cur_frame = &pool->frame_bufs[cm->new_fb_idx];
294
295 pbi->hold_ref_buf = 0;
296 if (pbi->frame_parallel_decode) {
297 VP9Worker *const worker = pbi->frame_worker_owner;
298 vp9_frameworker_lock_stats(worker);
299 frame_bufs[cm->new_fb_idx].frame_worker_owner = worker;
300 // Reset decoding progress.
301 pbi->cur_buf = &frame_bufs[cm->new_fb_idx];
302 pbi->cur_buf->row = -1;
303 pbi->cur_buf->col = -1;
304 vp9_frameworker_unlock_stats(worker);
305 } else {
306 pbi->cur_buf = &frame_bufs[cm->new_fb_idx];
307 }
308
274 309
275 if (setjmp(cm->error.jmp)) { 310 if (setjmp(cm->error.jmp)) {
276 const VP9WorkerInterface *const winterface = vp9_get_worker_interface(); 311 const VP9WorkerInterface *const winterface = vp9_get_worker_interface();
277 int i; 312 int i;
278 313
279 pbi->need_resync = 1;
280 cm->error.setjmp = 0; 314 cm->error.setjmp = 0;
315 pbi->ready_for_new_data = 1;
281 316
282 // Synchronize all threads immediately as a subsequent decode call may 317 // Synchronize all threads immediately as a subsequent decode call may
283 // cause a resize invalidating some allocations. 318 // cause a resize invalidating some allocations.
284 winterface->sync(&pbi->lf_worker); 319 winterface->sync(&pbi->lf_worker);
285 for (i = 0; i < pbi->num_tile_workers; ++i) { 320 for (i = 0; i < pbi->num_tile_workers; ++i) {
286 winterface->sync(&pbi->tile_workers[i]); 321 winterface->sync(&pbi->tile_workers[i]);
287 } 322 }
288 323
324 lock_buffer_pool(pool);
325 // Release all the reference buffers if worker thread is holding them.
326 if (pbi->hold_ref_buf == 1) {
327 int ref_index = 0, mask;
328 for (mask = pbi->refresh_frame_flags; mask; mask >>= 1) {
329 const int old_idx = cm->ref_frame_map[ref_index];
330 // Current thread releases the holding of reference frame.
331 decrease_ref_count(old_idx, frame_bufs, pool);
332
333 // Release the reference frame in reference map.
334 if ((mask & 1) && old_idx >= 0) {
335 decrease_ref_count(old_idx, frame_bufs, pool);
336 }
337 ++ref_index;
338 }
339
340 // Current thread releases the holding of reference frame.
341 for (; ref_index < REF_FRAMES && !cm->show_existing_frame; ++ref_index) {
342 const int old_idx = cm->ref_frame_map[ref_index];
343 decrease_ref_count(old_idx, frame_bufs, pool);
344 }
345 pbi->hold_ref_buf = 0;
346 }
347 // Release current frame.
348 decrease_ref_count(cm->new_fb_idx, frame_bufs, pool);
349 unlock_buffer_pool(pool);
350
289 vp9_clear_system_state(); 351 vp9_clear_system_state();
290
291 if (cm->new_fb_idx > 0 && cm->frame_bufs[cm->new_fb_idx].ref_count > 0)
292 cm->frame_bufs[cm->new_fb_idx].ref_count--;
293
294 return -1; 352 return -1;
295 } 353 }
296 354
297 cm->error.setjmp = 1; 355 cm->error.setjmp = 1;
298
299 vp9_decode_frame(pbi, source, source + size, psource); 356 vp9_decode_frame(pbi, source, source + size, psource);
300 357
301 swap_frame_buffers(pbi); 358 swap_frame_buffers(pbi);
302 359
303 vp9_clear_system_state(); 360 vp9_clear_system_state();
304 361
305 cm->last_width = cm->width;
306 cm->last_height = cm->height;
307
308 if (!cm->show_existing_frame) { 362 if (!cm->show_existing_frame) {
309 cm->last_show_frame = cm->show_frame; 363 cm->last_show_frame = cm->show_frame;
310 cm->prev_frame = cm->cur_frame; 364 cm->prev_frame = cm->cur_frame;
365 if (cm->seg.enabled && !pbi->frame_parallel_decode)
366 vp9_swap_current_and_last_seg_map(cm);
311 } 367 }
312 368
313 if (cm->show_frame) 369 // Update progress in frame parallel decode.
314 cm->current_video_frame++; 370 if (pbi->frame_parallel_decode) {
371 // Need to lock the mutex here as another thread may
372 // be accessing this buffer.
373 VP9Worker *const worker = pbi->frame_worker_owner;
374 FrameWorkerData *const frame_worker_data = worker->data1;
375 vp9_frameworker_lock_stats(worker);
376
377 if (cm->show_frame) {
378 cm->current_video_frame++;
379 }
380 frame_worker_data->frame_decoded = 1;
381 frame_worker_data->frame_context_ready = 1;
382 vp9_frameworker_signal_stats(worker);
383 vp9_frameworker_unlock_stats(worker);
384 } else {
385 cm->last_width = cm->width;
386 cm->last_height = cm->height;
387 if (cm->show_frame) {
388 cm->current_video_frame++;
389 }
390 }
315 391
316 cm->error.setjmp = 0; 392 cm->error.setjmp = 0;
317 return retcode; 393 return retcode;
318 } 394 }
319 395
320 int vp9_get_raw_frame(VP9Decoder *pbi, YV12_BUFFER_CONFIG *sd, 396 int vp9_get_raw_frame(VP9Decoder *pbi, YV12_BUFFER_CONFIG *sd,
321 vp9_ppflags_t *flags) { 397 vp9_ppflags_t *flags) {
322 VP9_COMMON *const cm = &pbi->common; 398 VP9_COMMON *const cm = &pbi->common;
323 int ret = -1; 399 int ret = -1;
324 #if !CONFIG_VP9_POSTPROC 400 #if !CONFIG_VP9_POSTPROC
325 (void)*flags; 401 (void)*flags;
326 #endif 402 #endif
327 403
328 if (pbi->ready_for_new_data == 1) 404 if (pbi->ready_for_new_data == 1)
329 return ret; 405 return ret;
330 406
331 pbi->ready_for_new_data = 1; 407 pbi->ready_for_new_data = 1;
332 408
333 /* no raw frame to show!!! */ 409 /* no raw frame to show!!! */
334 if (!cm->show_frame) 410 if (!cm->show_frame)
335 return ret; 411 return ret;
336 412
413 pbi->ready_for_new_data = 1;
414
337 #if CONFIG_VP9_POSTPROC 415 #if CONFIG_VP9_POSTPROC
338 if (!cm->show_existing_frame) { 416 if (!cm->show_existing_frame) {
339 ret = vp9_post_proc_frame(cm, sd, flags); 417 ret = vp9_post_proc_frame(cm, sd, flags);
340 } else { 418 } else {
341 *sd = *cm->frame_to_show; 419 *sd = *cm->frame_to_show;
342 ret = 0; 420 ret = 0;
343 } 421 }
344 #else 422 #else
345 *sd = *cm->frame_to_show; 423 *sd = *cm->frame_to_show;
346 ret = 0; 424 ret = 0;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 483
406 for (j = 0; j < mag; ++j) 484 for (j = 0; j < mag; ++j)
407 this_sz |= (*x++) << (j * 8); 485 this_sz |= (*x++) << (j * 8);
408 sizes[i] = this_sz; 486 sizes[i] = this_sz;
409 } 487 }
410 *count = frames; 488 *count = frames;
411 } 489 }
412 } 490 }
413 return VPX_CODEC_OK; 491 return VPX_CODEC_OK;
414 } 492 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_decoder.h ('k') | source/libvpx/vp9/decoder/vp9_detokenize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698