资源简介

H265是2013年提出的一项新的视频编解码技术,相比h264具有压缩率高的特点,对于高清视频占用更少的带宽,十分适合移动互联网的需求,该资源是在海思平台上实现H265解码的样例源码。

资源截图

代码片段和文件信息

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include “sample_comm.h“

#define hidebug(mesg args...) fprintf(stderr “[HiSample print:%s:%d:] “ mesg “\n“ __FILE__ __LINE__ ##args) 


typedef struct hiVDEC_USERPIC_S
{    
    HI_U32   u32PicWidth;
    HI_U32   u32PicHeigth;
    VB_POOL  u32PoolId;
    VB_BLK   u32BlkHandle;
    HI_U32   u32PhyAddr;
    HI_VOID  *pVirAddr;
}VDEC_USERPIC_S;

HI_VOID SAMPLE_VDEC_HandleSig(HI_S32 signo)
{
 HI_S32 i;
    if (SIGINT == signo || SIGTSTP == signo || SIGTERM == signo)
    { 
HI_MPI_SYS_Exit();
for(i=0;i {
HI_MPI_VB_ExitModCommPool(i);
}
for(i=0; i {
HI_MPI_VB_DestroyPool(i);
}
HI_MPI_VB_Exit();
        printf(“\033[0;31mprogram exit abnormally!\033[0;39m\n“);
    }
    exit(0);
}

int SAMPLE_COMM_VDEC_H265_SendStream( VdecThreadParam *pArgs)
{
    VdecThreadParam *pstVdecThreadParam =pArgs;
    FILE *fpStrm=NULL;
    HI_U8 *pu8Buf = NULL;
    VDEC_STREAM_S stStream;
    HI_BOOL bFindStart bFindEnd;
    HI_S32 s32Ret  i  start = 0;
    HI_S32 s32UsedBytes = 0 s32ReadLen = 0;
    HI_U64 u64pts = 0;
    HI_S32 len;
    HI_BOOL sHasReadStream = HI_FALSE; 

    if(pstVdecThreadParam->cFileName != 0)
    {
        fpStrm = fopen(pstVdecThreadParam->cFileName “rb“);
        if(fpStrm == NULL)
        {
            printf(“SAMPLE_TEST:can‘t open file %s in send stream thread:%d\n“pstVdecThreadParam->cFileName pstVdecThreadParam->s32ChnId);
            return HI_FAILURE;
        }
    }

    pu8Buf = malloc(pstVdecThreadParam->s32MinBufSize);
    if(pu8Buf == NULL)
    {
        printf(“SAMPLE_TEST:can‘t alloc %d in send stream thread:%d\n“ pstVdecThreadParam->s32MinBufSize pstVdecThreadParam->s32ChnId);
        fclose(fpStrm);
        return HI_FAILURE;
    }     
    fflush(stdout);

    u64pts = pstVdecThreadParam->u64PtsInit;
    while (1)
    {
        if (pstVdecThreadParam->eCtrlSinal == VDEC_CTRL_STOP)
        {
            break;
        }
        else if (pstVdecThreadParam->eCtrlSinal == VDEC_CTRL_PAUSE)
        {
            sleep(MIN2(pstVdecThreadParam->s32IntervalTime1000));
            continue;
        }

        if ( (pstVdecThreadParam->s32StreamMode==VIDEO_MODE_frame) && (pstVdecThreadParam->enType == PT_MP4VIDEO) )
        {
            bFindStart = HI_FALSE;  
            bFindEnd   = HI_FALSE;
            fseek(fpStrm s32UsedBytes SEEK_SET);
            s32ReadLen = fread(pu8Buf 1 pstVdecThreadParam->s32MinBufSize fpStrm);
            if (s32ReadLen == 0)
            {
                if (pstVdecThreadParam->bLoopSend)
                {
                    s32UsedBytes = 0;
                    fseek(fpStrm 0 SEEK_SET);
                    s32ReadLen = fread(pu8Buf 1 pstV

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件   32055676  2017-11-24 14:12  h265\1080P.h265

     文件     585912  2018-05-28 17:31  h265\h265\h265

     文件      25711  2018-08-02 20:29  h265\h265\h265.c

     文件      33640  2018-05-28 17:31  h265\h265\h265.o

     文件        885  2018-05-22 17:06  h265\h265\Makefile

     文件       8341  2017-11-24 14:12  h265\include\aacdec.h

     文件       5967  2017-11-24 14:12  h265\include\aacenc.h

     文件      13788  2017-11-24 14:12  h265\include\hifb.h

     文件       9268  2017-11-24 14:12  h265\include\hi_common.h

     文件       5463  2017-11-24 14:12  h265\include\hi_comm_adec.h

     文件       4876  2017-11-24 14:12  h265\include\hi_comm_aenc.h

     文件        879  2017-11-24 14:12  h265\include\hi_comm_ai.h

     文件      22042  2017-11-24 14:12  h265\include\hi_comm_aio.h

     文件        881  2017-11-24 14:12  h265\include\hi_comm_ao.h

     文件      56331  2017-11-24 14:12  h265\include\hi_comm_hdmi.h

     文件      13734  2017-11-24 14:12  h265\include\hi_comm_ive.h

     文件       9316  2017-11-24 14:12  h265\include\hi_comm_pciv.h

     文件      15289  2017-11-24 14:12  h265\include\hi_comm_rc.h

     文件      10019  2017-11-24 14:12  h265\include\hi_comm_region.h

     文件       3934  2017-11-24 14:12  h265\include\hi_comm_sys.h

     文件       3891  2017-11-24 14:12  h265\include\hi_comm_vb.h

     文件       9675  2017-11-24 14:12  h265\include\hi_comm_vda.h

     文件       9631  2017-11-24 14:12  h265\include\hi_comm_vdec.h

     文件      33488  2017-11-24 14:12  h265\include\hi_comm_venc.h

     文件       4905  2017-11-24 14:12  h265\include\hi_comm_vgs.h

     文件      21043  2017-11-24 14:12  h265\include\hi_comm_vi.h

     文件       9743  2017-11-24 14:12  h265\include\hi_comm_video.h

     文件      22985  2017-11-24 14:12  h265\include\hi_comm_vo.h

     文件       7384  2017-11-24 14:12  h265\include\hi_comm_vpss.h

     文件       4621  2017-11-24 14:12  h265\include\hi_debug.h

............此处省略53个文件信息

评论

共有 条评论