VP8D_PTR vp8dx_create_decompressor(VP8D_CONFIG *oxcf) { VP8D_COMP *pbi = vpx_memalign(32, sizeof(VP8D_COMP)); if (!pbi) return NULL; vpx_memset(pbi, 0, sizeof(VP8D_COMP)); if (setjmp(pbi->common.error.jmp)) { pbi->common.error.setjmp = 0; vp8dx_remove_decompressor(pbi); return 0; } pbi->common.error.setjmp = 1; vp8dx_initialize(); vp8_create_common(&pbi->common); vp8_dmachine_specific_config(pbi); pbi->common.current_video_frame = 0; pbi->ready_for_new_data = 1; pbi->CPUFreq = 0; /*vp8_get_processor_freq();*/ #if CONFIG_MULTITHREAD pbi->max_threads = oxcf->max_threads; vp8_decoder_create_threads(pbi); #endif /* vp8cx_init_de_quantizer() is first called here. Add check in frame_init_dequantizer() to avoid * unnecessary calling of vp8cx_init_de_quantizer() for every frame. */ vp8cx_init_de_quantizer(pbi); { VP8_COMMON *cm = &pbi->common; vp8_init_loop_filter(cm); cm->last_frame_type = KEY_FRAME; cm->last_filter_type = cm->filter_type; cm->last_sharpness_level = cm->sharpness_level; } pbi->common.error.setjmp = 0; return (VP8D_PTR) pbi; }
int vp8_create_decoder_instances(struct frame_buffers *fb, VP8D_CONFIG *oxcf) { /* decoder instance for single thread mode */ fb->pbi[0] = create_decompressor(oxcf); if (!fb->pbi[0]) return VPX_CODEC_ERROR; #if CONFIG_MULTITHREAD if (setjmp(fb->pbi[0]->common.error.jmp)) { vp8_remove_decoder_instances(fb); memset(fb->pbi, 0, sizeof(fb->pbi)); vpx_clear_system_state(); return VPX_CODEC_ERROR; } fb->pbi[0]->common.error.setjmp = 1; fb->pbi[0]->max_threads = oxcf->max_threads; vp8_decoder_create_threads(fb->pbi[0]); fb->pbi[0]->common.error.setjmp = 0; #endif return VPX_CODEC_OK; }
int vp8_create_decoder_instances(struct frame_buffers *fb, VP8D_CONFIG *oxcf) { if(!fb->use_frame_threads) { /* decoder instance for single thread mode */ fb->pbi[0] = create_decompressor(oxcf); if(!fb->pbi[0]) return VPX_CODEC_ERROR; #if CONFIG_MULTITHREAD /* enable row-based threading only when use_frame_threads * is disabled */ fb->pbi[0]->max_threads = oxcf->max_threads; vp8_decoder_create_threads(fb->pbi[0]); #endif } else { /* TODO : create frame threads and decoder instances for each * thread here */ } return VPX_CODEC_OK; }