| 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 "vp8/common/onyxc_int.h" | 12 #include "vp8/common/onyxc_int.h" |
| 13 #if CONFIG_POSTPROC | 13 #if CONFIG_POSTPROC |
| 14 #include "vp8/common/postproc.h" | 14 #include "vp8/common/postproc.h" |
| 15 #endif | 15 #endif |
| 16 #include "vp8/common/onyxd.h" | 16 #include "vp8/common/onyxd.h" |
| 17 #include "onyxd_int.h" | 17 #include "onyxd_int.h" |
| 18 #include "vpx_mem/vpx_mem.h" | 18 #include "vpx_mem/vpx_mem.h" |
| 19 #include "vp8/common/alloccommon.h" | 19 #include "vp8/common/alloccommon.h" |
| 20 #include "vpx_scale/yv12extend.h" | 20 #include "vpx_scale/yv12extend.h" |
| 21 #include "vp8/common/loopfilter.h" | 21 #include "vp8/common/loopfilter.h" |
| 22 #include "vp8/common/swapyv12buffer.h" | 22 #include "vp8/common/swapyv12buffer.h" |
| 23 #include "vp8/common/g_common.h" | 23 #include "vp8/common/g_common.h" |
| 24 #include "vp8/common/threading.h" | 24 #include "vp8/common/threading.h" |
| 25 #include "decoderthreading.h" | 25 #include "decoderthreading.h" |
| 26 #include <stdio.h> | 26 #include <stdio.h> |
| 27 #include <assert.h> |
| 27 | 28 |
| 28 #include "vp8/common/quant_common.h" | 29 #include "vp8/common/quant_common.h" |
| 29 #include "vpx_scale/vpxscale.h" | 30 #include "vpx_scale/vpxscale.h" |
| 30 #include "vp8/common/systemdependent.h" | 31 #include "vp8/common/systemdependent.h" |
| 31 #include "vpx_ports/vpx_timer.h" | 32 #include "vpx_ports/vpx_timer.h" |
| 32 #include "detokenize.h" | 33 #include "detokenize.h" |
| 34 #if CONFIG_ERROR_CONCEALMENT |
| 35 #include "error_concealment.h" |
| 36 #endif |
| 33 #if ARCH_ARM | 37 #if ARCH_ARM |
| 34 #include "vpx_ports/arm.h" | 38 #include "vpx_ports/arm.h" |
| 35 #endif | 39 #endif |
| 36 | 40 |
| 37 extern void vp8_init_loop_filter(VP8_COMMON *cm); | 41 extern void vp8_init_loop_filter(VP8_COMMON *cm); |
| 38 extern void vp8cx_init_de_quantizer(VP8D_COMP *pbi); | 42 extern void vp8cx_init_de_quantizer(VP8D_COMP *pbi); |
| 43 static int get_free_fb (VP8_COMMON *cm); |
| 44 static void ref_cnt_fb (int *buf, int *idx, int new_idx); |
| 39 | 45 |
| 40 | 46 |
| 41 void vp8dx_initialize() | 47 void vp8dx_initialize() |
| 42 { | 48 { |
| 43 static int init_done = 0; | 49 static int init_done = 0; |
| 44 | 50 |
| 45 if (!init_done) | 51 if (!init_done) |
| 46 { | 52 { |
| 47 vp8_initialize_common(); | 53 vp8_initialize_common(); |
| 48 vp8_scale_machine_specific_config(); | 54 vp8_scale_machine_specific_config(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 69 | 75 |
| 70 pbi->common.error.setjmp = 1; | 76 pbi->common.error.setjmp = 1; |
| 71 vp8dx_initialize(); | 77 vp8dx_initialize(); |
| 72 | 78 |
| 73 vp8_create_common(&pbi->common); | 79 vp8_create_common(&pbi->common); |
| 74 vp8_dmachine_specific_config(pbi); | 80 vp8_dmachine_specific_config(pbi); |
| 75 | 81 |
| 76 pbi->common.current_video_frame = 0; | 82 pbi->common.current_video_frame = 0; |
| 77 pbi->ready_for_new_data = 1; | 83 pbi->ready_for_new_data = 1; |
| 78 | 84 |
| 79 pbi->CPUFreq = 0; /*vp8_get_processor_freq();*/ | |
| 80 #if CONFIG_MULTITHREAD | 85 #if CONFIG_MULTITHREAD |
| 81 pbi->max_threads = oxcf->max_threads; | 86 pbi->max_threads = oxcf->max_threads; |
| 82 vp8_decoder_create_threads(pbi); | 87 vp8_decoder_create_threads(pbi); |
| 83 #endif | 88 #endif |
| 84 | 89 |
| 85 /* vp8cx_init_de_quantizer() is first called here. Add check in frame_init_d
equantizer() to avoid | 90 /* vp8cx_init_de_quantizer() is first called here. Add check in frame_init_d
equantizer() to avoid |
| 86 * unnecessary calling of vp8cx_init_de_quantizer() for every frame. | 91 * unnecessary calling of vp8cx_init_de_quantizer() for every frame. |
| 87 */ | 92 */ |
| 88 vp8cx_init_de_quantizer(pbi); | 93 vp8cx_init_de_quantizer(pbi); |
| 89 | 94 |
| 90 { | 95 vp8_loop_filter_init(&pbi->common); |
| 91 VP8_COMMON *cm = &pbi->common; | |
| 92 | |
| 93 vp8_init_loop_filter(cm); | |
| 94 cm->last_frame_type = KEY_FRAME; | |
| 95 cm->last_filter_type = cm->filter_type; | |
| 96 cm->last_sharpness_level = cm->sharpness_level; | |
| 97 } | |
| 98 | 96 |
| 99 pbi->common.error.setjmp = 0; | 97 pbi->common.error.setjmp = 0; |
| 98 |
| 99 #if CONFIG_ERROR_CONCEALMENT |
| 100 pbi->ec_enabled = oxcf->error_concealment; |
| 101 #else |
| 102 pbi->ec_enabled = 0; |
| 103 #endif |
| 104 /* Error concealment is activated after a key frame has been |
| 105 * decoded without errors when error concealment is enabled. |
| 106 */ |
| 107 pbi->ec_active = 0; |
| 108 |
| 109 pbi->decoded_key_frame = 0; |
| 110 |
| 111 pbi->input_partition = oxcf->input_partition; |
| 112 |
| 113 /* Independent partitions is activated when a frame updates the |
| 114 * token probability table to have equal probabilities over the |
| 115 * PREV_COEF context. |
| 116 */ |
| 117 pbi->independent_partitions = 0; |
| 118 |
| 100 return (VP8D_PTR) pbi; | 119 return (VP8D_PTR) pbi; |
| 101 } | 120 } |
| 102 | 121 |
| 103 | 122 |
| 104 void vp8dx_remove_decompressor(VP8D_PTR ptr) | 123 void vp8dx_remove_decompressor(VP8D_PTR ptr) |
| 105 { | 124 { |
| 106 VP8D_COMP *pbi = (VP8D_COMP *) ptr; | 125 VP8D_COMP *pbi = (VP8D_COMP *) ptr; |
| 107 | 126 |
| 108 if (!pbi) | 127 if (!pbi) |
| 109 return; | 128 return; |
| 110 | 129 |
| 111 #if CONFIG_MULTITHREAD | 130 #if CONFIG_MULTITHREAD |
| 112 if (pbi->b_multithreaded_rd) | 131 if (pbi->b_multithreaded_rd) |
| 113 vp8mt_de_alloc_temp_buffers(pbi, pbi->common.mb_rows); | 132 vp8mt_de_alloc_temp_buffers(pbi, pbi->common.mb_rows); |
| 114 vp8_decoder_remove_threads(pbi); | 133 vp8_decoder_remove_threads(pbi); |
| 115 #endif | 134 #endif |
| 135 #if CONFIG_ERROR_CONCEALMENT |
| 136 vp8_de_alloc_overlap_lists(pbi); |
| 137 #endif |
| 116 vp8_remove_common(&pbi->common); | 138 vp8_remove_common(&pbi->common); |
| 139 vpx_free(pbi->mbc); |
| 117 vpx_free(pbi); | 140 vpx_free(pbi); |
| 118 } | 141 } |
| 119 | 142 |
| 120 | 143 |
| 121 int vp8dx_get_reference(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_C
ONFIG *sd) | 144 vpx_codec_err_t vp8dx_get_reference(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag, Y
V12_BUFFER_CONFIG *sd) |
| 122 { | 145 { |
| 123 VP8D_COMP *pbi = (VP8D_COMP *) ptr; | 146 VP8D_COMP *pbi = (VP8D_COMP *) ptr; |
| 124 VP8_COMMON *cm = &pbi->common; | 147 VP8_COMMON *cm = &pbi->common; |
| 125 int ref_fb_idx; | 148 int ref_fb_idx; |
| 126 | 149 |
| 127 if (ref_frame_flag == VP8_LAST_FLAG) | 150 if (ref_frame_flag == VP8_LAST_FLAG) |
| 128 ref_fb_idx = cm->lst_fb_idx; | 151 ref_fb_idx = cm->lst_fb_idx; |
| 129 else if (ref_frame_flag == VP8_GOLD_FLAG) | 152 else if (ref_frame_flag == VP8_GOLD_FLAG) |
| 130 ref_fb_idx = cm->gld_fb_idx; | 153 ref_fb_idx = cm->gld_fb_idx; |
| 131 else if (ref_frame_flag == VP8_ALT_FLAG) | 154 else if (ref_frame_flag == VP8_ALT_FLAG) |
| 132 ref_fb_idx = cm->alt_fb_idx; | 155 ref_fb_idx = cm->alt_fb_idx; |
| 156 else{ |
| 157 vpx_internal_error(&pbi->common.error, VPX_CODEC_ERROR, |
| 158 "Invalid reference frame"); |
| 159 return pbi->common.error.error_code; |
| 160 } |
| 161 |
| 162 if(cm->yv12_fb[ref_fb_idx].y_height != sd->y_height || |
| 163 cm->yv12_fb[ref_fb_idx].y_width != sd->y_width || |
| 164 cm->yv12_fb[ref_fb_idx].uv_height != sd->uv_height || |
| 165 cm->yv12_fb[ref_fb_idx].uv_width != sd->uv_width){ |
| 166 vpx_internal_error(&pbi->common.error, VPX_CODEC_ERROR, |
| 167 "Incorrect buffer dimensions"); |
| 168 } |
| 133 else | 169 else |
| 134 return -1; | 170 vp8_yv12_copy_frame_ptr(&cm->yv12_fb[ref_fb_idx], sd); |
| 135 | 171 |
| 136 vp8_yv12_copy_frame_ptr(&cm->yv12_fb[ref_fb_idx], sd); | 172 return pbi->common.error.error_code; |
| 137 | |
| 138 return 0; | |
| 139 } | 173 } |
| 140 | 174 |
| 141 | 175 |
| 142 int vp8dx_set_reference(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_C
ONFIG *sd) | 176 vpx_codec_err_t vp8dx_set_reference(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag, Y
V12_BUFFER_CONFIG *sd) |
| 143 { | 177 { |
| 144 VP8D_COMP *pbi = (VP8D_COMP *) ptr; | 178 VP8D_COMP *pbi = (VP8D_COMP *) ptr; |
| 145 VP8_COMMON *cm = &pbi->common; | 179 VP8_COMMON *cm = &pbi->common; |
| 146 int ref_fb_idx; | 180 int *ref_fb_ptr = NULL; |
| 181 int free_fb; |
| 147 | 182 |
| 148 if (ref_frame_flag == VP8_LAST_FLAG) | 183 if (ref_frame_flag == VP8_LAST_FLAG) |
| 149 ref_fb_idx = cm->lst_fb_idx; | 184 ref_fb_ptr = &cm->lst_fb_idx; |
| 150 else if (ref_frame_flag == VP8_GOLD_FLAG) | 185 else if (ref_frame_flag == VP8_GOLD_FLAG) |
| 151 ref_fb_idx = cm->gld_fb_idx; | 186 ref_fb_ptr = &cm->gld_fb_idx; |
| 152 else if (ref_frame_flag == VP8_ALT_FLAG) | 187 else if (ref_frame_flag == VP8_ALT_FLAG) |
| 153 ref_fb_idx = cm->alt_fb_idx; | 188 ref_fb_ptr = &cm->alt_fb_idx; |
| 154 else | 189 else{ |
| 155 return -1; | 190 vpx_internal_error(&pbi->common.error, VPX_CODEC_ERROR, |
| 191 "Invalid reference frame"); |
| 192 return pbi->common.error.error_code; |
| 193 } |
| 156 | 194 |
| 157 vp8_yv12_copy_frame_ptr(sd, &cm->yv12_fb[ref_fb_idx]); | 195 if(cm->yv12_fb[*ref_fb_ptr].y_height != sd->y_height || |
| 196 cm->yv12_fb[*ref_fb_ptr].y_width != sd->y_width || |
| 197 cm->yv12_fb[*ref_fb_ptr].uv_height != sd->uv_height || |
| 198 cm->yv12_fb[*ref_fb_ptr].uv_width != sd->uv_width){ |
| 199 vpx_internal_error(&pbi->common.error, VPX_CODEC_ERROR, |
| 200 "Incorrect buffer dimensions"); |
| 201 } |
| 202 else{ |
| 203 /* Find an empty frame buffer. */ |
| 204 free_fb = get_free_fb(cm); |
| 205 /* Decrease fb_idx_ref_cnt since it will be increased again in |
| 206 * ref_cnt_fb() below. */ |
| 207 cm->fb_idx_ref_cnt[free_fb]--; |
| 158 | 208 |
| 159 return 0; | 209 /* Manage the reference counters and copy image. */ |
| 210 ref_cnt_fb (cm->fb_idx_ref_cnt, ref_fb_ptr, free_fb); |
| 211 vp8_yv12_copy_frame_ptr(sd, &cm->yv12_fb[*ref_fb_ptr]); |
| 212 } |
| 213 |
| 214 return pbi->common.error.error_code; |
| 160 } | 215 } |
| 161 | 216 |
| 162 /*For ARM NEON, d8-d15 are callee-saved registers, and need to be saved by us.*/ | 217 /*For ARM NEON, d8-d15 are callee-saved registers, and need to be saved by us.*/ |
| 163 #if HAVE_ARMV7 | 218 #if HAVE_ARMV7 |
| 164 extern void vp8_push_neon(INT64 *store); | 219 extern void vp8_push_neon(int64_t *store); |
| 165 extern void vp8_pop_neon(INT64 *store); | 220 extern void vp8_pop_neon(int64_t *store); |
| 166 #endif | 221 #endif |
| 167 | 222 |
| 168 static int get_free_fb (VP8_COMMON *cm) | 223 static int get_free_fb (VP8_COMMON *cm) |
| 169 { | 224 { |
| 170 int i; | 225 int i; |
| 171 for (i = 0; i < NUM_YV12_BUFFERS; i++) | 226 for (i = 0; i < NUM_YV12_BUFFERS; i++) |
| 172 if (cm->fb_idx_ref_cnt[i] == 0) | 227 if (cm->fb_idx_ref_cnt[i] == 0) |
| 173 break; | 228 break; |
| 174 | 229 |
| 230 assert(i < NUM_YV12_BUFFERS); |
| 175 cm->fb_idx_ref_cnt[i] = 1; | 231 cm->fb_idx_ref_cnt[i] = 1; |
| 176 return i; | 232 return i; |
| 177 } | 233 } |
| 178 | 234 |
| 179 static void ref_cnt_fb (int *buf, int *idx, int new_idx) | 235 static void ref_cnt_fb (int *buf, int *idx, int new_idx) |
| 180 { | 236 { |
| 181 if (buf[*idx] > 0) | 237 if (buf[*idx] > 0) |
| 182 buf[*idx]--; | 238 buf[*idx]--; |
| 183 | 239 |
| 184 *idx = new_idx; | 240 *idx = new_idx; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 cm->frame_to_show = &cm->yv12_fb[cm->lst_fb_idx]; | 293 cm->frame_to_show = &cm->yv12_fb[cm->lst_fb_idx]; |
| 238 } | 294 } |
| 239 else | 295 else |
| 240 cm->frame_to_show = &cm->yv12_fb[cm->new_fb_idx]; | 296 cm->frame_to_show = &cm->yv12_fb[cm->new_fb_idx]; |
| 241 | 297 |
| 242 cm->fb_idx_ref_cnt[cm->new_fb_idx]--; | 298 cm->fb_idx_ref_cnt[cm->new_fb_idx]--; |
| 243 | 299 |
| 244 return err; | 300 return err; |
| 245 } | 301 } |
| 246 | 302 |
| 247 int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsign
ed char *source, INT64 time_stamp) | 303 int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsign
ed char *source, int64_t time_stamp) |
| 248 { | 304 { |
| 249 #if HAVE_ARMV7 | 305 #if HAVE_ARMV7 |
| 250 INT64 dx_store_reg[8]; | 306 int64_t dx_store_reg[8]; |
| 251 #endif | 307 #endif |
| 252 VP8D_COMP *pbi = (VP8D_COMP *) ptr; | 308 VP8D_COMP *pbi = (VP8D_COMP *) ptr; |
| 253 VP8_COMMON *cm = &pbi->common; | 309 VP8_COMMON *cm = &pbi->common; |
| 254 int retcode = 0; | 310 int retcode = 0; |
| 255 struct vpx_usec_timer timer; | |
| 256 | 311 |
| 257 /*if(pbi->ready_for_new_data == 0) | 312 /*if(pbi->ready_for_new_data == 0) |
| 258 return -1;*/ | 313 return -1;*/ |
| 259 | 314 |
| 260 if (ptr == 0) | 315 if (ptr == 0) |
| 261 { | 316 { |
| 262 return -1; | 317 return -1; |
| 263 } | 318 } |
| 264 | 319 |
| 265 pbi->common.error.error_code = VPX_CODEC_OK; | 320 pbi->common.error.error_code = VPX_CODEC_OK; |
| 266 | 321 |
| 267 if (size == 0) | 322 if (pbi->input_partition && !(source == NULL && size == 0)) |
| 268 { | 323 { |
| 269 /* This is used to signal that we are missing frames. | 324 /* Store a pointer to this partition and return. We haven't |
| 270 * We do not know if the missing frame(s) was supposed to update | 325 * received the complete frame yet, so we will wait with decoding. |
| 271 * any of the reference buffers, but we act conservative and | 326 */ |
| 272 * mark only the last buffer as corrupted. | 327 pbi->partitions[pbi->num_partitions] = source; |
| 273 */ | 328 pbi->partition_sizes[pbi->num_partitions] = size; |
| 274 cm->yv12_fb[cm->lst_fb_idx].corrupted = 1; | 329 pbi->source_sz += size; |
| 275 | 330 pbi->num_partitions++; |
| 276 /* Signal that we have no frame to show. */ | 331 if (pbi->num_partitions > (1<<pbi->common.multi_token_partition) + 1) |
| 277 cm->show_frame = 0; | 332 pbi->common.multi_token_partition++; |
| 278 | 333 if (pbi->common.multi_token_partition > EIGHT_PARTITION) |
| 279 /* Nothing more to do. */ | 334 { |
| 335 pbi->common.error.error_code = VPX_CODEC_UNSUP_BITSTREAM; |
| 336 pbi->common.error.setjmp = 0; |
| 337 return -1; |
| 338 } |
| 280 return 0; | 339 return 0; |
| 281 } | 340 } |
| 341 else |
| 342 { |
| 343 if (!pbi->input_partition) |
| 344 { |
| 345 pbi->Source = source; |
| 346 pbi->source_sz = size; |
| 347 } |
| 282 | 348 |
| 349 if (pbi->source_sz == 0) |
| 350 { |
| 351 /* This is used to signal that we are missing frames. |
| 352 * We do not know if the missing frame(s) was supposed to update |
| 353 * any of the reference buffers, but we act conservative and |
| 354 * mark only the last buffer as corrupted. |
| 355 */ |
| 356 cm->yv12_fb[cm->lst_fb_idx].corrupted = 1; |
| 283 | 357 |
| 284 #if HAVE_ARMV7 | 358 /* If error concealment is disabled we won't signal missing frames t
o |
| 285 #if CONFIG_RUNTIME_CPU_DETECT | 359 * the decoder. |
| 286 if (cm->rtcd.flags & HAS_NEON) | 360 */ |
| 287 #endif | 361 if (!pbi->ec_active) |
| 288 { | 362 { |
| 289 vp8_push_neon(dx_store_reg); | 363 /* Signal that we have no frame to show. */ |
| 290 } | 364 cm->show_frame = 0; |
| 291 #endif | |
| 292 | 365 |
| 293 cm->new_fb_idx = get_free_fb (cm); | 366 pbi->num_partitions = 0; |
| 367 if (pbi->input_partition) |
| 368 pbi->common.multi_token_partition = 0; |
| 294 | 369 |
| 295 if (setjmp(pbi->common.error.jmp)) | 370 /* Nothing more to do. */ |
| 296 { | 371 return 0; |
| 372 } |
| 373 } |
| 374 |
| 297 #if HAVE_ARMV7 | 375 #if HAVE_ARMV7 |
| 298 #if CONFIG_RUNTIME_CPU_DETECT | 376 #if CONFIG_RUNTIME_CPU_DETECT |
| 299 if (cm->rtcd.flags & HAS_NEON) | 377 if (cm->rtcd.flags & HAS_NEON) |
| 300 #endif | 378 #endif |
| 301 { | 379 { |
| 302 vp8_pop_neon(dx_store_reg); | 380 vp8_push_neon(dx_store_reg); |
| 303 } | 381 } |
| 304 #endif | 382 #endif |
| 305 pbi->common.error.setjmp = 0; | |
| 306 | 383 |
| 307 /* We do not know if the missing frame(s) was supposed to update | 384 cm->new_fb_idx = get_free_fb (cm); |
| 308 * any of the reference buffers, but we act conservative and | |
| 309 * mark only the last buffer as corrupted. | |
| 310 */ | |
| 311 cm->yv12_fb[cm->lst_fb_idx].corrupted = 1; | |
| 312 | 385 |
| 313 if (cm->fb_idx_ref_cnt[cm->new_fb_idx] > 0) | 386 if (setjmp(pbi->common.error.jmp)) |
| 314 cm->fb_idx_ref_cnt[cm->new_fb_idx]--; | 387 { |
| 315 return -1; | 388 #if HAVE_ARMV7 |
| 389 #if CONFIG_RUNTIME_CPU_DETECT |
| 390 if (cm->rtcd.flags & HAS_NEON) |
| 391 #endif |
| 392 { |
| 393 vp8_pop_neon(dx_store_reg); |
| 394 } |
| 395 #endif |
| 396 pbi->common.error.setjmp = 0; |
| 397 |
| 398 pbi->num_partitions = 0; |
| 399 if (pbi->input_partition) |
| 400 pbi->common.multi_token_partition = 0; |
| 401 |
| 402 /* We do not know if the missing frame(s) was supposed to update |
| 403 * any of the reference buffers, but we act conservative and |
| 404 * mark only the last buffer as corrupted. |
| 405 */ |
| 406 cm->yv12_fb[cm->lst_fb_idx].corrupted = 1; |
| 407 |
| 408 if (cm->fb_idx_ref_cnt[cm->new_fb_idx] > 0) |
| 409 cm->fb_idx_ref_cnt[cm->new_fb_idx]--; |
| 410 return -1; |
| 411 } |
| 412 |
| 413 pbi->common.error.setjmp = 1; |
| 316 } | 414 } |
| 317 | 415 |
| 318 pbi->common.error.setjmp = 1; | |
| 319 | |
| 320 vpx_usec_timer_start(&timer); | |
| 321 | |
| 322 /*cm->current_video_frame++;*/ | |
| 323 pbi->Source = source; | |
| 324 pbi->source_sz = size; | |
| 325 | |
| 326 retcode = vp8_decode_frame(pbi); | 416 retcode = vp8_decode_frame(pbi); |
| 327 | 417 |
| 328 if (retcode < 0) | 418 if (retcode < 0) |
| 329 { | 419 { |
| 330 #if HAVE_ARMV7 | 420 #if HAVE_ARMV7 |
| 331 #if CONFIG_RUNTIME_CPU_DETECT | 421 #if CONFIG_RUNTIME_CPU_DETECT |
| 332 if (cm->rtcd.flags & HAS_NEON) | 422 if (cm->rtcd.flags & HAS_NEON) |
| 333 #endif | 423 #endif |
| 334 { | 424 { |
| 335 vp8_pop_neon(dx_store_reg); | 425 vp8_pop_neon(dx_store_reg); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 #endif | 460 #endif |
| 371 { | 461 { |
| 372 vp8_pop_neon(dx_store_reg); | 462 vp8_pop_neon(dx_store_reg); |
| 373 } | 463 } |
| 374 #endif | 464 #endif |
| 375 pbi->common.error.error_code = VPX_CODEC_ERROR; | 465 pbi->common.error.error_code = VPX_CODEC_ERROR; |
| 376 pbi->common.error.setjmp = 0; | 466 pbi->common.error.setjmp = 0; |
| 377 return -1; | 467 return -1; |
| 378 } | 468 } |
| 379 | 469 |
| 380 if(pbi->common.filter_level) | 470 if(cm->filter_level) |
| 381 { | 471 { |
| 382 struct vpx_usec_timer lpftimer; | |
| 383 vpx_usec_timer_start(&lpftimer); | |
| 384 /* Apply the loop filter if appropriate. */ | 472 /* Apply the loop filter if appropriate. */ |
| 385 | 473 vp8_loop_filter_frame(cm, &pbi->mb); |
| 386 vp8_loop_filter_frame(cm, &pbi->mb, cm->filter_level); | |
| 387 | |
| 388 vpx_usec_timer_mark(&lpftimer); | |
| 389 pbi->time_loop_filtering += vpx_usec_timer_elapsed(&lpftimer); | |
| 390 | |
| 391 cm->last_frame_type = cm->frame_type; | |
| 392 cm->last_filter_type = cm->filter_type; | |
| 393 cm->last_sharpness_level = cm->sharpness_level; | |
| 394 } | 474 } |
| 395 vp8_yv12_extend_frame_borders_ptr(cm->frame_to_show); | 475 vp8_yv12_extend_frame_borders_ptr(cm->frame_to_show); |
| 396 } | 476 } |
| 397 | 477 |
| 398 | 478 |
| 399 vp8_clear_system_state(); | 479 vp8_clear_system_state(); |
| 400 | 480 |
| 401 vpx_usec_timer_mark(&timer); | 481 #if CONFIG_ERROR_CONCEALMENT |
| 402 pbi->decode_microseconds = vpx_usec_timer_elapsed(&timer); | 482 /* swap the mode infos to storage for future error concealment */ |
| 483 if (pbi->ec_enabled && pbi->common.prev_mi) |
| 484 { |
| 485 const MODE_INFO* tmp = pbi->common.prev_mi; |
| 486 int row, col; |
| 487 pbi->common.prev_mi = pbi->common.mi; |
| 488 pbi->common.mi = tmp; |
| 403 | 489 |
| 404 pbi->time_decoding += pbi->decode_microseconds; | 490 /* Propagate the segment_ids to the next frame */ |
| 491 for (row = 0; row < pbi->common.mb_rows; ++row) |
| 492 { |
| 493 for (col = 0; col < pbi->common.mb_cols; ++col) |
| 494 { |
| 495 const int i = row*pbi->common.mode_info_stride + col; |
| 496 pbi->common.mi[i].mbmi.segment_id = |
| 497 pbi->common.prev_mi[i].mbmi.segment_id; |
| 498 } |
| 499 } |
| 500 } |
| 501 #endif |
| 405 | 502 |
| 406 /*vp8_print_modes_and_motion_vectors( cm->mi, cm->mb_rows,cm->mb_cols, cm->c
urrent_video_frame);*/ | 503 /*vp8_print_modes_and_motion_vectors( cm->mi, cm->mb_rows,cm->mb_cols, cm->c
urrent_video_frame);*/ |
| 407 | 504 |
| 408 if (cm->show_frame) | 505 if (cm->show_frame) |
| 409 cm->current_video_frame++; | 506 cm->current_video_frame++; |
| 410 | 507 |
| 411 pbi->ready_for_new_data = 0; | 508 pbi->ready_for_new_data = 0; |
| 412 pbi->last_time_stamp = time_stamp; | 509 pbi->last_time_stamp = time_stamp; |
| 510 pbi->num_partitions = 0; |
| 511 if (pbi->input_partition) |
| 512 pbi->common.multi_token_partition = 0; |
| 513 pbi->source_sz = 0; |
| 413 | 514 |
| 414 #if 0 | 515 #if 0 |
| 415 { | 516 { |
| 416 int i; | 517 int i; |
| 417 INT64 earliest_time = pbi->dr[0].time_stamp; | 518 int64_t earliest_time = pbi->dr[0].time_stamp; |
| 418 INT64 latest_time = pbi->dr[0].time_stamp; | 519 int64_t latest_time = pbi->dr[0].time_stamp; |
| 419 INT64 time_diff = 0; | 520 int64_t time_diff = 0; |
| 420 int bytes = 0; | 521 int bytes = 0; |
| 421 | 522 |
| 422 pbi->dr[pbi->common.current_video_frame&0xf].size = pbi->bc.pos + pbi->b
c2.pos + 4;; | 523 pbi->dr[pbi->common.current_video_frame&0xf].size = pbi->bc.pos + pbi->b
c2.pos + 4;; |
| 423 pbi->dr[pbi->common.current_video_frame&0xf].time_stamp = time_stamp; | 524 pbi->dr[pbi->common.current_video_frame&0xf].time_stamp = time_stamp; |
| 424 | 525 |
| 425 for (i = 0; i < 16; i++) | 526 for (i = 0; i < 16; i++) |
| 426 { | 527 { |
| 427 | 528 |
| 428 bytes += pbi->dr[i].size; | 529 bytes += pbi->dr[i].size; |
| 429 | 530 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 449 #if CONFIG_RUNTIME_CPU_DETECT | 550 #if CONFIG_RUNTIME_CPU_DETECT |
| 450 if (cm->rtcd.flags & HAS_NEON) | 551 if (cm->rtcd.flags & HAS_NEON) |
| 451 #endif | 552 #endif |
| 452 { | 553 { |
| 453 vp8_pop_neon(dx_store_reg); | 554 vp8_pop_neon(dx_store_reg); |
| 454 } | 555 } |
| 455 #endif | 556 #endif |
| 456 pbi->common.error.setjmp = 0; | 557 pbi->common.error.setjmp = 0; |
| 457 return retcode; | 558 return retcode; |
| 458 } | 559 } |
| 459 int vp8dx_get_raw_frame(VP8D_PTR ptr, YV12_BUFFER_CONFIG *sd, INT64 *time_stamp,
INT64 *time_end_stamp, vp8_ppflags_t *flags) | 560 int vp8dx_get_raw_frame(VP8D_PTR ptr, YV12_BUFFER_CONFIG *sd, int64_t *time_stam
p, int64_t *time_end_stamp, vp8_ppflags_t *flags) |
| 460 { | 561 { |
| 461 int ret = -1; | 562 int ret = -1; |
| 462 VP8D_COMP *pbi = (VP8D_COMP *) ptr; | 563 VP8D_COMP *pbi = (VP8D_COMP *) ptr; |
| 463 | 564 |
| 464 if (pbi->ready_for_new_data == 1) | 565 if (pbi->ready_for_new_data == 1) |
| 465 return ret; | 566 return ret; |
| 466 | 567 |
| 467 /* ie no raw frame to show!!! */ | 568 /* ie no raw frame to show!!! */ |
| 468 if (pbi->common.show_frame == 0) | 569 if (pbi->common.show_frame == 0) |
| 469 return ret; | 570 return ret; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 487 } | 588 } |
| 488 else | 589 else |
| 489 { | 590 { |
| 490 ret = -1; | 591 ret = -1; |
| 491 } | 592 } |
| 492 | 593 |
| 493 #endif /*!CONFIG_POSTPROC*/ | 594 #endif /*!CONFIG_POSTPROC*/ |
| 494 vp8_clear_system_state(); | 595 vp8_clear_system_state(); |
| 495 return ret; | 596 return ret; |
| 496 } | 597 } |
| OLD | NEW |