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

📄 rle_kc.i

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








#line 2 "D:\\working\\im_apps\\h264\\rle_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 mb_encode(istream<byte4> datain,
                 istream<half2> consts,
                 ostream<half2> color_out,
                 ostream<half2> dct_out,
                 costream<int> out);
;





#decl me_fast(istream<ubyte4> row0,
               istream<ubyte4> row1,
               istream<ubyte4> row2,
               istream<ubyte4> mblocks,
               costream<half2> motions_out,
               ostream<ubyte4> refyblks,
               ostream<uint>   crcbindices,
               uc<int>& uc_margin,
               uc<int>& uc_offsets,
               uc<int>& uc_mblks,
               uc<int>& uc_mb_width);
;


#decl me_fast_search4(istream<ubyte4> row0,
                       istream<ubyte4> row1,
                       istream<ubyte4> row2,
                       istream<ubyte4> mblocks,
                       costream<half2> motions_out,
                       uc<int>& uc_margin,
                       uc<int>& uc_mblks);
;


#decl me_fast_jitter2(istream<ubyte4> row0,
                       istream<ubyte4> row1,
                       istream<ubyte4> row2,
                       istream<ubyte4> mblocks,
                       cistream<half2> motions_in,
                       costream<half2> motions_out,
                       uc<int>& uc_margin,
                       uc<int>& uc_mblks);
;


#decl me_fast_jitter1(istream<ubyte4> row0,
                       istream<ubyte4> row1,
                       istream<ubyte4> row2,
                       istream<ubyte4> mblocks,
                       cistream<half2> motions_in,
                       costream<half2> motions_out,
                       ostream<ubyte4> refyblks,
                       ostream<uint>   crcbindices,
                       uc<int>& uc_margin,
                       uc<int>& uc_offsets,
                       uc<int>& uc_mblks,
                       uc<int>& uc_mb_width);
;






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




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

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






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

;













