|
6818平台上,mjpeg的硬件编解码属于vpu单元的一部分,但是发现 nxvpu的 库文件\x6818_android\linux\platform\s5p6818\library\src\libnxvpu\nx_vedio_api.c 里面似乎没有对mjpeg的解码支持,
下面是vpu的解码open函数,这里的解码类型支持里面,是不包含mjpeg的
NX_VID_DEC_HANDLE NX_VidDecOpen( VID_TYPE_E eCodecType, uint32_t uMp4Class, int32_t iOptions, int32_t *piInstanceIdx )
{
int32_t ret;
VPU_OPEN_ARG openArg;
int32_t workBufSize = WORK_BUF_SIZE;
FUNC_IN();
// Create Context
NX_VID_DEC_HANDLE hDec = (NX_VID_DEC_HANDLE)malloc( sizeof(struct NX_VIDEO_DEC_INFO) );
memset( hDec, 0, sizeof(struct NX_VIDEO_DEC_INFO) );
if ( eCodecType != NX_HEVC_DEC )
{
memset( &openArg, 0, sizeof(openArg) );
// Open Device Driver
hDec->hDecDrv = open(DEV_NAME, O_RDWR);
if( hDec->hDecDrv < 0 )
{
NX_ErrMsg(("Cannot open device(%s)!!!\n", DEV_NAME));
goto ERROR_EXIT;
}
if( eCodecType == NX_AVC_DEC || eCodecType == NX_AVC_ENC )
{
workBufSize += PS_SAVE_SIZE;
}
hDec->hBitStreamBuf = NX_AllocateMemory( STREAM_BUF_SIZE, 4096 ); // x16 aligned
if( 0 == hDec->hBitStreamBuf ){
NX_ErrMsg(("hBitStreamBuf allocation failed.\n"));
goto ERROR_EXIT;
}
// Allocate Instance Memory & Stream Buffer
hDec->hInstanceBuf = NX_AllocateMemory( workBufSize, 4096 ); // x16 aligned
if( 0 == hDec->hInstanceBuf ){
NX_ErrMsg(("hInstanceBuf allocation failed.\n"));
goto ERROR_EXIT;
}
switch( eCodecType )
{
case NX_AVC_DEC:
openArg.codecStd = CODEC_STD_AVC;
break;
case NX_MP2_DEC:
openArg.codecStd = CODEC_STD_MPEG2;
break;
case NX_MP4_DEC:
openArg.codecStd = CODEC_STD_MPEG4;
openArg.mp4Class = uMp4Class;
break;
case NX_H263_DEC: //
openArg.codecStd = CODEC_STD_H263;
break;
case NX_DIV3_DEC: //
openArg.codecStd = CODEC_STD_DIV3;
break;
case NX_RV_DEC: // Real Video
openArg.codecStd = CODEC_STD_RV;
break;
case NX_VC1_DEC: // WMV
openArg.codecStd = CODEC_STD_VC1;
break;
case NX_THEORA_DEC: // Theora
openArg.codecStd = CODEC_STD_THO;
break;
case NX_VP8_DEC: // VP8
openArg.codecStd = CODEC_STD_VP8;
break;
default:
NX_ErrMsg( ("IOCTL_VPU_OPEN_INSTANCE codec Type\n") );
goto ERROR_EXIT;
}
但是在vpu编码open函数里面,是支持mjpeg的,如下图
NX_VID_ENC_HANDLE NX_VidEncOpen( VID_TYPE_E eCodecType, int32_t *piInstanceIdx )
{
VPU_OPEN_ARG openArg;
int32_t ret;
// Create Context
NX_VID_ENC_HANDLE hEnc = (NX_VID_ENC_HANDLE)malloc( sizeof(struct NX_VIDEO_ENC_INFO) );
memset( hEnc, 0, sizeof(struct NX_VIDEO_ENC_INFO) );
memset( &openArg, 0, sizeof(openArg) );
FUNC_IN();
// Open Device Driver
hEnc->hEncDrv = open(DEV_NAME, O_RDWR);
if( hEnc->hEncDrv < 0 )
{
NX_ErrMsg( ("Cannot open device(%s)!!!\n", DEV_NAME) );
goto ERROR_EXIT;
}
switch( eCodecType )
{
case NX_MP4_ENC:
openArg.codecStd = CODEC_STD_MPEG4;
break;
case NX_AVC_ENC:
openArg.codecStd = CODEC_STD_AVC;
break;
case NX_JPEG_ENC:
openArg.codecStd = CODEC_STD_MJPG;
break;
case NX_H263_ENC:
openArg.codecStd = CODEC_STD_H263;
break;
default:
NX_ErrMsg( ("Invalid codec type (%d)!!!\n", eCodecType) );
goto ERROR_EXIT;
}
如果这么理解没有问题的话,当需要对mjpeg进行硬件解码时,怎么调用vpu呢 |
|