HashtagChn

HashtagChn

0个粉丝

1

问答

0

专栏

0

资料

HashtagChn  发布于  2017-08-21 15:48:34
采纳率 0%
1个问答
4975

Hi3536 HI_MPI_VDEC_GetImage

 
本帖最后由 HashtagChn 于 2017-8-21 16:27 编辑

Hello,
sorry i am French and i don't speak Chinese :shutup:
I am currently writting a software for HI3536 DVR and i am attempting to get decoded picture (RAW data) from vdec without using vpss. I have found the function HI_MPI_VDEC_GetImage, but each time i call it i have the fellowing error:
HI_ERR_VDEC_BUF_EMPTY.  

Here is the code i tried, i have inserted it on the line 297 of sample_vdec.c

[code]    VIDEO_FRAME_INFO_S *mImageHi;
    HI_S32 s32BlockMode = HI_IO_BLOCK;
    if(stVdecSend->s32ChnId==0 && s32BlockMode == HI_IO_BLOCK){
        printf("Start getting image from vdec.\n");
        s32Ret = HI_MPI_VDEC_GetImage(stVdecSend->s32ChnId, mImageHi, s32BlockMode);

        if (s32Ret != HI_SUCCESS){

            SAMPLE_PRT("HI_MPI_VDEC_GetImage failed with %#x!\n", s32Ret);
        }
        else {
            printf("get image from vdec and release success.\n");
        }

    }[/code]

Can you help me please ?
Thanks you very much !
我来回答
回答11个
时间排序
认可量排序

HashtagChn

0个粉丝

1

问答

0

专栏

0

资料

HashtagChn 2017-08-22 19:41:58
认可0
本帖最后由 HashtagChn 于 2017-8-22 19:50 编辑

I finaly get it to work by putting it at line 327 of sample_vdec.c and by turning off VPSS and VO.

[code]Start getting image from vdec.
u32Height : 1080
u32Width : 1920
enPixelFormat : 23, PIXEL_FORMAT_YUV_SEMIPLANAR_420 : 23
enVideoFormat : 1, VIDEO_FORMAT_TILE : 1
u32PhyAddr[0] : 51245000
u32PhyAddr[1] : 51443000
u32PhyAddr[2] : 0
u32Stride[0] : 1920
u32Stride[1] : 1920
u32Stride[2] : 0
ptr1 : b0c09000
ptr2 : b4a02000
pVirAddr[0] : 0
pVirAddr[1] : 0
pVirAddr[2] : 0
Wrote !
get image from vdec and release success.
[/code]

Now, i get a virtual buffer by doing:

[code]HI_U8 *ptr1, *ptr2;

FILE *f=fopen("data.yuv","w");

HI_U32 Imagelen = mImageHi.stVFrame.u32Width * mImageHi.stVFrame.u32Height;

ptr1=HI_MPI_SYS_Mmap(mImageHi.stVFrame.u32PhyAddr[0], Imagelen);
//ptr2=HI_MPI_SYS_Mmap(mImageHi.stVFrame.u32PhyAddr[1], Imagelen/2);

fwrite(ptr1, Imagelen, 1, f);
//fwrite(ptr2, Imagelen/2, 1, f);

[/code]

but when i try to open the raw file with OpenCV i got something strange.

How can i read the picture that i have decoded ?



zhuangweiye

8个粉丝

0

问答

0

专栏

0

资料

zhuangweiye 2017-08-23 07:53:52
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=62775&ptid=23231]HashtagChn 发表于 2017-8-22 19:41[/url]
I finaly get it to work by putting it at line 327 of sample_vdec.c and by turning off VPSS and VO.
...[/quote]


enVideoFormat : 1, VIDEO_FORMAT_TILE : 1

typedef enum hiVIDEO_FORMAT_E
{
VIDEO_FORMAT_LINEAR = 0x0, /* nature video line */
VIDEO_FORMAT_TILE = 0x1, /* tile cell: 256pixel x 16line,default tile mode */
VIDEO_FORMAT_TILE64 = 0x2, /* tile cell: 64pixel x 16line */
VIDEO_FORMAT_BUTT
} VIDEO_FORMAT_E;

if enVideoFormat == VIDEO_FORMAT_LINEAR, your code is right

HashtagChn

0个粉丝

1

问答

0

