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

📄 diff_kc.i

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








#line 2 "D:\\working\\im_apps\\h264\\diff_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\\diff_kc.cpp"
#line 1 "D:/working/tools/isim/isimexe/blank_headers\\idb_kernelc2.hpp"






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

;

















kernel difference(istream<ubyte4> curryblks,
                  istream<half2> currcblks,
                  istream<ubyte4> refyblks,
                  istream<half2> refcblks,
                  ostream<half2> diffyblks,
                  ostream<half2> diffcblks)
{
  
  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;

  
  int idx0 = cid();
  int idx1 = (idx0 - 1) & 7;
  int idx2 = (idx1 - 1) & 7;
  int idx3 = (idx2 - 1) & 7;
  int idx4 = (idx3 - 1) & 7;
  int idx5 = (idx4 - 1) & 7;
  int idx6 = (idx5 - 1) & 7;
  int idx7 = (idx6 - 1) & 7;

  
  byte4 b4_to_2h2 = 0x88138802;  
                                 
  byte4 h2_to_2lo = 0x88881302;  
                                 
  byte4 h2_to_2hi = 0x13028888;  
                                 

  cc merge = itocc(0x0000FFFFF);
                                   
  loop_stream(curryblks) pipeline(1) {
    expand<half2> currc(8);
    expand<half2> refc(8);
    expand<half2> diffc(8);

    currcblks >> currc[0];
    currcblks >> currc[1];
    currcblks >> currc[2];
    currcblks >> currc[3];
    currcblks >> currc[4];
    currcblks >> currc[5];
    currcblks >> currc[6];
    currcblks >> currc[7];
    refcblks  >> refc[0];
    refcblks  >> refc[1];
    refcblks  >> refc[2];
    refcblks  >> refc[3];
    refcblks  >> refc[4];
    refcblks  >> refc[5];
    refcblks  >> refc[6];
    refcblks  >> refc[7];

    expand<ubyte4> curry(8);
    expand<ubyte4> refy(8);

    curryblks >> curry[0];
    curryblks >> curry[1];
    curryblks >> curry[2];
    curryblks >> curry[3];
    curryblks >> curry[4];
    curryblks >> curry[5];
    curryblks >> curry[6];
    curryblks >> curry[7];
    refyblks  >> refy[0];
    refyblks  >> refy[1];
    refyblks  >> refy[2];
    refyblks  >> refy[3];
    refyblks  >> refy[4];
    refyblks  >> refy[5];
    refyblks  >> refy[6];
    refyblks  >> refy[7];

    diffc[0] = currc[0] - refc[0];
    diffc[1] = currc[1] - refc[1];
    diffc[2] = currc[2] - refc[2];
    diffc[3] = currc[3] - refc[3];
    diffc[4] = currc[4] - refc[4];
    diffc[5] = currc[5] - refc[5];
    diffc[6] = currc[6] - refc[6];
    diffc[7] = currc[7] - refc[7];

    diffcblks << diffc[0];
    diffcblks << diffc[1];
    diffcblks << diffc[2];
    diffcblks << diffc[3];
    diffcblks << diffc[4];
    diffcblks << diffc[5];
    diffcblks << diffc[6];
    diffcblks << diffc[7];

    array<half2> buf1(8), buf2(8);

    expand<half2> diffy(16);
    expand<half2> currlo(8), currhi(8), reflo(8), refhi(8);

    double<ubyte4> curr0, curr1, curr2, curr3, curr4, curr5, curr6, curr7;
    double<ubyte4> ref0, ref1, ref2, ref3, ref4, ref5, ref6, ref7;

    double<half2> d0, d1, d2, d3;

    
    curr0 = shuffled(curry[0], b4_to_2h2);
    curr1 = shuffled(curry[1], b4_to_2h2);
    curr2 = shuffled(curry[2], b4_to_2h2);
    curr3 = shuffled(curry[3], b4_to_2h2);
    curr4 = shuffled(curry[4], b4_to_2h2);
    curr5 = shuffled(curry[5], b4_to_2h2);
    curr6 = shuffled(curry[6], b4_to_2h2);
    curr7 = shuffled(curry[7], b4_to_2h2);

    currhi[0] = half2(hi(curr0));
    currhi[1] = half2(hi(curr1));
    currhi[2] = half2(hi(curr2));
    currhi[3] = half2(hi(curr3));
    currhi[4] = half2(hi(curr4));
    currhi[5] = half2(hi(curr5));
    currhi[6] = half2(hi(curr6));
    currhi[7] = half2(hi(curr7));

    currlo[0] = half2(lo(curr0));
    currlo[1] = half2(lo(curr1));
    currlo[2] = half2(lo(curr2));
    currlo[3] = half2(lo(curr3));
    currlo[4] = half2(lo(curr4));
    currlo[5] = half2(lo(curr5));
    currlo[6] = half2(lo(curr6));
    currlo[7] = half2(lo(curr7));

    
    ref0 = shuffled(refy[0],  b4_to_2h2);
    ref1 = shuffled(refy[1],  b4_to_2h2);
    ref2 = shuffled(refy[2],  b4_to_2h2);
    ref3 = shuffled(refy[3],  b4_to_2h2);
    ref4 = shuffled(refy[4],  b4_to_2h2);
    ref5 = shuffled(refy[5],  b4_to_2h2);
    ref6 = shuffled(refy[6],  b4_to_2h2);
    ref7 = shuffled(refy[7],  b4_to_2h2);

    refhi[0] = half2(hi(ref0));
    refhi[1] = half2(hi(ref1));
    refhi[2] = half2(hi(ref2));
    refhi[3] = half2(hi(ref3));
    refhi[4] = half2(hi(ref4));
    refhi[5] = half2(hi(ref5));
    refhi[6] = half2(hi(ref6));
    refhi[7] = half2(hi(ref7));

    reflo[0] = half2(lo(ref0));
    reflo[1] = half2(lo(ref1));
    reflo[2] = half2(lo(ref2));
    reflo[3] = half2(lo(ref3));
    reflo[4] = half2(lo(ref4));
    reflo[5] = half2(lo(ref5));
    reflo[6] = half2(lo(ref6));
    reflo[7] = half2(lo(ref7));

    diffy[0]  = currlo[0] - reflo[0];
    diffy[1]  = currhi[0] - refhi[0];
    diffy[2]  = currlo[1] - reflo[1];
    diffy[3]  = currhi[1] - refhi[1];
    diffy[4]  = currlo[2] - reflo[2];
    diffy[5]  = currhi[2] - refhi[2];
    diffy[6]  = currlo[3] - reflo[3];
    diffy[7]  = currhi[3] - refhi[3];
    diffy[8]  = currlo[4] - reflo[4];
    diffy[9]  = currhi[4] - refhi[4];
    diffy[10] = currlo[5] - reflo[5];
    diffy[11] = currhi[5] - refhi[5];
    diffy[12] = currlo[6] - reflo[6];
    diffy[13] = currhi[6] - refhi[6];
    diffy[14] = currlo[7] - reflo[7];
    diffy[15] = currhi[7] - refhi[7];

    
    d0 = shuffled(diffy[0], h2_to_2lo);
    d1 = shuffled(diffy[1], h2_to_2lo);

    
    d2 = shuffled(diffy[8], h2_to_2hi);
    d3 = shuffled(diffy[9], h2_to_2hi);
 
    buf1[0] = lo(d0) | lo(d2);
    buf1[1] = hi(d0) | hi(d2);
    buf1[2] = lo(d1) | lo(d3);
    buf1[3] = hi(d1) | hi(d3);

    
    
    
    

    
    d0 = shuffled(diffy[4], h2_to_2lo);
    d1 = shuffled(diffy[5], h2_to_2lo);

    
    d2 = shuffled(diffy[12], h2_to_2hi);
    d3 = shuffled(diffy[13], h2_to_2hi);

    buf1[4] = lo(d0) | lo(d2);
    buf1[5] = hi(d0) | hi(d2);
    buf1[6] = lo(d1) | lo(d3);
    buf1[7] = hi(d1) | hi(d3);

    
    
    
    

    
    buf2[idx0] = buf1[idx0];
    buf2[idx7] = commucperm(perm_a, buf1[idx1]);
    buf2[idx6] = commucperm(perm_b, buf1[idx2]);
    buf2[idx5] = commucperm(perm_c, buf1[idx3]);
    buf2[idx4] = commucperm(perm_d, buf1[idx4]);
    buf2[idx3] = commucperm(perm_e, buf1[idx5]);
    buf2[idx2] = commucperm(perm_f, buf1[idx6]);
    buf2[idx1] = commucperm(perm_g, buf1[idx7]);

    diffyblks << buf2[0];
    diffyblks << buf2[1];
    diffyblks << buf2[2];
    diffyblks << buf2[3];
    diffyblks << buf2[4];
    diffyblks << buf2[5];
    diffyblks << buf2[6];
    diffyblks << buf2[7];
    
    array<half2> buf3(8), buf4(8);

    
    d0 = shuffled(diffy[2], h2_to_2lo);
    d1 = shuffled(diffy[3], h2_to_2lo);

    
    d2 = shuffled(diffy[10], h2_to_2hi);
    d3 = shuffled(diffy[11], h2_to_2hi);

    buf3[0] = lo(d0) | lo(d2);
    buf3[1] = hi(d0) | hi(d2);
    buf3[2] = lo(d1) | lo(d3);
    buf3[3] = hi(d1) | hi(d3);

    
    
    
    

    
    d0 = shuffled(diffy[6], h2_to_2lo);
    d1 = shuffled(diffy[7], h2_to_2lo);

    
    d2 = shuffled(diffy[14], h2_to_2hi);
    d3 = shuffled(diffy[15], h2_to_2hi);

    buf3[4] = lo(d0) | lo(d2);
    buf3[5] = hi(d0) | hi(d2);
    buf3[6] = lo(d1) | lo(d3);
    buf3[7] = hi(d1) | hi(d3);

    
    
    
    

    
    buf4[idx0] = buf3[idx0];
    buf4[idx7] = commucperm(perm_a, buf3[idx1]);
    buf4[idx6] = commucperm(perm_b, buf3[idx2]);
    buf4[idx5] = commucperm(perm_c, buf3[idx3]);
    buf4[idx4] = commucperm(perm_d, buf3[idx4]);
    buf4[idx3] = commucperm(perm_e, buf3[idx5]);
    buf4[idx2] = commucperm(perm_f, buf3[idx6]);
    buf4[idx1] = commucperm(perm_g, buf3[idx7]);

    diffyblks << buf4[0];
    diffyblks << buf4[1];
    diffyblks << buf4[2];
    diffyblks << buf4[3];
    diffyblks << buf4[4];
    diffyblks << buf4[5];
    diffyblks << buf4[6];
    diffyblks << buf4[7];
  }
}

⌨️ 快捷键说明

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