• 大小: 12.39MB
    文件类型: .rar
    金币: 2
    下载: 0 次
    发布日期: 2024-02-04
  • 语言: 其他
  • 标签: Qt  FFmpeg  H.264  H264  解码  

资源简介

详见我的博客:http://blog.csdn.net/caoshangpa/article/details/51953208

资源截图

代码片段和文件信息

#include “ch264decoder.h“
#include 

CH264Decoder::CH264Decoder()
{
    createYUVTab_16();
}

CH264Decoder::~CH264Decoder()
{
    deleteYUVTab();
}

void CH264Decoder::deleteYUVTab()
{
    av_free(colortab);
    av_free(rgb_2_pix);
}

void CH264Decoder::createYUVTab_16()
{
    int i;
    int u v;

    colortab = (int *)av_malloc(4*256*sizeof(int));
    u_b_tab = &colortab[0*256];
    u_g_tab = &colortab[1*256];
    v_g_tab = &colortab[2*256];
    v_r_tab = &colortab[3*256];

    for (i=0; i<256; i++)
    {
        u = v = (i-128);

        u_b_tab[i] = (int) ( 1.772 * u);
        u_g_tab[i] = (int) ( 0.34414 * u);
        v_g_tab[i] = (int) ( 0.71414 * v);
        v_r_tab[i] = (int) ( 1.402 * v);
    }

    rgb_2_pix = (unsigned int *)av_malloc(3*768*sizeof(unsigned int));

    r_2_pix = &rgb_2_pix[0*768];
    g_2_pix = &rgb_2_pix[1*768];
    b_2_pix = &rgb_2_pix[2*768];

    for(i=0; i<256; i++)
    {
        r_2_pix[i] = 0;
        g_2_pix[i] = 0;
        b_2_pix[i] = 0;
    }

    for(i=0; i<256; i++)
    {
        r_2_pix[i+256] = (i & 0xF8) << 8;
        g_2_pix[i+256] = (i & 0xFC) << 3;
        b_2_pix[i+256] = (i ) >> 3;
    }

    for(i=0; i<256; i++)
    {
        r_2_pix[i+512] = 0xF8 << 8;
        g_2_pix[i+512] = 0xFC << 3;
        b_2_pix[i+512] = 0x1F;
    }

    r_2_pix += 256;
    g_2_pix += 256;
    b_2_pix += 256;
}

void CH264Decoder::displayYUV_16(unsigned int *pdst unsigned char *y unsigned char *u unsigned char *v int width int height int src_ystride int src_uvstride int dst_ystride)
{
    int i j;
    int r g b rgb;

    int yy ub ug vg vr;

    unsigned char* yoff;
    unsigned char* uoff;
    unsigned char* voff;

    int width2 = width/2;
    int height2 = height/2;

    for(j=0; j    {
        yoff = y + j * 2 * src_ystride;
        uoff = u + j * src_uvstride;
        voff = v + j * src_uvstride;

        for(i=0; i        {
            yy  = *(yoff+(i<<1));
            ub = u_b_tab[*(uoff+i)];
            ug = u_g_tab[*(uoff+i)];
            vg = v_g_tab[*(voff+i)];
            vr = v_r_tab[*(voff+i)];

            b = yy + ub;
            g = yy - ug - vg;
            r = yy + vr;

            rgb = r_2_pix[r] + g_2_pix[g] + b_2_pix[b];

            yy = *(yoff+(i<<1)+1);
            b = yy + ub;
            g = yy - ug - vg;
            r = yy + vr;

            pdst[(j*dst_ystride+i)] = (rgb)+((r_2_pix[r] + g_2_pix[g] + b_2_pix[b])<<16);

            yy = *(yoff+(i<<1)+src_ystride);
            b = yy + ub;
            g = yy - ug - vg;
            r = yy + vr;

            rgb = r_2_pix[r] + g_2_pix[g] + b_2_pix[b];

            yy = *(yoff+(i<<1)+src_ystride+1);
            b = yy + ub;
            g = yy - ug - vg;
            r = yy + vr;

            pdst [((2*j+1)*dst_ystride+i*2)>>1] = (rgb)+((r_2_pix[r] + g_2_pix[g] + b_2_pix[b])<<

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

     文件       4754  2016-07-19 10:35  H264PlaybaseFFmpeg\ch264decoder.cpp

     文件       2770  2016-07-19 09:58  H264PlaybaseFFmpeg\ch264decoder.h

     文件   11217934  2016-01-16 16:49  H264PlaybaseFFmpeg\debug\avcodec-57.dll

     文件     141326  2016-01-16 16:49  H264PlaybaseFFmpeg\debug\avdevice-57.dll

     文件    1313294  2016-01-16 16:49  H264PlaybaseFFmpeg\debug\avfilter-6.dll

     文件    2294798  2016-01-16 16:49  H264PlaybaseFFmpeg\debug\avformat-57.dll

     文件     519694  2016-01-16 16:49  H264PlaybaseFFmpeg\debug\avutil-55.dll

     文件      95246  2016-01-16 16:49  H264PlaybaseFFmpeg\debug\swresample-2.dll

     文件     491022  2016-01-16 16:49  H264PlaybaseFFmpeg\debug\swscale-4.dll

     文件     176961  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\avcodec.h

     文件       2570  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\avdct.h

     文件       3111  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\avfft.h

     文件       2853  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\d3d11va.h

     文件       3337  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\dirac.h

     文件       3715  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\dv_profile.h

     文件       2358  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\dxva2.h

     文件       3763  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\qsv.h

     文件       4394  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\vaapi.h

     文件       5928  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\vda.h

     文件       7893  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\vdpau.h

     文件       7168  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\version.h

     文件       3913  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\videotoolbox.h

     文件       2356  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\vorbis_parser.h

     文件       6062  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavcodec\xvmc.h

     文件      17933  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavdevice\avdevice.h

     文件       1861  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavdevice\version.h

     文件      40356  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavfilter\avfilter.h

     文件        975  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavfilter\avfiltergraph.h

     文件       5322  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavfilter\buffersink.h

     文件       3875  2016-01-16 16:49  H264PlaybaseFFmpeg\include\libavfilter\buffersrc.h

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

评论

共有 条评论