专栏

0

资料

HashtagChn 2017-08-23 15:03:12
认可0
Thanks you !
How can i request get image to send me decoded picture with  enVideoFormat == VIDEO_FORMAT_LINEAR ?

zhuangweiye

8个粉丝

0

问答

0

专栏

0

资料

zhuangweiye 2017-08-23 15:16:43
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=62825&ptid=23231]HashtagChn 发表于 2017-8-23 15:03[/url]
Thanks you !
How can i request get image to send me decoded picture with  enVideoFormat == VIDEO_F ...[/quote]

you can try following steps

1. vdec bind vpss (user mode, HI_MPI_VPSS_SetChnMode())

2. get image by HI_MPI_VPSS_GetChnFrame()

HashtagChn

0个粉丝

1

问答

0

专栏

0

资料

HashtagChn 2017-08-23 18:04:13
认可0
本帖最后由 HashtagChn 于 2017-8-23 18:05 编辑

Thanks you very much  ! It works !
Now i am trying to get a RGB 888 picture in the output, but i have the fellowing error:
[code][SAMPLE_COMM_VPSS_Start]-162: HI_MPI_VPSS_SetChnMode failed with :0xa0078003
[/code]
Any idea of why ?

here is my code:
I placed it at line 148 of sample_comm_vpss.c
[code] s32Ret = HI_MPI_VPSS_GetChnMode(VpssGrp, VpssChn, &stVpssMode);
            if (s32Ret != HI_SUCCESS) {
                SAMPLE_PRT("HI_MPI_VPSS_GetChnMode failed with :%#x\n", s32Ret);
            }


            stVpssMode.enChnMode = VPSS_CHN_MODE_USER;
            stVpssMode.enPixelFormat = PIXEL_FORMAT_RGB_888;
            stVpssMode.u32Width = 1920;
            stVpssMode.u32Height = 1080;


            s32Ret = HI_MPI_VPSS_SetChnMode(VpssGrp, VpssChn, &stVpssMode);
            if (s32Ret != HI_SUCCESS) {
                SAMPLE_PRT("HI_MPI_VPSS_SetChnMode failed with :%#x\n", s32Ret);
            }[/code]

zhuangweiye

8个粉丝

0

问答

0

专栏

0

资料

zhuangweiye 2017-08-24 07:36:56
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=62843&ptid=23231]HashtagChn 发表于 2017-8-23 18:04[/url]
Thanks you very much  ! It works !
Now i am trying to get a RGB 888 picture in the output, but i h ...[/quote]


enPixelFormat should be SemiPlannar422 or SemiPlannar420

HashtagChn

0个粉丝

1

问答

0

专栏

0

资料

HashtagChn 2017-08-25 17:27:04
认可0
Hello ! Thanks you ! It's work !
Is there a way with VPSS to convert SemiPlanar422 to RGB_888 ?
thanks !

zhuangweiye

8个粉丝

0

问答

0

专栏

0

资料

zhuangweiye 2017-08-25 17:40:54
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=62983&ptid=23231]HashtagChn 发表于 2017-8-25 17:27[/url]
Hello ! Thanks you ! It's work !
Is there a way with VPSS to convert SemiPlanar422 to RGB_888 ?
t ...[/quote]

You can use IVE .

HI_MPI_IVE_CSC
[Description]
Creates a CSC task for implementing YUV2RGB/YUV2HSV/YUV2LAB/RGB2YUV conversion.

HashtagChn

0个粉丝

1

问答

0

专栏

0

资料

HashtagChn 2017-08-30 15:19:51
认可0
Hello,

Thanks you for your help !

tqingguang6688

0个粉丝

6

问答

0

专栏

1

资料

tqingguang6688 2019-01-16 15:26:43
认可0
@楼主,庄工,我也遇到用 HI_MPI_VDEC_GetImage 获取的YUV数据为模糊的图片,设置enVideoFormat == VIDEO_FORMAT_LINEAR 报错,[Info]: chan 0 enVideoFormat val 0 is not support! must be VIDEO_FORMAT_TILE,3536的板

hero

0个粉丝

1

问答

0

专栏

0

资料

hero 2017-08-23 15:31:15
认可0
:victory::victory::victory::victory::victory::victory::victory:
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
+ 添加网盘链接/附件

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

易百纳技术社区