資源簡介
詳見我的博客: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??H264Playba
?????文件???????2770??2016-07-19?09:58??H264Playba
?????文件???11217934??2016-01-16?16:49??H264Playba
?????文件?????141326??2016-01-16?16:49??H264Playba
?????文件????1313294??2016-01-16?16:49??H264Playba
?????文件????2294798??2016-01-16?16:49??H264Playba
?????文件?????519694??2016-01-16?16:49??H264Playba
?????文件??????95246??2016-01-16?16:49??H264Playba
?????文件?????491022??2016-01-16?16:49??H264Playba
?????文件?????176961??2016-01-16?16:49??H264Playba
?????文件???????2570??2016-01-16?16:49??H264Playba
?????文件???????3111??2016-01-16?16:49??H264Playba
?????文件???????2853??2016-01-16?16:49??H264Playba
?????文件???????3337??2016-01-16?16:49??H264Playba
?????文件???????3715??2016-01-16?16:49??H264Playba
?????文件???????2358??2016-01-16?16:49??H264Playba
?????文件???????3763??2016-01-16?16:49??H264Playba
?????文件???????4394??2016-01-16?16:49??H264Playba
?????文件???????5928??2016-01-16?16:49??H264Playba
?????文件???????7893??2016-01-16?16:49??H264Playba
?????文件???????7168??2016-01-16?16:49??H264Playba
?????文件???????3913??2016-01-16?16:49??H264Playba
?????文件???????2356??2016-01-16?16:49??H264Playba
?????文件???????6062??2016-01-16?16:49??H264Playba
?????文件??????17933??2016-01-16?16:49??H264Playba
?????文件???????1861??2016-01-16?16:49??H264Playba
?????文件??????40356??2016-01-16?16:49??H264Playba
?????文件????????975??2016-01-16?16:49??H264Playba
?????文件???????5322??2016-01-16?16:49??H264Playba
?????文件???????3875??2016-01-16?16:49??H264Playba
............此處省略110個文件信息
評論
共有 條評論