kernel rle(istream<half2> Yin,
           istream<half2> CrCbin,
           istream<int> indices,
           cistream<half2> motion,
           costream<half2> out,
           uc<uint>& pframe,
           uc<uint>& quant_scale)
{
  uint clzero = uint(cid() == 0);
  uint pfm = commclperm(0x8, 0, pframe);
  cc Iframe = itocc(clzero & ~(pfm));
  cc Pframe = itocc(clzero & pfm);
  cc clust_zero = itocc(clzero);     
  cc ccend;  

  uc<int> perm_1 = 0x75643120;
  uc<int> perm_2 = 0x67451320;
  uc<int> perm_3 = 0x75261430;
  uc<int> perm_4 = 0x57362401;
  uc<int> perm_5 = 0x74352601;
  uc<int> perm_6 = 0x64270531;
  uc<int> perm_7 = 0x63170542;

  expand<int> store_idx(8), send_idx(8);
  indices >> send_idx[0];
  indices >> store_idx[0];
  indices >> send_idx[1];
  indices >> store_idx[1];
  indices >> send_idx[2];
  indices >> store_idx[2];
  indices >> send_idx[3];
  indices >> store_idx[3];
  indices >> send_idx[4];
  indices >> store_idx[4];
  indices >> send_idx[5];
  indices >> store_idx[5];
  indices >> send_idx[6];
  indices >> store_idx[6];
  indices >> send_idx[7];
  indices >> store_idx[7];

  
  uc<int> perm_a = 0x07654321;
  uc<int> perm_b = 0x10765432;
  uc<int> perm_c = 0x21076543;
  uc<int> perm_d = 0x32107654;
  uc<int> perm_e = 0x43210765;
  uc<int> perm_f = 0x54321076;
  uc<int> perm_g = 0x65432107;

  

  loop_stream(Yin) {

    
    
    
    
    
    
    
    
    
    
    

    send_idx[0]  %= send_idx[0];
    store_idx[0] %= store_idx[0];
    send_idx[1]  %= send_idx[1];
    store_idx[1] %= store_idx[1];
    send_idx[2]  %= send_idx[2];
    store_idx[2] %= store_idx[2];
    send_idx[3]  %= send_idx[3];
    store_idx[3] %= store_idx[3];
    send_idx[4]  %= send_idx[4];
    store_idx[4] %= store_idx[4];
    send_idx[5]  %= send_idx[5];
    store_idx[5] %= store_idx[5];
    send_idx[6]  %= send_idx[6];
    store_idx[6] %= store_idx[6];
    send_idx[7]  %= send_idx[7];
    store_idx[7] %= store_idx[7];

    array<half2> Y4Y3(8), Y2Y1(8), CrCb(8);
    half2 tmp;
    Yin >> tmp; Y2Y1[0] = tmp; 
    Yin >> tmp; Y2Y1[1] = tmp;
    Yin >> tmp; Y2Y1[2] = tmp; 
    Yin >> tmp; Y2Y1[3] = tmp;
    Yin >> tmp; Y2Y1[4] = tmp; 
    Yin >> tmp; Y2Y1[5] = tmp;
    Yin >> tmp; Y2Y1[6] = tmp; 
    Yin >> tmp; Y2Y1[7] = tmp;
    Yin >> tmp; Y4Y3[0] = tmp; 
    Yin >> tmp; Y4Y3[1] = tmp;
    Yin >> tmp; Y4Y3[2] = tmp; 
    Yin >> tmp; Y4Y3[3] = tmp;
    Yin >> tmp; Y4Y3[4] = tmp; 
    Yin >> tmp; Y4Y3[5] = tmp;
    Yin >> tmp; Y4Y3[6] = tmp; 
    Yin >> tmp; Y4Y3[7] = tmp;
    CrCbin >> tmp; CrCb[0] = tmp; CrCbin >> tmp; CrCb[1] = tmp;
    CrCbin >> tmp; CrCb[2] = tmp; CrCbin >> tmp; CrCb[3] = tmp;
    CrCbin >> tmp; CrCb[4] = tmp; CrCbin >> tmp; CrCb[5] = tmp;
    CrCbin >> tmp; CrCb[6] = tmp; CrCbin >> tmp; CrCb[7] = tmp;

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    array<int> zigzag(24);   

    zigzag[0+store_idx[0]] = int(Y2Y1[send_idx[0]]);
    zigzag[8+store_idx[0]] = int(Y4Y3[send_idx[0]]);
    zigzag[16+store_idx[0]] = int(CrCb[send_idx[0]]);

    zigzag[0+store_idx[1]] =  int(commucperm(perm_1, Y2Y1[send_idx[1]]));
    zigzag[8+store_idx[1]] = int(commucperm(perm_1, Y4Y3[send_idx[1]]));
    zigzag[16+store_idx[1]] = int(commucperm(perm_1, CrCb[send_idx[1]]));

    zigzag[0+store_idx[2]] =  int(commucperm(perm_2, Y2Y1[send_idx[2]]));
    zigzag[8+store_idx[2]] = int(commucperm(perm_2, Y4Y3[send_idx[2]]));
    zigzag[16+store_idx[2]] = int(commucperm(perm_2, CrCb[send_idx[2]]));

    zigzag[0+store_idx[3]] =  int(commucperm(perm_3, Y2Y1[send_idx[3]]));
    zigzag[8+store_idx[3]] = int(commucperm(perm_3, Y4Y3[send_idx[3]]));
    zigzag[16+store_idx[3]] = int(commucperm(perm_3, CrCb[send_idx[3]]));

    zigzag[0+store_idx[4]] =  int(commucperm(perm_4, Y2Y1[send_idx[4]]));
    zigzag[8+store_idx[4]] = int(commucperm(perm_4, Y4Y3[send_idx[4]]));
    zigzag[16+store_idx[4]] = int(commucperm(perm_4, CrCb[send_idx[4]]));

    zigzag[0+store_idx[5]] =  int(commucperm(perm_5, Y2Y1[send_idx[5]]));
    zigzag[8+store_idx[5]] = int(commucperm(perm_5, Y4Y3[send_idx[5]]));
    zigzag[16+store_idx[5]] = int(commucperm(perm_5, CrCb[send_idx[5]]));

    zigzag[0+store_idx[6]] =  int(commucperm(perm_6, Y2Y1[send_idx[6]]));
    zigzag[8+store_idx[6]] = int(commucperm(perm_6, Y4Y3[send_idx[6]]));

⌨️ 快捷键说明

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