⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 icolor_kc.i

📁 H.264完整的C语言代码和DCT的代码
💻 I
字号:
#line 1 "D:\\working\\im_apps\\h264\\icolor_kc.cpp"
#line 1 "D:/working/tools/isim/isimexe/blank_headers\\idb_kernelc.hpp"








#line 2 "D:\\working\\im_apps\\h264\\icolor_kc.cpp"
#line 1 "D:\\working\\im_apps\\h264\\mpeg.hpp"




#line 1 "D:/working/tools/isim/isimexe/blank_headers\\idb_types.hpp"













#line 6 "D:\\working\\im_apps\\h264\\mpeg.hpp"
#line 1 "D:/working/tools/isim/isimexe/blank_headers\\idb_deftypes.hpp"




#line 7 "D:\\working\\im_apps\\h264\\mpeg.hpp"

#decl idxGen(ostream<uint>   indices,
              uc<int>&        uc_size,
              uc<int>&        uc_params);
;


#decl icolor(istream<ubyte4> datain,
              ostream<half2> Yout,
              ostream<half2> CrCbout);
;


#decl pcolor(istream<ubyte4> datain,
              ostream<ubyte4> Yout,
              ostream<half2> CrCbout);
;


#decl dct(istream<half2> datain,
           istream<uhalf2> consts,
           ostream<half2> out,
           uc<uhalf2>& uc_quantizer_scale);
;


#decl idct(istream<half2> datain,
            istream<uhalf2> consts,
            ostream<half2> out,
            uc<half2>& uc_quantizer_scale);
;


#decl rle(istream<half2> Yin,
           istream<half2> CrCbin,
           istream<int> indices,
           cistream<half2> motion,
           costream<half2> out,
           uc<uint>& pframe,
           uc<uint>& quant_scale);
;


#decl difference(istream<ubyte4> curryblks,
                  istream<half2> currcblks,
                  istream<ubyte4> refyblks,
                  istream<half2> refcblks,
                  ostream<half2> diffyblks,
                  ostream<half2> diffcblks);
;


#decl correlate(istream<half2> diffyblks,
                 istream<half2> diffcblks,
                 istream<ubyte4> refyblks,
                 istream<half2> refcblks,
                 ostream<ubyte4> newrefyblks,
                 ostream<half2> newrefcblks,
                 uc<uint>& uc_pframe);
;


#decl MV2idx(cistream<half2> motion,      
              ostream<uint>   yindices,    
              ostream<uint>   crcbindices, 
              uc<int>&        uc_offsets,  
              uc<int>&        uc_mblks,    
              uc<int>&        uc_mb_width);
;


#decl blocksearch(istream<ubyte4> row0,
                   istream<ubyte4> row1,
                   istream<ubyte4> row2,
                   istream<ubyte4> mblocks,
                   costream<half2> motions,
                   uc<int>& location);
;


#decl mb_encode(istream<byte4> datain,
                 istream<half2> consts,
                 ostream<half2> color_out,
                 ostream<half2> dct_out,
                 costream<int> out);
;



#line 1 "D:/working/tools/isim/isimexe/blank_headers\\idb_undeftypes.hpp"




#line 97 "D:\\working\\im_apps\\h264\\mpeg.hpp"

#line 99 "D:\\working\\im_apps\\h264\\mpeg.hpp"
#line 3 "D:\\working\\im_apps\\h264\\icolor_kc.cpp"
#line 1 "D:/working/tools/isim/isimexe/blank_headers\\idb_kernelc2.hpp"






#line 4 "D:\\working\\im_apps\\h264\\icolor_kc.cpp"

;







































kernel icolor(istream<ubyte4> datain,
              ostream<half2> Yout,
              ostream<half2> CrCbout)
{
  
  cc low = itocc(cid() < 4);
  cc Y_combine = itocc(half2(0) == half2(1));   

  
  byte4 shuf_func1  = 0x08020800;           
  byte4 shuf_func2  = 0x08080801;           
  byte4 shuf_func3  = 0x01000100;           

  
  half2 RB_SCALE = 0x26460e98;         
  half2 G_SCALE  = 0x00004b23;         
  half2 C_SCALE  = 0x4fe33f35;         

  
  half2 one_two_eight = 0x00800080;


  
  
  
  
  uc<int> perm_a = 0x76546420;
  uc<int> perm_b = 0x64203210;

  
  loop_stream(datain) pipeline(1) {

    ubyte4 color1, color2, color3, color4;
    half2 first, second;
    half2 a1, a2, a3, a4, b1, b2, b3, b4, c1, c2, c3, c4, d1, d2, d3, d4;
    half2 e1, e2, e3, e4, a1a3, a2a4, y1, y2, y3, y4, z1, z2, z3, z4;
    half2 temp0, temp1, another0, another1, out00, out01, out10, out11;

    
    datain >> color1 >> color2 >> color3 >> color4;

    
    
    a1 = half2(shuffle(color1, shuf_func1));
    b1 = half2(shuffle(color1, shuf_func2));
    a2 = half2(shuffle(color2, shuf_func1));
    b2 = half2(shuffle(color2, shuf_func2));
    a3 = half2(shuffle(color3, shuf_func1));
    b3 = half2(shuffle(color3, shuf_func2));
    a4 = half2(shuffle(color4, shuf_func1));
    b4 = half2(shuffle(color4, shuf_func2));

    
    
    
    c1 = hi(mulrnd(RB_SCALE, shift(a1, 1)));
    c2 = hi(mulrnd(RB_SCALE, shift(a2, 1)));
    c3 = hi(mulrnd(RB_SCALE, shift(a3, 1)));
    c4 = hi(mulrnd(RB_SCALE, shift(a4, 1)));

    
    d1 = c1 + hi(mulrnd(G_SCALE, shift(b1, 1)));
    d2 = c2 + hi(mulrnd(G_SCALE, shift(b2, 1)));
    d3 = c3 + hi(mulrnd(G_SCALE, shift(b3, 1)));
    d4 = c4 + hi(mulrnd(G_SCALE, shift(b4, 1)));

    
    e1 = half2(shift(int(c1), -16));
    e2 = half2(shift(int(c2), -16));
    e3 = half2(shift(int(c3), -16));
    e4 = half2(shift(int(c4), -16));

    a1a3 = a1 + a3;
    a2a4 = a2 + a4;

    
    y1 = d1 + e1;
    y2 = d2 + e2;
    y3 = d3 + e3;
    y4 = d4 + e4;

    
    z1 = half2(shuffle(y1, shuf_func3));
    z2 = half2(shuffle(y2, shuf_func3));
    z3 = half2(shuffle(y3, shuf_func3));
    z4 = half2(shuffle(y4, shuf_func3));

    temp0 = select(Y_combine, z2, z1);
    temp1 = select(Y_combine, z4, z3);

    half2 Ymadj = 0x6d806d80;   
    half2 Yaadj = 0x00100010;   
    Yout << hi(mulrnd(Ymadj, shift(temp0, 1)))+Yaadj;
    Yout << hi(mulrnd(Ymadj, shift(temp1, 1)))+Yaadj;

    
    
    
    
    
    
    
    
    
    first = hi(mulrnd((a1a3 - (z1 + z3)), C_SCALE)) + one_two_eight;
    second = hi(mulrnd((a2a4 - (z2 + z4)), C_SCALE)) + one_two_eight;

    
    first = commucperm(perm_a, first);
    second = commucperm(perm_b, second);

    CrCbout << select(low, first, second);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -