您尚未登录。

楼主 #1 2021-01-07 23:18:48

逸俊晨晖
会员
注册时间: 2018-08-29
已发帖子: 151
积分: 137.5

F1C200s主线gstreamer使用openmax调用cedar硬解码

之前发了个v3s使用gstreamer的插件openmax调用cedar硬解码的主题
https://whycan.com/t_5398.html

不少小伙伴用F1C200s尝试使用遇到了问题
报了个初始化解码库失败的错误
经排查发现是配置libcedarc时要选择一个编译硬解码库的gcc
之前用v3s时这个配置项默认是arm-linux-gnueabihf 恰好是适合v3s使用的gcc
但是在F1C200s就不能用了 要进行修改

在修改完以后 继续尝试播放 发现屏幕显示一片墨绿 过一会内核崩溃了 绿的我发慌
重启还起不来 发现是有和启动相关的库被破坏掉了 要重新烧录才行能正常启动

后来排查发现是硬解码输出帧格式的问题 (但不至于内核奔溃甚至破坏启动库吧)
我们在用v3s进行硬解码时 openmax是被默认配置为输出YV12 所以v3s用起来没问题 但是到F1C200s就不行了 F1C200s只能输出MB32 (详细资料看隔壁硬解码主题8楼 https://whycan.com/t_5429.html)
所以我们只要将openmax配置修改一下 再对输出格式做个转换 就可以了


下面开始修改内容

1.配置编译硬解码库的gcc
在buildroot配置libcedarc
Target packages ->
Hardware handling ->
libcedarc ->
Arch library select
改成arm-none-linux-gnueabi

2.修改openmax
在buildroot进入目录output/build/libcedarc-master

cd output/build/libcedarc-master

修改源文件omx_vdec_aw_decoder_linux.c

vim openmax/vdec/src/omx_vdec_aw_decoder_linux.c

在结构体类型typedef struct OmxAwDecoderContext增加以下成员
char*                  pYV12;
VideoPicture           CvtPicture;

在函数__liPrepare中

pCtx->mVideoConfig.eOutputPixelFormat = PIXEL_FORMAT_YV12;

改为

pCtx->mVideoConfig.eOutputPixelFormat = PIXEL_FORMAT_YUV_MB32_420;

在语句ret = InitializeVideoDecoder(pCtx->m_decoder, 上面一行添加以下内容

pCtx->pYV12 = (char*)malloc(sizeof(char) * pCtx->mStreamInfo.nWidth * pCtx->mStreamInfo.nHeight * 3 / 2);
if(pCtx->pYV12 == NULL)
{
    loge("pCtx->pYV12 malloc fail\n");
    return -1;
}
pCtx->CvtPicture.pData0 = pCtx->pYV12;
pCtx->CvtPicture.ePixelFormat = PIXEL_FORMAT_YV12;

在函数__liDrain中
在logv("*** picture info: w(%d),h(%d),offset,t(%d),b(%d),l(%d),r(%d)",上面一行添加以下内容

RotatePicture(pCtx->decMemOps, pCtx->pPicture, &pCtx->CvtPicture, 0, 32, 32);

AlignCopyYV12((unsigned char*)pOutBufHdr->pBuffer,
                                (unsigned char*)pCtx->pPicture->pData0,
                                outDef->format.video.nFrameWidth,
                                outDef->format.video.nFrameHeight);

改成

AlignCopyYV12((unsigned char*)pOutBufHdr->pBuffer,
                                (unsigned char*)pCtx->CvtPicture.pData0,
                                outDef->format.video.nFrameWidth,
                                outDef->format.video.nFrameHeight);

在函数__liGetFormat

pCtx->mVideoConfig.eOutputPixelFormat = PIXEL_FORMAT_YV12;

改为

pCtx->mVideoConfig.eOutputPixelFormat = PIXEL_FORMAT_YUV_MB32_420;

在函数__liClose
在if(pCtx->m_decoder != NULL)上面一行添加以下内容

if(pCtx->pYV12 != NULL)
{
        free(pCtx->pYV12);
        pCtx->pYV12 = NULL;
}

3.修改libcedarc 添加格式转换
修改源文件pixel_format.c
vim vdecoder/pixel_format.c
在函数ConvertPixelFormat上面添加一个函数

void MB32_CVT_YV12_(char* pSrc, char* pSrc_v, char* pDst, int nWidth, int nHeight)
{
	int i = 0;
	int j = 0;
	int m = 0;
	int n = 0;
	int k = 0;
	int nMbWidth = 0;
	int nMbHeight = 0;
	int nMbWidth_uv = 0;
	int nMbHeight_uv = 0;
	int nLineStride = 0;
	int nLineStride_uv = 0;
	int lineNum = 0;
	int lineNum_uv = 0;
	int offset = 0;
	int offset_uv = 0;
	int maxNum = 0;
	char* ptr = NULL;
	char* ptr_uv = NULL;
	char* pDstU = NULL;
	char* pDstV = NULL;
	int nWidth_uv = 0;
	int nHeight_uv = 0;
	char bufferY[32];
	char bufferV[16], bufferU[16];
	int nWidthMatchFlag = 0;
	int nWidthMatchFlag_uv = 0;
	int nCopyMbWidth = 0;
	int nCopyMbWidth_uv = 0;
	char *dstAsm = NULL;
	char *dst0Asm = NULL;
	char *dst1Asm = NULL;
	char *srcAsm = NULL;
	char *srcAsm_uv = NULL;

	int bCnt2 = 1;

	nLineStride = (nWidth + 15) &~15;
	nMbWidth = (nWidth + 31)&~31;
	nMbWidth >>= 5;//n 32 width   / 32

	nMbHeight = (nHeight + 31)&~31;
	nMbHeight >>= 5;// / 32
	ptr = pSrc;

	nWidthMatchFlag = 0;
	nCopyMbWidth = nMbWidth - 1;

	nWidth_uv = (nWidth + 1) / 2;
	nHeight_uv = (nHeight + 1) / 2;

	nLineStride_uv = (nWidth_uv + 7)&~7;

	nMbWidth_uv = (nWidth_uv * 2 + 31)&~31;
	nMbWidth_uv >>= 5;// / 32

	nMbHeight_uv = (nHeight_uv + 31)&~31;
	nMbHeight_uv >>= 5;// / 32
	ptr_uv = pSrc_v;
	pDstU = pDst + (nWidth * nHeight) + (nWidth / 2 * nHeight / 2);
	pDstV = pDst + (nWidth * nHeight);
	nWidthMatchFlag_uv = 0;
	nCopyMbWidth_uv = nMbWidth_uv - 1;

	if ((nMbWidth << 5) == nLineStride)// * 32
	{
		nWidthMatchFlag = 1;
		nCopyMbWidth = nMbWidth;
	}

	if ((nMbWidth_uv << 4) == nLineStride_uv)//*16
	{
		nWidthMatchFlag_uv = 1;
		nCopyMbWidth_uv = nMbWidth_uv;

	}

	for (i = 0; i < nMbHeight; i++)
	{
		for (j = 0; j < nCopyMbWidth; j++)
		{
			for (m = 0; m < 32; m++)
			{
				if (((i << 5) + m) >= nHeight)// * 32
				{
					ptr += 32;
					continue;
				}
				srcAsm = ptr;
				lineNum = (i << 5) + m;           //line num      * 32
				offset = lineNum * nLineStride + (j << 5);// * 32
				dstAsm = pDst + offset;

				memcpy(dstAsm, srcAsm, 32);

				if (bCnt2)
				{
					srcAsm_uv = ptr_uv;
					lineNum_uv = (i << 4) + m;           //line num i / 2 * 32
					offset_uv = lineNum_uv * nLineStride_uv + (j << 4);// * 16
					dst0Asm = pDstU + offset_uv;
					dst1Asm = pDstV + offset_uv;

					memcpy(dst0Asm, srcAsm_uv, 16);
					memcpy(dst1Asm, (void *)(srcAsm_uv + 16), 16);
					ptr_uv += 32;
				}
				ptr += 32;
			}
		}

		if (nWidthMatchFlag != 1)
		{
			for (m = 0; m < 32; m++)
			{
				if (((i << 5) + m) >= nHeight)// * 32
				{
					ptr += 32;
					continue;
				}
				dstAsm = bufferY;
				srcAsm = ptr;
				lineNum = (i << 5) + m;           //line num   * 32
				offset = lineNum * nLineStride + (j << 5);// * 32

				memcpy(dstAsm, srcAsm, 32);
				ptr += 32;
				for (k = 0; k < 32; k++)
				{
					if ((j * 32 + k) >= nLineStride)
					{
						break;
					}
					pDst[offset + k] = bufferY[k];
				}
			}
		}

		if (bCnt2) {
			if (nWidthMatchFlag_uv != 1)
			{
				for (m = 0; m < 32; m++)
				{
					if (((i << 4) + m) >= nHeight_uv)//i / 2 * 32
					{
						ptr_uv += 32;
						continue;
					}

					srcAsm = ptr_uv;
					lineNum_uv = (i << 4) + m;           //line num i / 2 * 32
					offset = lineNum_uv * nLineStride_uv + (j << 4);// * 16
					dst0Asm = bufferU;
					dst1Asm = bufferV;

					memcpy(dst0Asm, srcAsm, 16);
					memcpy(dst1Asm, (char *)(srcAsm + 16), 16);
					ptr_uv += 32;

					for (k = 0; k < 16; k++)
					{
						if (((j << 4) + k) >= nLineStride_uv)// j * 16
						{
							break;
						}
						pDstV[offset + k] = bufferV[k];
						pDstU[offset + k] = bufferU[k];
					}
				}
			}
		}
		bCnt2 = !bCnt2;
	}
}

在函数ConvertPixelFormat的
if(pPictureOut->ePixelFormat==PIXEL_FORMAT_YV12){
和#ifdef CEDARX_DECODER_ARM32之间添加以下内容

if(pPictureIn->ePixelFormat == PIXEL_FORMAT_YUV_MB32_420)
{
    MB32_CVT_YV12(pPictureIn->pData0, pPictureIn->pData1, pPictureOut->pData0, \
                    pPictureIn->nWidth, pPictureIn->nHeight);
}

清除libcedarc之前的编译文件

make clean

清除buildroot对于libcedarc的编译标记

rm .stamp_built

3.和v3s一样 给gstreamer的openmax插件添加全志的颜色空间定义

cd ../gst-omx-1.16.0/
vim omx/gstomxvideo.c

在函数gst_omx_video_get_format_from_omx的switch下添加case

case OMX_COLOR_FormatYVU420Planar:
format = GST_VIDEO_FORMAT_YV12;
break;

保存退出

清除gst-omx之前的编译文件
(之前那篇帖子有人说OMX_COLOR_FormatYVU420Planar找不到定义 我估计就是这个没有清)

make clean

清除buildroot对于gst-omx的编译标记

rm .stamp_built

回到buildroot目录

cd ../../../ 

编译

make

这样源文件的修改就完成了 gstreamer的配置就看回上面v3s的主题
打包烧录后进入系统 进行gst-omx注册后就可以进行硬解码播放了

离线

楼主 #2 2021-01-07 23:28:49

逸俊晨晖
会员
注册时间: 2018-08-29
已发帖子: 151
积分: 137.5

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

F1C200s硬解码播放现场:

镜像和使用方法
https://whycan.com/files/members/1105/F1C200s_gst-omx硬解码镜像.zip

验证平台:
硬件 Widora R3 晕哥特供
linux 主线内核5.2荔枝派官方的
启动方式 TF卡 屏幕800 * 480
h264文件 bad_apple.mp4

最后感谢晕哥在歪朵拉R3断货时 雪中送炭 支援了我一块 真够豪爽的
WidoraR3_2.jpg

最近编辑记录 逸俊晨晖 (2021-01-07 23:32:04)

离线

#3 2021-01-08 00:52:53

微凉VeiLiang
会员
所在地: 深圳
注册时间: 2018-10-28
已发帖子: 551
积分: 489
个人网站

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

感谢分享经验,解码的f1c好像都是mb32 title格式

离线

#4 2021-01-08 09:02:41

bubailong
会员
注册时间: 2020-04-16
已发帖子: 104
积分: 104

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

厉害厉害,学习了,这回可玩性就大多了,有声音吗?

最近编辑记录 bubailong (2021-01-08 09:03:11)

离线

#5 2021-01-08 14:52:58

f1c100_
会员
注册时间: 2020-09-22
已发帖子: 31
积分: 44.5

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

这个帧率有多少呢?

离线

#6 2021-01-08 20:00:51

bubailong
会员
注册时间: 2020-04-16
已发帖子: 104
积分: 104

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

为啥无法启动呢?没有任何输出

离线

楼主 #7 2021-01-08 20:22:37

逸俊晨晖
会员
注册时间: 2018-08-29
已发帖子: 151
积分: 137.5

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

bubailong 说:

厉害厉害,学习了,这回可玩性就大多了,有声音吗?

我说我杀人不眨眼 你问我眼睛酸不酸?
上面搞了这么多 都是硬解视频流 声音要先把声卡配出来 然后用以下命令解码才有

gst-launch-1.0 filesrc location=bad_apple.mp4 ! qtdemux name=demux demux.audio_0 \
! queue ! decodebin ! audioconvert ! audioresample ! alsasink \
demux.video_0 ! queue ! h264parse ! omxh264dec ! videoconvert ! videoscale ! fbdevsink

离线

楼主 #8 2021-01-08 20:24:48

逸俊晨晖
会员
注册时间: 2018-08-29
已发帖子: 151
积分: 137.5

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

f1c100_ 说:

这个帧率有多少呢?

没测试过 肯定比bsp差一些 追求极致要配合DE 省去软件yuv转rgb环节

离线

楼主 #9 2021-01-08 20:27:57

逸俊晨晖
会员
注册时间: 2018-08-29
已发帖子: 151
积分: 137.5

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

bubailong 说:

为啥无法启动呢?没有任何输出

我估计你用F1C100s玩火了 内存不足警告
注意串口接口 歪朵拉R3的是PA2 PA3

最近编辑记录 逸俊晨晖 (2021-01-08 20:36:13)

离线

#10 2021-01-08 20:54:26

bubailong
会员
注册时间: 2020-04-16
已发帖子: 104
积分: 104

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

逸俊晨晖 说:
bubailong 说:

为啥无法启动呢?没有任何输出

我估计你用F1C100s玩火了 内存不足警告
注意串口接口 歪朵拉R3的是PA2 PA3

我知道了,R3默认的是串口1,不是串口0

离线

#11 2021-01-10 10:05:32

bubailong
会员
注册时间: 2020-04-16
已发帖子: 104
积分: 104

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

昨天调了一天,按照教程  /dev中始终不出现cedar_dev和ion 这两个

_20210110095810.png_20210110095924.png_20210110095939.png_20210110100034.png


内核中也勾选cedarx,编译后放进TF卡启动,就是不出现

大神,帮我看看,是哪一步出错了。。

离线

楼主 #12 2021-01-10 10:45:13

逸俊晨晖
会员
注册时间: 2018-08-29
已发帖子: 151
积分: 137.5

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

bubailong 说:

大神,帮我看看,是哪一步出错了。。

在设备树中 cedar_dev和ion 的status 项从 disabled改成okay

离线

#13 2021-01-10 10:57:51

bubailong
会员
注册时间: 2020-04-16
已发帖子: 104
积分: 104

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

逸俊晨晖 说:
bubailong 说:

大神,帮我看看,是哪一步出错了。。

在设备树中 cedar_dev和ion 的status 项从 disabled改成okay


谢谢了,出现了

离线

#14 2021-01-12 14:47:21

nonzhe
会员
注册时间: 2020-09-30
已发帖子: 2
积分: 2

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

为什么这么卡,看上去fps好低啊?

离线

楼主 #15 2021-01-15 01:41:47

逸俊晨晖
会员
注册时间: 2018-08-29
已发帖子: 151
积分: 137.5

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

nonzhe 说:

为什么这么卡,看上去fps好低啊?

超频走起 DE走起

离线

#16 2021-03-11 22:14:26

Bosspoi
会员
注册时间: 2020-11-29
已发帖子: 32
积分: 26.5

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

感谢楼主,楼主上面中 MB32_CVT_YV12_是不是多了_符号。
另外我这里F1C200S报错如下:

Setting pipeline to PAUSED ...
debug  : cedarc <AwOmxComponentInit:26>:OMXCORE: aw_omx_component_init 122300

debug  : omx_vdec <__AwOmxVdecInit:1059>:++++++++++++++++++++++omx begin++++++++++++++++++
debug  : omx_vdec <__AwOmxVdecInit:1060>:name = OMX.allwinner.video.decoder.avc
debug  : omx_vdec_aw <OmxDecoderCreate:940>:kay: ** 0.
debug  : cedarc <CdcMessageQueueCreate:47>:nMessageSize = 20
debug  : cedarc <AwOmxComponentSetCallbacks:310>:OMXCORE: aw_omx_component_set_callbacks 122300, b667d504 , fe8f8

debug  : omx_vdec <__AwOmxVdecSetCallbacks:1812>:===== vdec set callbacks
Pipeline is PREROLLING ...
debug  : omx_vdec <AwOmxVdecPortSetDefinitioin:192>:port:<<<<<<<<in,nBufferCountActual = 2, mBufferCntActual = 2
debug  : omx_vdec <AwOmxVdecPortSetDefinitioin:192>:port:<<<<<<<<in,nBufferCountActual = 2, mBufferCntActual = 2
error  : omx_vdec <AwOmxVdecPortGetFormat:288>:erro: pParamData->nIndex > m_sPortFormatType.nIndex
debug  : omx_vdec <controlSetState:359>:current state:OMX_StateLoaded, target state:OMX_StateIdle
debug  : omx_vdec <doStateWaitforResources2Idle:563>:bEnabled[1],[1],bPopulated[0],[0]
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1693>:kay: __AwOmxVdecAllocateBuffer
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1713>:kay: __AwOmxVdecAllocateBuffer 2
debug  : omx_vdec_aw <__liAllocatePortBuffer:867>:kay: *** 0.
debug  : omx_vdec_aw <__liAllocatePortBuffer:879>:kay: malloc
debug  : omx_vdec_aw <__liAllocatePortBuffer:881>:kay: malloc2
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1715>:kay: __AwOmxVdecAllocateBuffer 3
debug  : omx_vdec <AwOmxVdecPortPopBuffer:393>:*******port pop buffer:<<<<<<<<in
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1693>:kay: __AwOmxVdecAllocateBuffer
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1713>:kay: __AwOmxVdecAllocateBuffer 2
debug  : omx_vdec_aw <__liAllocatePortBuffer:867>:kay: *** 0.
debug  : omx_vdec_aw <__liAllocatePortBuffer:879>:kay: malloc
debug  : omx_vdec_aw <__liAllocatePortBuffer:881>:kay: malloc2
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1715>:kay: __AwOmxVdecAllocateBuffer 3
debug  : omx_vdec <AwOmxVdecPortPopBuffer:393>:*******port pop buffer:<<<<<<<<in
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1693>:kay: __AwOmxVdecAllocateBuffer
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1713>:kay: __AwOmxVdecAllocateBuffer 2
debug  : omx_vdec_aw <__liAllocatePortBuffer:867>:kay: *** 0.
debug  : omx_vdec_aw <__liAllocatePortBuffer:879>:kay: malloc
debug  : omx_vdec_aw <__liAllocatePortBuffer:881>:kay: malloc2
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1715>:kay: __AwOmxVdecAllocateBuffer 3
debug  : omx_vdec <AwOmxVdecPortPopBuffer:393>:*******port pop buffer:>>>>>>>out
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1693>:kay: __AwOmxVdecAllocateBuffer
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1713>:kay: __AwOmxVdecAllocateBuffer 2
debug  : omx_vdec_aw <__liAllocatePortBuffer:867>:kay: *** 0.
debug  : omx_vdec_aw <__liAllocatePortBuffer:879>:kay: malloc
debug  : omx_vdec_aw <__liAllocatePortBuffer:881>:kay: malloc2
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1715>:kay: __AwOmxVdecAllocateBuffer 3
debug  : omx_vdec <AwOmxVdecPortPopBuffer:393>:*******port pop buffer:>>>>>>>out
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1693>:kay: __AwOmxVdecAllocateBuffer
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1713>:kay: __AwOmxVdecAllocateBuffer 2
debug  : omx_vdec_aw <__liAllocatePortBuffer:867>:kay: *** 0.
debug  : omx_vdec_aw <__liAllocatePortBuffer:879>:kay: malloc
debug  : omx_vdec_aw <__liAllocatePortBuffer:881>:kay: malloc2
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1715>:kay: __AwOmxVdecAllocateBuffer 3
debug  : omx_vdec <AwOmxVdecPortPopBuffer:393>:*******port pop buffer:>>>>>>>out
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1693>:kay: __AwOmxVdecAllocateBuffer
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1713>:kay: __AwOmxVdecAllocateBuffer 2
debug  : omx_vdec_aw <__liAllocatePortBuffer:867>:kay: *** 0.
debug  : omx_vdec_aw <__liAllocatePortBuffer:879>:kay: malloc
debug  : omx_vdec_aw <__liAllocatePortBuffer:881>:kay: malloc2
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1715>:kay: __AwOmxVdecAllocateBuffer 3
debug  : omx_vdec <AwOmxVdecPortPopBuffer:393>:*******port pop buffer:>>>>>>>out
debug  : omx_vdec <doStateWaitforResources2Idle:563>:bEnabled[1],[1],bPopulated[1],[1]
debug  : omx_vdec <controlSetState:380>:Transit current state:OMX_StateLoaded --> target state:OMX_StateIdle --OK!
debug  : omx_vdec <controlSetState:359>:current state:OMX_StateIdle, target state:OMX_StateExecuting
debug  : omx_vdec <controlSetState:380>:Transit current state:OMX_StateIdle --> target state:OMX_StateExecuting --OK!
Caught SIGSEGV
 

错误在

 error  : omx_vdec <AwOmxVdecPortGetFormat:288>:erro: pParamData->nIndex > m_sPortFormatType.nIndex

这个错误楼主知道是哪里有问题吗。。。
全都按上面操作来了,因为中间提示OMX_COLOR_FormatYVU420Planar没定义,所以在一些头文件里加了,重新编译过了,不知道是不是这个原因?

离线

#17 2021-03-19 17:07:39

vip888888
会员
注册时间: 2020-07-16
已发帖子: 141
积分: 138

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

感觉应该是跑起来了,但是显示屏上显示的又贼慢。

 gst-launch-1.0 filesrc location=bad_apple.mp4 ! qtdemux ! h264parse ! omxh264d
ec ! autovideoconvert ! fbdevsink
[   31.842570] vcc3v0: disabling
[   31.845580] vcc5v0: disabling
Setting pipeline to PAUSED ...
debug  : cedarc <AwOmxComponentInit:26>:OMXCORE: aw_omx_component_init 126000

debug  : omx_vdec <__AwOmxVdecInit:1059>:++++++++++++++++++++++omx begin++++++++++++++++++
debug  : omx_vdec <__AwOmxVdecInit:1060>:name = OMX.allwinner.video.decoder.avc
debug  : omx_vdec_aw <OmxDecoderCreate:962>:kay: ** 0.
debug  : cedarc <CdcMessageQueueCreate:47>:nMessageSize = 20
debug  : cedarc <AwOmxComponentSetCallbacks:310>:OMXCORE: aw_omx_component_set_callbacks 126000, b6695508 , 9a8b0

debug  : omx_vdec <__AwOmxVdecSetCallbacks:1812>:===== vdec set callbacks
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
Pipeline is PREROLLING ...
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
debug  : omx_vdec <AwOmxVdecPortSetDefinitioin:192>:port:<<<<<<<<in,nBufferCountActual = 2, mBufferCntActual = 2
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
debug  : omx_vdec <AwOmxVdecPortSetDefinitioin:192>:port:<<<<<<<<in,nBufferCountActual = 2, mBufferCntActual = 2
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
hxf-------format=7f000002
hxf2-------format=3
error  : omx_vdec <AwOmxVdecPortGetFormat:289>:erro: pParamData->nIndex > m_sPortFormatType.nIndex
hxf__src/omx_vdec_port.c AwOmxVdecPortGetFormat 290---------------
hxf default format=7f000002__src/omx_vdec_port.c AwOmxVdecPortGetFormat 294---------------
debug  : omx_vdec <controlSetState:359>:current state:OMX_StateLoaded, target state:OMX_StateIdle
debug  : omx_vdec <doStateWaitforResources2Idle:563>:bEnabled[1],[1],bPopulated[0],[0]
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1693>:kay: __AwOmxVdecAllocateBuffer
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1713>:kay: __AwOmxVdecAllocateBuffer 2
debug  : omx_vdec_aw <__liAllocatePortBuffer:889>:kay: *** 0.
debug  : omx_vdec_aw <__liAllocatePortBuffer:901>:kay: malloc
debug  : omx_vdec_aw <__liAllocatePortBuffer:903>:kay: malloc2
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1715>:kay: __AwOmxVdecAllocateBuffer 3
debug  : omx_vdec <AwOmxVdecPortPopBuffer:396>:*******port pop buffer:<<<<<<<<in
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1693>:kay: __AwOmxVdecAllocateBuffer
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1713>:kay: __AwOmxVdecAllocateBuffer 2
debug  : omx_vdec_aw <__liAllocatePortBuffer:889>:kay: *** 0.
debug  : omx_vdec_aw <__liAllocatePortBuffer:901>:kay: malloc
debug  : omx_vdec_aw <__liAllocatePortBuffer:903>:kay: malloc2
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1715>:kay: __AwOmxVdecAllocateBuffer 3
debug  : omx_vdec <AwOmxVdecPortPopBuffer:396>:*******port pop buffer:<<<<<<<<in
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1693>:kay: __AwOmxVdecAllocateBuffer
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1713>:kay: __AwOmxVdecAllocateBuffer 2
debug  : omx_vdec_aw <__liAllocatePortBuffer:889>:kay: *** 0.
debug  : omx_vdec_aw <__liAllocatePortBuffer:901>:kay: malloc
debug  : omx_vdec_aw <__liAllocatePortBuffer:903>:kay: malloc2
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1715>:kay: __AwOmxVdecAllocateBuffer 3
debug  : omx_vdec <AwOmxVdecPortPopBuffer:396>:*******port pop buffer:>>>>>>>out
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1693>:kay: __AwOmxVdecAllocateBuffer
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1713>:kay: __AwOmxVdecAllocateBuffer 2
debug  : omx_vdec_aw <__liAllocatePortBuffer:889>:kay: *** 0.
debug  : omx_vdec_aw <__liAllocatePortBuffer:901>:kay: malloc
debug  : omx_vdec_aw <__liAllocatePortBuffer:903>:kay: malloc2
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1715>:kay: __AwOmxVdecAllocateBuffer 3
debug  : omx_vdec <AwOmxVdecPortPopBuffer:396>:*******port pop buffer:>>>>>>>out
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1693>:kay: __AwOmxVdecAllocateBuffer
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1713>:kay: __AwOmxVdecAllocateBuffer 2
debug  : omx_vdec_aw <__liAllocatePortBuffer:889>:kay: *** 0.
debug  : omx_vdec_aw <__liAllocatePortBuffer:901>:kay: malloc
debug  : omx_vdec_aw <__liAllocatePortBuffer:903>:kay: malloc2
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1715>:kay: __AwOmxVdecAllocateBuffer 3
debug  : omx_vdec <AwOmxVdecPortPopBuffer:396>:*******port pop buffer:>>>>>>>out
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1693>:kay: __AwOmxVdecAllocateBuffer
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1713>:kay: __AwOmxVdecAllocateBuffer 2
debug  : omx_vdec_aw <__liAllocatePortBuffer:889>:kay: *** 0.
debug  : omx_vdec_aw <__liAllocatePortBuffer:901>:kay: malloc
debug  : omx_vdec_aw <__liAllocatePortBuffer:903>:kay: malloc2
debug  : omx_vdec <__AwOmxVdecAllocateBuffer:1715>:kay: __AwOmxVdecAllocateBuffer 3
debug  : omx_vdec <AwOmxVdecPortPopBuffer:396>:*******port pop buffer:>>>>>>>out
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
debug  : omx_vdec <doStateWaitforResources2Idle:563>:bEnabled[1],[1],bPopulated[1],[1]
debug  : omx_vdec <controlSetState:380>:Transit current state:OMX_StateLoaded --> target state:OMX_StateIdle --OK!
debug  : omx_vdec <controlSetState:359>:current state:OMX_StateIdle, target state:OMX_StateExecuting
debug  : omx_vdec <controlSetState:380>:Transit current state:OMX_StateIdle --> target state:OMX_StateExecuting --OK!
debug  : omx_vdec_aw <liDealWithInitData:156>:fatal error! pInBufHdr is NULL, check code!
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
debug  : omx_vdec_aw <liDealWithInitData:175>:++++++++++++++++pCtx->mCodecSpecificDataLen[0]
debug  : omx_vdec_aw <__liPrepare:464>:decoder prepare
warning: cedarc <AddVDPlugin:1538>: 1117 get local path: /usr/lib/
warning: cedarc <AddVDPlugin:1548>:  1117 load so: /usr/lib/libawavs.so
debug  : cedarc <AddVDPluginSingle:1501>: vdecoder open lib: /usr/lib/libawavs.so
warning: cedarc <VDecoderRegister:127>: register codec: '117:avs' success.
warning: cedarc <AddVDPlugin:1548>:  1117 load so: /usr/lib/libawh264.so
hxf__src/omx_vdec_aw_decoder_linux.c __liGetFormat 875---------------
hxf-------format=7f000002
hxf2-------format=3
debug  : cedarc <AddVDPluginSingle:1501>: vdecoder open lib: /usr/lib/libawh264.so
warning: cedarc <VDecoderRegister:127>: register codec: '115:h264' success.
warning: cedarc <AddVDPlugin:1548>:  1117 load so: /usr/lib/libawh265.so
debug  : cedarc <AddVDPluginSingle:1501>: vdecoder open lib: /usr/lib/libawh265.so
warning: cedarc <VDecoderRegister:127>: register codec: '116:h265' success.
warning: cedarc <AddVDPlugin:1548>:  1117 load so: /usr/lib/libawmjpeg.so
debug  : cedarc <AddVDPluginSingle:1501>: vdecoder open lib: /usr/lib/libawmjpeg.so
warning: cedarc <VDecoderRegister:127>: register codec: '101:mjpeg' success.
warning: cedarc <AddVDPlugin:1548>:  1117 load so: /usr/lib/libawmjpegplus.so
debug  : cedarc <AddVDPluginSingle:1501>: vdecoder open lib: /usr/lib/libawmjpegplus.so
warning: cedarc <VDecoderRegister:127>: register codec: '101:mjpegplus' success.
warning: cedarc <AddVDPlugin:1548>:  1117 load so: /usr/lib/libawmpeg2.so
debug  : cedarc <AddVDPluginSingle:1501>: vdecoder open lib: /usr/lib/libawmpeg2.so
warning: cedarc <VDecoderRegister:127>: register codec: '102:mpeg2' success.
warning: cedarc <VDecoderRegister:127>: register codec: '103:mpeg2' success.
warning: cedarc <AddVDPlugin:1548>:  1117 load so: /usr/lib/libawmpeg4base.so
warning: cedarc <AddVDPluginSingle:1498>: Invalid plugin, CedarPluginVDInit not found.
warning: cedarc <AddVDPlugin:1548>:  1117 load so: /usr/lib/libawmpeg4dx.so
debug  : cedarc <AddVDPluginSingle:1501>: vdecoder open lib: /usr/lib/libawmpeg4dx.so
warning: cedarc <VDecoderRegister:127>: register codec: '105:mpeg4dx' success.
warning: cedarc <VDecoderRegister:127>: register codec: '106:mpeg4dx' success.
warning: cedarc <VDecoderRegister:127>: register codec: '107:mpeg4dx' success.
warning: cedarc <VDecoderRegister:127>: register codec: '10e:mpeg4dx' success.
warning: cedarc <VDecoderRegister:127>: register codec: '10f:mpeg4dx' success.
warning: cedarc <AddVDPlugin:1548>:  1117 load so: /usr/lib/libawmpeg4h263.so
debug  : cedarc <AddVDPluginSingle:1501>: vdecoder open lib: /usr/lib/libawmpeg4h263.so
warning: cedarc <VDecoderRegister:127>: register codec: '104:mpeg4H263' success.
warning: cedarc <VDecoderRegister:127>: register codec: '10b:mpeg4H263' success.
warning: cedarc <VDecoderRegister:127>: register codec: '10d:mpeg4H263' success.
warning: cedarc <AddVDPlugin:1548>:  1117 load so: /usr/lib/libawmpeg4normal.so
debug  : cedarc <AddVDPluginSingle:1501>: vdecoder open lib: /usr/lib/libawmpeg4normal.so
warning: cedarc <VDecoderRegister:127>: register codec: '10a:mpeg4Normal' success.
warning: cedarc <VDecoderRegister:127>: register codec: '10c:mpeg4Normal' success.
warning: cedarc <VDecoderRegister:127>: register codec: '108:mpeg4Normal' success.
warning: cedarc <VDecoderRegister:127>: register codec: '109:mpeg4Normal' success.
warning: cedarc <AddVDPlugin:1548>:  1117 load so: /usr/lib/libawmpeg4vp6.so
debug  : cedarc <AddVDPluginSingle:1501>: vdecoder open lib: /usr/lib/libawmpeg4vp6.so
warning: cedarc <VDecoderRegister:127>: register codec: '111:Mpeg4Vp6' success.
warning: cedarc <AddVDPlugin:1548>:  1117 load so: /usr/lib/libawvp8.so
debug  : cedarc <AddVDPluginSingle:1501>: vdecoder open lib: /usr/lib/libawvp8.so
warning: cedarc <VDecoderRegister:127>: register codec: '112:vp8' success.
warning: cedarc <AddVDPlugin:1548>:  1117 load so: /usr/lib/libawvp9Hw.so
debug  : cedarc <AddVDPluginSingle:1501>: vdecoder open lib: /usr/lib/libawvp9Hw.so
warning: cedarc <VDecoderRegister:127>: register codec: '113:Vp9Hw' success.
warning: cedarc <AddVDPlugin:1548>:  1117 load so: /usr/lib/libawwmv3.so
debug  : cedarc <AddVDPluginSingle:1501>: vdecoder open lib: /usr/lib/libawwmv3.so
warning: cedarc <VDecoderRegister:127>: register codec: '110:vc1' success.
debug  : cedarc <LogVersionInfo:40>:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Cedar Codec <<<<<<<<<<<<<<<<<<<<<<<<<<<<
tag   : CedarC-v1.1.9
branch: master
commit: 1951abe1456450ea48bfd446e801861a1354e93c
date  : Wed May 30 18:59:36 2018 +0800
author: jenkins8080
patch :
----------------------------------------------------------------------

debug  : cedarc <CreateVideoDecoder:215>:CreateVideoDecoder ****
debug  : ionAlloc <__GetIonMemOpsS:985>:*** get __GetIonMemOpsS ***
debug  : ionAlloc <ion_alloc_open:134>:begin ion_alloc_open

debug  : cedarc <VeSetSpeed:1559>: *** set ve freq to 300 Mhz ***
debug  : cedarc <VeInitialize:1198>: ve init ok

debug  : ionAlloc <ion_alloc_open:175>:** phy offset = 40000000
debug  : cedarc <VeRelease:1253>: ve release ok

从后面输出的显示来看应该是一直在解码的样子。这里fb显示报的警告说大量缓冲区的数据被丢弃了。

WARNING: from element /GstPipeline:pipeline0/GstFBDEVSink:fbdevsink0: A lot of buffers are being dropped.
Additional debug info:
../libs/gst/base/gstbasesink.c(3005): gst_base_sink_is_too_late (): /GstPipeline:pipeline0/GstFBDEVSink:fbdevsink0:
There may be a timestamping problem, or this computer is too slow.
hxf__src/omx_vdec_aw_decoder_linux.c __liDrain 724---------------
*** picture info: w(512),h(384),offset,t(0),b(384),l(0),r(512)hxf__src/omx_vdec_aw_decoder_linux.c __liDrain 740---------------
hxf__pixel_format.c ConvertPixelFormat 766---------------
hxf__src/omx_vdec_aw_decoder_linux.c __liDrain 724---------------
*** picture info: w(512),h(384),offset,t(0),b(384),l(0),r(512)hxf__src/omx_vdec_aw_decoder_linux.c __liDrain 740---------------
hxf__pixel_format.c ConvertPixelFormat 766---------------
hxf__src/omx_vdec_aw_decoder_linux.c __liDrain 724---------------
*** picture info: w(512),h(384),offset,t(0),b(384),l(0),r(512)hxf__src/omx_vdec_aw_decoder_linux.c __liDrain 740---------------
hxf__pixel_format.c ConvertPixelFormat 766---------------
hxf__src/omx_vdec_aw_decoder_linux.c __liDrain 724---------------
*** picture info: w(512),h(384),offset,t(0),b(384),l(0),r(512)hxf__src/omx_vdec_aw_decoder_linux.c __liDrain 740---------------

最近编辑记录 vip888888 (2021-03-19 17:09:32)

离线

#18 2021-07-08 14:55:48

robit
会员
注册时间: 2021-07-07
已发帖子: 1
积分: 0.5

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

跟着做我跑起来了测试视频bad_apple.mp4
但我换成别的视频就会显示Caught SIGSEGV

debug  : omx_vdec <AwOmxVdecPortPopBuffer:393>:*******port pop buffer:>>>>>>>out
debug  : omx_vdec <__AwOmxVdecUseBuffer:1661>:PortIndex[1], nSizeBytes[368640], pBuffer[0xb0dc2060]
debug  : omx_vdec <__AwOmxVdecUseBuffer:1682>:pPortDef[1]->bEnabled=0, m_state=OMX_StateExecuting, can allocate_buffer.
debug  : omx_vdec <AwOmxVdecPortPopBuffer:393>:*******port pop buffer:>>>>>>>out
debug  : omx_thread <OmxThread_resume:246>:++++++++++resume, drain
Caught SIGSEGV
exec gdb failed: No such file or directory
Spinning.  Please run 'gdb gst-launch-1.0 229' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.
^Chandling interrupt.
Interrupt: Stopping pipeline ...
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
debug  : omx_thread <OmxThread_suspend:220>:++++++++++suspend, drain

有遇到一样情况的吗,一直没找到原因

离线

楼主 #19 2021-08-13 16:51:09

逸俊晨晖
会员
注册时间: 2018-08-29
已发帖子: 151
积分: 137.5

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

18楼的问题已修复 修复了两个问题
1.字节对齐问题
        就是https://whycan.com/t_6139.html里说的 “并且分辨率: 32的整数倍* 32的整数倍 偏离一个像素都可能导致错误。”
        现在分辨率不是32整数倍的视频也可以正常播放了
2.颜色错误问题
        测试其他视频发现颜色不对 现已修复

测试镜像:
F1C200s主线gstreamer使用openmax调用cedar硬解码附件20210813.zip
下楼改源文件修复问题

离线

楼主 #20 2021-08-13 16:57:06

逸俊晨晖
会员
注册时间: 2018-08-29
已发帖子: 151
积分: 137.5

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

在buildroot进入目录output/build/libcedarc-master

cd output/build/libcedarc-master

修改源文件omx_vdec_aw_decoder_linux.c

vim openmax/vdec/src/omx_vdec_aw_decoder_linux.c

在结构体类型typedef struct OmxAwDecoderContext增加以下成员

int                    tWidth;
int                    tHeight;


#if (ENABLE_SCALEDOWN_WHEN_RESOLUTION_MOER_THAN_1080P)
    if (pCtx->mStreamInfo.nWidth > 1920
        && pCtx->mStreamInfo.nHeight > 1088)
    {
        pCtx->mVideoConfig.bScaleDownEn = 1;
        pCtx->mVideoConfig.nHorizonScaleDownRatio = 1;
        pCtx->mVideoConfig.nVerticalScaleDownRatio = 1;
    }
#endif
下面添加

        pCtx->tWidth = pCtx->mStreamInfo.nWidth;
        pCtx->tHeight = pCtx->mStreamInfo.nHeight;
        pCtx->mStreamInfo.nWidth = (pCtx->mStreamInfo.nWidth + 31) & ~31;
        pCtx->mStreamInfo.nHeight = (pCtx->mStreamInfo.nHeight + 31) & ~31;

在函数
static int __liCallback(OmxDecoder* pDec, DecoderCallback callback,
                                    void* pUserData)
上面添加一个函数

static int yv12_align_fill(char* p_dst, int w, int h, int aw, int ah)
{
	int i, j;
	int map = aw * ah;
	int v_size = (map) >> 2;
	char *pv = p_dst + map;
	char *pu = pv + v_size;//  / 4

	int dw = aw - w;
	int dh = ah -h;
	int dw_h = dw / 2;
	int dh_h = dh / 2;
	int w_h = w / 2;
	int h_h = h / 2;
	int aw_h = aw / 2;
	int ah_h = ah / 2;
	int map_oft = aw_h * h_h;
	
	if((w == aw) && (h == ah))
		return 0;


	for(i=0;i<h_h;i++)
	{
		for(j=0;j<dw_h;j++)
		{
			pv[w_h + j + aw_h * i] = 128;
			pu[w_h + j + aw_h * i] = 128;
		}

	}
	

	for(i=0;i<dh_h;i++)
	{
		for(j=0;j<aw_h;j++)
		{
			pv[map_oft + j + aw_h * i] = 128;
			pu[map_oft + j + aw_h * i] = 128;
		}
		
	}

	return 0;
}

在函数__liDrain中
RotatePicture(pCtx->decMemOps, pCtx->pPicture, &pCtx->CvtPicture, 0, 32, 32);
的下面添加

yv12_align_fill(pCtx->CvtPicture.pData0, pCtx-> tWidth, pCtx-> tWidth, pCtx->mStreamInfo.nWidth, pCtx->mStreamInfo.nHeight);

保存退出

修改源文件pixel_format.c

vim vdecoder/pixel_format.c

把函数
MB32_CVT_YV12
替换成

static void MB32_CVT_YV12(char* pSrc, char* pSrc_v, char* pDst, int nWidth, int nHeight)
{
	int i = 0;
	int j = 0;
	int m = 0;
	int n = 0;
	int k = 0;
	int nMbWidth = 0;
	int nMbHeight = 0;
	int nMbWidth_uv = 0;
	int nMbHeight_uv = 0;
	int nLineStride = 0;
	int nLineStride_uv = 0;
	int lineNum = 0;
	int lineNum_uv = 0;
	int offset = 0;
	int offset_uv = 0;
	int maxNum = 0;
	char* ptr = NULL;
	char* ptr_uv = NULL;
	char* pDstU = NULL;
	char* pDstV = NULL;
	int nWidth_uv = 0;
	int nHeight_uv = 0;
	char bufferY[32];
	char bufferV[16], bufferU[16];
	int nWidthMatchFlag = 0;
	int nWidthMatchFlag_uv = 0;
	int nCopyMbWidth = 0;
	int nCopyMbWidth_uv = 0;
	char *dstAsm = NULL;
	char *dst0Asm = NULL;
	char *dst1Asm = NULL;
	char *srcAsm = NULL;
	char *srcAsm_uv = NULL;

	int bCnt2 = 1;

	nLineStride = (nWidth + 15) &~15;
	nMbWidth = (nWidth + 31)&~31;
	nMbWidth >>= 5;//n 32 width   / 32

	nMbHeight = (nHeight + 31)&~31;
	nMbHeight >>= 5;// / 32
	ptr = pSrc;

	nWidthMatchFlag = 0;
	nCopyMbWidth = nMbWidth - 1;

	nWidth_uv = (nWidth + 1) / 2;
	nHeight_uv = (nHeight + 1) / 2;

	nLineStride_uv = (nWidth_uv + 7)&~7;

	nMbWidth_uv = (nWidth_uv * 2 + 31)&~31;
	nMbWidth_uv >>= 5;// / 32

	nMbHeight_uv = (nHeight_uv + 31)&~31;
	nMbHeight_uv >>= 5;// / 32
	ptr_uv = pSrc_v;
	pDstU = pDst + (nWidth * nHeight) + (nWidth / 2 * nHeight / 2);
	pDstV = pDst + (nWidth * nHeight);
	nWidthMatchFlag_uv = 0;
	nCopyMbWidth_uv = nMbWidth_uv - 1;

	if ((nMbWidth << 5) == nLineStride)// * 32
	{
		nWidthMatchFlag = 1;
		nCopyMbWidth = nMbWidth;
	}

	if ((nMbWidth_uv << 4) == nLineStride_uv)//*16
	{
		nWidthMatchFlag_uv = 1;
		nCopyMbWidth_uv = nMbWidth_uv;

	}

	for (i = 0; i < nMbHeight; i++)
	{
		for (j = 0; j < nCopyMbWidth; j++)
		{
			for (m = 0; m < 32; m++)
			{
				if (((i << 5) + m) >= nHeight)// * 32
				{
					ptr += 32;
					continue;
				}
				srcAsm = ptr;
				lineNum = (i << 5) + m;           //line num      * 32
				offset = lineNum * nLineStride + (j << 5);// * 32
				dstAsm = pDst + offset;

				memcpy(dstAsm, srcAsm, 32);

				if (bCnt2)
				{
					srcAsm_uv = ptr_uv;
					lineNum_uv = (i << 4) + m;           //line num i / 2 * 32
					offset_uv = lineNum_uv * nLineStride_uv + (j << 4);// * 16
					dst0Asm = pDstU + offset_uv;
					dst1Asm = pDstV + offset_uv;

					//memcpy(dst0Asm, srcAsm_uv, 16);
					//memcpy(dst1Asm, (void *)(srcAsm_uv + 16), 16);
					dst0Asm[0] = srcAsm_uv[0];
					dst0Asm[1] = srcAsm_uv[2];
					dst0Asm[2] = srcAsm_uv[4];
					dst0Asm[3] = srcAsm_uv[6];
					dst0Asm[4] = srcAsm_uv[8];
					dst0Asm[5] = srcAsm_uv[10];
					dst0Asm[6] = srcAsm_uv[12];
					dst0Asm[7] = srcAsm_uv[14];
				
					dst0Asm[8] = srcAsm_uv[16];
					dst0Asm[9] = srcAsm_uv[18];
					dst0Asm[10] = srcAsm_uv[20];
					dst0Asm[11] = srcAsm_uv[22];
					dst0Asm[12] = srcAsm_uv[24];
					dst0Asm[13] = srcAsm_uv[26];
					dst0Asm[14] = srcAsm_uv[28];
					dst0Asm[15] = srcAsm_uv[30];

					dst1Asm[0] = srcAsm_uv[1];
					dst1Asm[1] = srcAsm_uv[3];
					dst1Asm[2] = srcAsm_uv[5];
					dst1Asm[3] = srcAsm_uv[7];
					dst1Asm[4] = srcAsm_uv[9];
					dst1Asm[5] = srcAsm_uv[11];
					dst1Asm[6] = srcAsm_uv[13];
					dst1Asm[7] = srcAsm_uv[15];

					dst1Asm[8] = srcAsm_uv[17];
					dst1Asm[9] = srcAsm_uv[19];
					dst1Asm[10] = srcAsm_uv[21];
					dst1Asm[11] = srcAsm_uv[23];
					dst1Asm[12] = srcAsm_uv[25];
					dst1Asm[13] = srcAsm_uv[27];
					dst1Asm[14] = srcAsm_uv[29];
					dst1Asm[15] = srcAsm_uv[31];

					ptr_uv += 32;
				}
				ptr += 32;
			}
		}
		
		if (nWidthMatchFlag != 1)
		{
			for (m = 0; m < 32; m++)
			{
				if (((i << 5) + m) >= nHeight)// * 32
				{
					ptr += 32;
					continue;
				}
				dstAsm = bufferY;
				srcAsm = ptr;
				lineNum = (i << 5) + m;           //line num   * 32
				offset = lineNum * nLineStride + (j << 5);// * 32

				memcpy(dstAsm, srcAsm, 32);
				ptr += 32;
				for (k = 0; k < 32; k++)
				{
					if ((j * 32 + k) >= nLineStride)
					{
						break;
					}
					pDst[offset + k] = bufferY[k];
				}
			}
		}
		
		if (bCnt2) {
			if (nWidthMatchFlag_uv != 1)
			{
				for (m = 0; m < 32; m++)
				{
					if (((i << 4) + m) >= nHeight_uv)//i / 2 * 32
					{
						ptr_uv += 32;
						continue;
					}

					srcAsm_uv = ptr_uv;
					lineNum_uv = (i << 4) + m;           //line num i / 2 * 32
					offset = lineNum_uv * nLineStride_uv + (j << 4);// * 16
					dst0Asm = bufferU;
					dst1Asm = bufferV;

					//memcpy(dst0Asm, srcAsm, 16);
					//memcpy(dst1Asm, (char *)(srcAsm + 16), 16);
					dst0Asm[0] = srcAsm_uv[0];
					dst0Asm[1] = srcAsm_uv[2];
					dst0Asm[2] = srcAsm_uv[4];
					dst0Asm[3] = srcAsm_uv[6];
					dst0Asm[4] = srcAsm_uv[8];
					dst0Asm[5] = srcAsm_uv[10];
					dst0Asm[6] = srcAsm_uv[12];
					dst0Asm[7] = srcAsm_uv[14];
				
					dst0Asm[8] = srcAsm_uv[16];
					dst0Asm[9] = srcAsm_uv[18];
					dst0Asm[10] = srcAsm_uv[20];
					dst0Asm[11] = srcAsm_uv[22];
					dst0Asm[12] = srcAsm_uv[24];
					dst0Asm[13] = srcAsm_uv[26];
					dst0Asm[14] = srcAsm_uv[28];
					dst0Asm[15] = srcAsm_uv[30];

					dst1Asm[0] = srcAsm_uv[1];
					dst1Asm[1] = srcAsm_uv[3];
					dst1Asm[2] = srcAsm_uv[5];
					dst1Asm[3] = srcAsm_uv[7];
					dst1Asm[4] = srcAsm_uv[9];
					dst1Asm[5] = srcAsm_uv[11];
					dst1Asm[6] = srcAsm_uv[13];
					dst1Asm[7] = srcAsm_uv[15];

					dst1Asm[8] = srcAsm_uv[17];
					dst1Asm[9] = srcAsm_uv[19];
					dst1Asm[10] = srcAsm_uv[21];
					dst1Asm[11] = srcAsm_uv[23];
					dst1Asm[12] = srcAsm_uv[25];
					dst1Asm[13] = srcAsm_uv[27];
					dst1Asm[14] = srcAsm_uv[29];
					dst1Asm[15] = srcAsm_uv[31];
					ptr_uv += 32;

					for (k = 0; k < 16; k++)
					{
						if (((j << 4) + k) >= nLineStride_uv)// j * 16
						{
							break;
						}
						pDstV[offset + k] = bufferV[k];
						pDstU[offset + k] = bufferU[k];
					}
				}
			}
		}
		bCnt2 = !bCnt2;
	}
}

保存退出

清除libcedarc之前的编译文件

make clean

清除buildroot对于libcedarc的编译标记

rm .stamp_built

回到buildroot目录

cd ../../../ 

编译

make

这样源文件的修改就完成了

离线

#21 2021-08-16 21:13:30

hoel
会员
注册时间: 2019-06-15
已发帖子: 87
积分: 31

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

标准显示器 480x320 或 800x480 可以达到的最佳帧速率是多少?

最近编辑记录 hoel (2021-08-16 21:27:46)

离线

#22 2021-08-20 03:27:54

hoel
会员
注册时间: 2019-06-15
已发帖子: 87
积分: 31

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

@逸俊晨晖

你介意分享当前版本的来源吗? 所以我们可以直接从那里开始

最近编辑记录 hoel (2021-08-20 03:50:47)

离线

#23 2021-10-03 00:06:41

kang
会员
注册时间: 2021-08-05
已发帖子: 6
积分: 9.5

Re: F1C200s主线gstreamer使用openmax调用cedar硬解码

修改了源码重新编译下载,并替换了注册文件注后,还是无法使用,能帮我看下吗?

# gst-launch-1.0 filesrc location=bad_apple.mp4 ! qtdemux ! h264parse ! omxh264d
ec ! autovideoconvert ! fbdevsink
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstOMXH264Dec-omxh264dec:omxh264dec-omxh264dec0: Could not initialize supporting library.
Additional debug info:
../gst-libs/gst/video/gstvideodecoder.c(2517): gst_video_decoder_change_state (): /GstPipeline:pipeline0/GstOMXH264Dec-omxh264dec:omxh264dec-omxh264dec0:
Failed to open decoder
Setting pipeline to NULL ...
Freeing pipeline ...

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn