M_chenyang

M_chenyang

1个粉丝

14

问答

0

专栏

0

资料

M_chenyang  发布于  2016-07-19 16:36:55
采纳率 0%
14个问答
3564

VDEC解码通道属性获取

 
-----CHN ATTR & PARAMS-------------------------------------------------------
  ID  TYPE   Prior    MaxW    MaxH   Width  Height   StrmInputMode  Compress   STATE
   0  H265       5    2048    1536    1920    1080  STREAM/NOBLOCK         N   START


Width  Height  真正解码时解码通道的宽高有API可以获取吗?在手册里只找到获取 MaxW    MaxH的API。
我来回答
回答8个
时间排序
认可量排序

ngswfx

1个粉丝

55

问答

1

专栏

40

资料

ngswfx 2016-07-19 22:51:04
认可0
这的确是个问题。我也没找到相关接口。

估计海斯研发认为这个问题太简单,所以没做接口。

因为具体的寬高,数据流里面就有。只能通过对帧数据的解析获取寬高了。

ngswfx

1个粉丝

55

问答

1

专栏

40

资料

ngswfx 2016-07-20 00:44:44
认可0
本帖最后由 ngswfx 于 2016-7-20 00:46 编辑

[quote][url=forum.php?mod=redirect&goto=findpost&pid=34331&ptid=12009]ngswfx 发表于 2016-7-19 22:51[/url]
这的确是个问题。我也没找到相关接口。

估计海斯研发认为这个问题太简单,所以没做接口。
[/quote]

///////实际测试264可用:偏移4个字节,从0001后面开始。 265方法类似,可以百度。

[code]int _Width=0;
        int _Height=0;
        if(GetH264FrameWidthHeight((BYTE *)buff+4,(UINT)nLen,&_Width,&_Height)){
                printf("GetH264FrameWidth nLen:%d,Width:%d,Height:%d \n",nLen,_Width,_Height);
        }[/code]

[code]//////////////////////////////////////////////////////////////s
UINT Ue(BYTE *pBuff, UINT nLen, UINT &nStartBit)
{
    //计算0bit的个数
    UINT nZeroNum = 0;
    while (nStartBit < nLen * 8)
    {
        if (pBuff[nStartBit / 8] & (0x80 >> (nStartBit % 8))) //&:按位与,%取余
            break;
        nZeroNum++;
        nStartBit++;
    }
    nStartBit ++;
    //计算结果
    DWORD dwRet = 0;
    for (UINT i=0; i     {
        dwRet <<= 1;
        if (pBuff[nStartBit / 8] & (0x80 >> (nStartBit % 8)))
            dwRet += 1;
        nStartBit++;
    }
    return (1 << nZeroNum) - 1 + dwRet;
}
int Se(BYTE *pBuff, UINT nLen, UINT &nStartBit)
{
        int UeVal=Ue(pBuff,nLen,nStartBit);
        double k=UeVal;
        int nValue=ceil(k/2);////ceil函数:ceil函数的作用是求不小于给定实数的最小整数。ceil(2)=ceil(1.2)=cei(1.5)=2.00
        if (UeVal % 2==0)
                nValue=-nValue;
        return nValue;
}
DWORD u(UINT BitCount,BYTE * buf,UINT &nStartBit)
{
    DWORD dwRet = 0;
    for (UINT i=0; i     {
        dwRet <<= 1;
        if (buf[nStartBit / 8] & (0x80 >> (nStartBit % 8)))
            dwRet += 1;
        nStartBit++;
    }
    return dwRet;
}
bool GetH264FrameWidthHeight(BYTE * buf,UINT nLen,int *Width,int *Height)
{
        UINT StartBit=0;
        int forbidden_zero_bit=u(1,buf,StartBit);
        int nal_ref_idc=u(2,buf,StartBit);
        int nal_unit_type=u(5,buf,StartBit);
        if(nal_unit_type==7)
        {
                int profile_idc=u(8,buf,StartBit);
                int constraint_set0_flag=u(1,buf,StartBit);//(buf[1] & 0x80)>>7;
                int constraint_set1_flag=u(1,buf,StartBit);//(buf[1] & 0x40)>>6;
                int constraint_set2_flag=u(1,buf,StartBit);//(buf[1] & 0x20)>>5;
                int constraint_set3_flag=u(1,buf,StartBit);//(buf[1] & 0x10)>>4;
                int reserved_zero_4bits=u(4,buf,StartBit);
                int level_idc=u(8,buf,StartBit);
                int seq_parameter_set_id=Ue(buf,nLen,StartBit);
                if( profile_idc == 100 || profile_idc == 110 ||profile_idc == 122 || profile_idc == 144 )
                {
                        int chroma_format_idc=Ue(buf,nLen,StartBit);
                        if( chroma_format_idc == 3 )
                        int residual_colour_transform_flag=u(1,buf,StartBit);
                        int bit_depth_luma_minus8=Ue(buf,nLen,StartBit);
                        int bit_depth_chroma_minus8=Ue(buf,nLen,StartBit);
                        int qpprime_y_zero_transform_bypass_flag=u(1,buf,StartBit);
                        int seq_scaling_matrix_present_flag=u(1,buf,StartBit);
                        int seq_scaling_list_present_flag[8];
                        if( seq_scaling_matrix_present_flag )
                        {
                                for( int i = 0; i < 8; i++ )
                                        seq_scaling_list_present_flag=u(1,buf,StartBit);
                        }
                }
                int log2_max_frame_num_minus4=Ue(buf,nLen,StartBit);
                int pic_order_cnt_type=Ue(buf,nLen,StartBit);
                if( pic_order_cnt_type == 0 )
                        int log2_max_pic_order_cnt_lsb_minus4=Ue(buf,nLen,StartBit);
                else if( pic_order_cnt_type == 1 )
                {
                        int delta_pic_order_always_zero_flag=u(1,buf,StartBit);
                        int offset_for_non_ref_pic=Se(buf,nLen,StartBit);
                        int offset_for_top_to_bottom_field=Se(buf,nLen,StartBit);
                        int num_ref_frames_in_pic_order_cnt_cycle=Ue(buf,nLen,StartBit);
                        int *offset_for_ref_frame=new int[num_ref_frames_in_pic_order_cnt_cycle];
                        for( int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ )
                                offset_for_ref_frame=Se(buf,nLen,StartBit);
                        delete [] offset_for_ref_frame;
                }
                int num_ref_frames=Ue(buf,nLen,StartBit);
                int gaps_in_frame_num_value_allowed_flag=u(1,buf,StartBit);
                int pic_width_in_mbs_minus1=Ue(buf,nLen,StartBit);
                int pic_height_in_map_units_minus1=Ue(buf,nLen,StartBit);
                *Width=(pic_width_in_mbs_minus1+1)*16;
                *Height=(pic_height_in_map_units_minus1+1)*16;
                return true;
        }
        else
                return false;
}
[/code]

M_chenyang

1个粉丝

14

问答

0

专栏

0

资料

M_chenyang 2016-07-20 11:20:56
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=34331&ptid=12009]ngswfx 发表于 2016-7-19 22:51[/url]
这的确是个问题。我也没找到相关接口。

估计海斯研发认为这个问题太简单,所以没做接口。
[/quote]

那在vdec的信息又找得到,我觉得应当要有接口可以获取得到当前解码通道所解的分辨率。

3wnae

0个粉丝

9

问答

0

专栏

0

资料

3wnae 2016-07-23 09:42:21
认可0
直接打开  /proc/umap/vdec  文件解析就可以了。

ngswfx

1个粉丝

55

问答

1

专栏

40

资料

ngswfx 2016-07-23 12:02:02
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=34668&ptid=12009]3wnae 发表于 2016-7-23 09:42[/url]
直接打开  /proc/umap/vdec  文件解析就可以了。[/quote]

你有没有做这个解析的代码,我开始也想弄这个解析的,后来看看有点麻烦(显得不专业,而且怕海思改日志),所以没弄。

3wnae

0个粉丝

9

问答

0

专栏

0

资料

3wnae 2016-08-08 21:41:48
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=34679&ptid=12009]ngswfx 发表于 2016-7-23 12:02[/url]
你有没有做这个解析的代码,我开始也想弄这个解析的,后来看看有点麻烦(显得不专业,而且怕海思改日志) ...[/quote]

没有解析全部的。 我只解析了视频分辨率。其他我没去弄。 比较繁琐。

ngswfx

1个粉丝

55

问答

1

专栏

40

资料

ngswfx 2016-08-08 22:30:38
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=35732&ptid=12009]3wnae 发表于 2016-8-8 21:41[/url]
没有解析全部的。 我只解析了视频分辨率。其他我没去弄。 比较繁琐。[/quote]

分辨率也行呀,共享一下,我这里265还不支持呢。

M_chenyang

1个粉丝

14

问答

0

专栏

0

资料

M_chenyang 2016-08-09 09:56:04
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=35732&ptid=12009]3wnae 发表于 2016-8-8 21:41[/url]
没有解析全部的。 我只解析了视频分辨率。其他我没去弄。 比较繁琐。[/quote]

分享下,我也卡在这
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

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

Markdown 语法

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

举报类型

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

详细说明

易百纳技术社区