예제 #1
0
int vpuInit(void)
{
	int err;
	vpu_versioninfo ver;

	err = vpu_Init(NULL);
	if (err) {
		err_msg("VPU Init Failure.\n");
		return -1;
	}

	err = vpu_GetVersionInfo(&ver);
	if (err) {
		err_msg("Cannot get version info, err:%d\n", err);
		vpu_UnInit();
		return -1;
	}

	info_msg("VPU firmware version: %d.%d.%d_r%d\n",
			ver.fw_major, ver.fw_minor,
			ver.fw_release, ver.fw_code);
	info_msg("VPU library version: %d.%d.%d\n", ver.lib_major,
			ver.lib_minor, ver.lib_release);

	info_msg("VPU: Init framebuffer pool\n");
	framebuf_init();

	info_msg("VPU was successfully initialized\n\n");

	return 0;
}
예제 #2
0
static void decoder_renderer_cleanup() {
  IOFreePhyMem(&ps_mem_desc);
  IOFreePhyMem(&slice_mem_desc);
  
  IOFreeVirtMem(&mem_desc);
  IOFreePhyMem(&mem_desc);
  vpu_UnInit();
}
예제 #3
0
static void enc_uninit(MSFilter *f){
	EncData *d=(EncData*)f->data;
    IOFreeVirtMem(&d->mem_desc);
    IOFreePhyMem(&d->mem_desc);
    vpu_UnInit();

    if (d->flv->fd>=0)	
        rec_close(f,NULL);
    ms_free(d->flv->data);
    ms_free(d->flv);
    ms_free(d->enc);
	ms_free(d);
}
예제 #4
0
iMX27RtpInterface::~iMX27RtpInterface() {
	RTP_FUNCLOG;
	CLEANUP(m_pSendWrapper);
	CLEANUP(m_pReceiveWrapper);
#ifndef MINIMAL_MODE
	if ((Configuration::GetCfg()->GetIntVal("SendPacketsFromAnxbFile") || Configuration::GetCfg()->GetIntVal("SendPacketsFromPcapFile")) && !Configuration::GetCfg()->GetIntVal("RenderVideo")) {
		return;
	}
	pMutexLock scopedLock(m_VpuMutex);

	// De-initialize VPU hardware and release data structures/resources
	vpu_UnInit();
#endif
}
예제 #5
0
iMX27RtpInterface::iMX27RtpInterface(SkypeVideoRTPInterfaceCb *pCallback) :
	m_BitRate(0),
	m_pCb(pCallback),
	m_ReceiveBStat(3000000),
	m_SendBStat(3000000),
	m_KeyFrameRequested(0),
	m_RecordingStarted(false),
	m_ReceivePcnt(0),
	m_SendPcnt(0),
	m_ReceiveFcnt(0),
	m_SendFcnt(0),
	m_PayloadFormat(FORMAT_FRAMES),
	m_pSendWrapper(NULL),
	m_pReceiveWrapper(NULL)
{
	RTP_FUNCLOG;
	if (!Configuration::GetCfg()->IsInitialized())
		Configuration::GetCfg()->Init("RTPTestEngine.conf");
	m_PayloadFormat = (PayloadFmtType)Configuration::GetCfg()->GetIntVal("PayloadFormat");
#ifndef MINIMAL_MODE
	if ((Configuration::GetCfg()->GetIntVal("SendPacketsFromAnxbFile") || Configuration::GetCfg()->GetIntVal("SendPacketsFromPcapFile")) && !Configuration::GetCfg()->GetIntVal("RenderVideo")) {
		return;
	}
	vpu_versioninfo vpuVersion;
	RetCode ret = RETCODE_SUCCESS;
	pMutexLock scopedLock(m_VpuMutex); // Scoped lock on VPU mutex

	// Initialize VPU hardware and data structures/resources
	ret = vpu_Init(NULL);
	if (ret != RETCODE_SUCCESS) {
		FATAL("%s: vpu_Init() failed. Return code: %d", ret);
	}

	// Read out the version information running on the system
	ret = vpu_GetVersionInfo(&vpuVersion);
	scopedLock.mutex.Release(); // VPU access - unlock
	if (ret != RETCODE_SUCCESS) {
		if (ret != RETCODE_NOT_INITIALIZED) {
			vpu_UnInit();
		}
		FATAL("vpu_GetVersionInfo() failed. Return code: %d\n", ret);
	}
	RTP_DBG("i.MX%x Silicon Revision: %x.%x", mxc_cpu(), ((mxc_cpu_rev() >> 4) & 0xF), (mxc_cpu_rev() & 0xF));
	RTP_DBG("i.MX%x VPU Firmware version: %d.%d.%d", mxc_cpu(), vpuVersion.fw_major, vpuVersion.fw_minor, vpuVersion.fw_release);
	RTP_DBG("i.MX%x VPU Library version: %d.%d.%d", mxc_cpu(), vpuVersion.lib_major, vpuVersion.lib_minor, vpuVersion.lib_release);
#endif
}
예제 #6
0
vpu_t::~vpu_t(void)
{
	if( worked_ ) {
                vpu_UnInit();
	}
}
main(int argc, char *argv[])
#endif
{
	int err, nargc, i, ret = 0;
	char *pargv[32] = {0}, *dbg_env;
	pthread_t sigtid;
#ifdef COMMON_INIT
	vpu_versioninfo ver;
#endif
	int ret_thr;

#ifndef COMMON_INIT
	srand((unsigned)time(0)); /* init seed of rand() */
#endif

	dbg_env=getenv("VPU_TEST_DBG");
	if (dbg_env)
		vpu_test_dbg_level = atoi(dbg_env);
	else
		vpu_test_dbg_level = 0;

	err = parse_main_args(argc, argv);
	if (err) {
		goto usage;
	}

	if (!instance) {
		goto usage;
	}

	info_msg("VPU test program built on %s %s\n", __DATE__, __TIME__);
#ifndef _FSL_VTS_
	sigemptyset(&sigset);
	sigaddset(&sigset, SIGINT);
	pthread_sigmask(SIG_BLOCK, &sigset, NULL);
	pthread_create(&sigtid, NULL, (void *)&signal_thread, NULL);
#endif

#ifdef COMMON_INIT
	err = vpu_Init(NULL);
	if (err) {
		err_msg("VPU Init Failure.\n");
		return -1;
	}

	err = vpu_GetVersionInfo(&ver);
	if (err) {
		err_msg("Cannot get version info, err:%d\n", err);
		vpu_UnInit();
		return -1;
	}

	info_msg("VPU firmware version: %d.%d.%d_r%d\n", ver.fw_major, ver.fw_minor,
						ver.fw_release, ver.fw_code);
	info_msg("VPU library version: %d.%d.%d\n", ver.lib_major, ver.lib_minor,
						ver.lib_release);
#else
	// just to enable cpu_is_xx() to be used in command line parsing
	err = vpu_Init(NULL);
	if (err) {
		err_msg("VPU Init Failure.\n");
		return -1;
	}

	vpu_UnInit();

#endif

	if (instance > 1) {
		for (i = 0; i < instance; i++) {
#ifndef COMMON_INIT
			/* sleep roughly a frame interval to test multi-thread race
			   especially vpu_Init/vpu_UnInit */
			usleep((int)(rand()%ONE_FRAME_INTERV));
#endif
			if (using_config_file == 0) {
				get_arg(input_arg[i].line, &nargc, pargv);
				err = parse_args(nargc, pargv, i);
				if (err) {
					vpu_UnInit();
					goto usage;
				}
			}

			if (check_params(&input_arg[i].cmd,
						input_arg[i].mode) == 0) {
				if (open_files(&input_arg[i].cmd) == 0) {
					if (input_arg[i].mode == DECODE) {
					     pthread_create(&input_arg[i].tid,
						   NULL,
						   (void *)&decode_test,
						   (void *)&input_arg[i].cmd);
					} else if (input_arg[i].mode ==
							ENCODE) {
					     pthread_create(&input_arg[i].tid,
						   NULL,
						   (void *)&encode_test,
						   (void *)&input_arg[i].cmd);
					}
				}
			}

		}
	} else {
		if (using_config_file == 0) {
			get_arg(input_arg[0].line, &nargc, pargv);
			err = parse_args(nargc, pargv, 0);
			if (err) {
				vpu_UnInit();
				goto usage;
			}
		}

		if (check_params(&input_arg[0].cmd, input_arg[0].mode) == 0) {
			if (open_files(&input_arg[0].cmd) == 0) {
				if (input_arg[0].mode == DECODE) {
					ret = decode_test(&input_arg[0].cmd);
				} else if (input_arg[0].mode == ENCODE) {
					ret = encode_test(&input_arg[0].cmd);
                                } else if (input_arg[0].mode == TRANSCODE) {
                                        ret = transcode_test(&input_arg[0].cmd);
				}

				close_files(&input_arg[0].cmd);
			} else {
				ret = -1;
			}
		} else {
			ret = -1;
		}

		if (input_arg[0].mode == LOOPBACK) {
			encdec_test(&input_arg[0].cmd);
		}
	}

	if (instance > 1) {
		for (i = 0; i < instance; i++) {
			if (input_arg[i].tid != 0) {
				pthread_join(input_arg[i].tid, (void *)&ret_thr);
				if (ret_thr)
					ret = -1;
				close_files(&input_arg[i].cmd);
			}
		}
	}

#ifdef COMMON_INIT
	vpu_UnInit();
#endif
	return ret;

usage:
	info_msg("\n%s", usage);
	return -1;
}
예제 #8
0
int vpuDeinit(void)
{
	vpu_UnInit();
	info_msg("VPU was deinitialized\n\n");
	return 0;
}
예제 #9
0
void vpu_uninit(void)
{
	vpu_UnInit();
}