九鼎创展论坛
标题:
6818的mjpeg硬解码接口问题
[打印本页]
作者:
xiaoxiao
时间:
2016-11-17 15:18
标题:
6818的mjpeg硬解码接口问题
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呢
作者:
xiaoxiao
时间:
2016-11-17 15:21
vpu的驱动是不开源的,所以无法通过代码知道驱动是否支持mjpeg的硬解码,但是从官方的代码看,找不到mjpeg的硬解码样例,只有jpeg的硬编码例子,比如
这里分别是Jpeg软编码和硬编码的路径,但找不到解码的蛛丝马迹,感觉很坑啊
x6818_android\hardware\samsung_slsi\slsiap\lib_jpeg
x6818_android\hardware\samsung_slsi\slsiap\lib_jpeghw
作者:
云开见月明
时间:
2017-1-4 16:08
你好 你这这块做出来了没 ,我现在也遇到这个问题。
欢迎光临 九鼎创展论坛 (http://bbs.9tripod.com/)
Powered by Discuz! X3.2