H.264完整的C语言代码和DCT的代码

源代码在线查看: corr_kc.i

软件大小: 4747 K
上传用户: aoaoaoao
关键词: 264 DCT C语言代码 代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				#line 1 "D:\\working\\im_apps\\h264\\corr_kc.cpp"
				#line 1 "D:/working/tools/isim/isimexe/blank_headers\\idb_kernelc.hpp"
				
				
				
				
				
				
				
				
				#line 2 "D:\\working\\im_apps\\h264\\corr_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   indices,
				              uc&        uc_size,
				              uc&        uc_params);
				;
				
				
				#decl icolor(istream datain,
				              ostream Yout,
				              ostream CrCbout);
				;
				
				
				#decl pcolor(istream datain,
				              ostream Yout,
				              ostream CrCbout);
				;
				
				
				#decl dct(istream datain,
				           istream consts,
				           ostream out,
				           uc& uc_quantizer_scale);
				;
				
				
				#decl idct(istream datain,
				            istream consts,
				            ostream out,
				            uc& uc_quantizer_scale);
				;
				
				
				#decl rle(istream Yin,
				           istream CrCbin,
				           istream indices,
				           cistream motion,
				           costream out,
				           uc& pframe,
				           uc& quant_scale);
				;
				
				
				#decl difference(istream curryblks,
				                  istream currcblks,
				                  istream refyblks,
				                  istream refcblks,
				                  ostream diffyblks,
				                  ostream diffcblks);
				;
				
				
				#decl correlate(istream diffyblks,
				                 istream diffcblks,
				                 istream refyblks,
				                 istream refcblks,
				                 ostream newrefyblks,
				                 ostream newrefcblks,
				                 uc& uc_pframe);
				;
				
				
				#decl MV2idx(cistream motion,      
				              ostream   yindices,    
				              ostream   crcbindices, 
				              uc&        uc_offsets,  
				              uc&        uc_mblks,    
				              uc&        uc_mb_width);
				;
				
				
				#decl blocksearch(istream row0,
				                   istream row1,
				                   istream row2,
				                   istream mblocks,
				                   costream motions,
				                   uc& location);
				;
				
				
				#decl mb_encode(istream datain,
				                 istream consts,
				                 ostream color_out,
				                 ostream dct_out,
				                 costream 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\\corr_kc.cpp"
				#line 1 "D:/working/tools/isim/isimexe/blank_headers\\idb_kernelc2.hpp"
				
				
				
				
				
				
				#line 4 "D:\\working\\im_apps\\h264\\corr_kc.cpp"
				
				;
				
				
				
				
				kernel correlate(istream diffyblks,
				                 istream diffcblks,
				                 istream refyblks,
				                 istream refcblks,
				                 ostream newrefyblks,
				                 ostream newrefcblks,
				                 uc& uc_pframe)
				{
				  
				  uc perm_a = 0x07654321;
				  uc perm_b = 0x10765432;
				  uc perm_c = 0x21076543;
				  uc perm_d = 0x32107654;
				  uc perm_e = 0x43210765;
				  uc perm_f = 0x54321076;
				  uc 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 b32_to_lo = 0x88888823; 
				                                
				  byte4 b10_to_lo = 0x88888801; 
				                                
				  byte4 b32_to_hi = 0x88238888; 
				                                
				  byte4 b10_to_hi = 0x88018888; 
				                                
				  byte4 h2_to_b3  = 0x02888888; 
				                                
				  byte4 h2_to_b2  = 0x88028888; 
				                                
				  byte4 h2_to_b1  = 0x88880288; 
				                                
				  byte4 h2_to_b0  = 0x88888802; 
				                                
				
				  cc merge  = itocc(0x0000FFFF);
				  cc pframe = itocc(commclperm(0x8, uint(0), uc_pframe));
				                                   
				  loop_stream(diffyblks) pipeline(1) {
				    expand currc(8);
				    expand refc(8);
				    expand diffc(8);
				
				    diffcblks >> diffc[0];
				    diffcblks >> diffc[1];
				    diffcblks >> diffc[2];
				    diffcblks >> diffc[3];
				    diffcblks >> diffc[4];
				    diffcblks >> diffc[5];
				    diffcblks >> diffc[6];
				    diffcblks >> diffc[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 curry(8);
				    expand refy(8);
				    expand packedy(8);
				
				    array diffy(8), diffy21(8), diffy43(8);
				
				    diffyblks >> diffy21[0];
				    diffyblks >> diffy21[1];
				    diffyblks >> diffy21[2];
				    diffyblks >> diffy21[3];
				    diffyblks >> diffy21[4];
				    diffyblks >> diffy21[5];
				    diffyblks >> diffy21[6];
				    diffyblks >> diffy21[7];
				    diffyblks >> diffy43[0];
				    diffyblks >> diffy43[1];
				    diffyblks >> diffy43[2];
				    diffyblks >> diffy43[3];
				    diffyblks >> diffy43[4];
				    diffyblks >> diffy43[5];
				    diffyblks >> diffy43[6];
				    diffyblks >> diffy43[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];
				
				    currc[0] = diffc[0] + select(pframe, refc[0], 0);
				    currc[1] = diffc[1] + select(pframe, refc[1], 0);
				    currc[2] = diffc[2] + select(pframe, refc[2], 0);
				    currc[3] = diffc[3] + select(pframe, refc[3], 0);
				    currc[4] = diffc[4] + select(pframe, refc[4], 0);
				    currc[5] = diffc[5] + select(pframe, refc[5], 0);
				    currc[6] = diffc[6] + select(pframe, refc[6], 0);
				    currc[7] = diffc[7] + select(pframe, refc[7], 0);
				
				    newrefcblks 				    newrefcblks 				    newrefcblks 				    newrefcblks 				    newrefcblks 				    newrefcblks 				    newrefcblks 				    newrefcblks 				
				    
				    
				    
				    
				    diffy[idx0] = diffy21[idx0];
				    diffy[idx7] = commucperm(perm_a, diffy21[idx1]);
				    diffy[idx6] = commucperm(perm_b, diffy21[idx2]);
				    diffy[idx5] = commucperm(perm_c, diffy21[idx3]);
				    diffy[idx4] = commucperm(perm_d, diffy21[idx4]);
				    diffy[idx3] = commucperm(perm_e, diffy21[idx5]);
				    diffy[idx2] = commucperm(perm_f, diffy21[idx6]);
				    diffy[idx1] = commucperm(perm_g, diffy21[idx7]);
				
				    
				    double h0, h1, h2, h3, h4, h5, h6, h7;
				    expand ref(8);
				
				    h0 = shuffled(refy[0], b32_to_lo);
				    h1 = shuffled(refy[0], b10_to_lo);
				    h2 = shuffled(refy[2], b32_to_lo);
				    h3 = shuffled(refy[2], b10_to_lo);
				    h4 = shuffled(refy[4], b32_to_hi);
				    h5 = shuffled(refy[4], b10_to_hi);
				    h6 = shuffled(refy[6], b32_to_hi);
				    h7 = shuffled(refy[6], b10_to_hi);
				
				    ref[0] = half2(lo(h0) | lo(h4));
				    ref[1] = half2(hi(h0) | hi(h4));
				    ref[2] = half2(lo(h1) | lo(h5));
				    ref[3] = half2(hi(h1) | hi(h5));
				    ref[4] = half2(lo(h2) | lo(h6));
				    ref[5] = half2(hi(h2) | hi(h6));
				    ref[6] = half2(lo(h3) | lo(h7));
				    ref[7] = half2(hi(h3) | hi(h7));
				      
				    curry[0] = diffy[0] + select(pframe, ref[0], 0);
				    curry[1] = diffy[1] + select(pframe, ref[1], 0);
				    curry[2] = diffy[2] + select(pframe, ref[2], 0);
				    curry[3] = diffy[3] + select(pframe, ref[3], 0);
				    curry[4] = diffy[4] + select(pframe, ref[4], 0);
				    curry[5] = diffy[5] + select(pframe, ref[5], 0);
				    curry[6] = diffy[6] + select(pframe, ref[6], 0);
				    curry[7] = diffy[7] + select(pframe, ref[7], 0);
				
				    
				    double b3, b2, b1, b0;
				    b3 = shuffled(curry[0], h2_to_b3);
				    b2 = shuffled(curry[1], h2_to_b2);
				    b1 = shuffled(curry[2], h2_to_b1);
				    b0 = shuffled(curry[3], h2_to_b0);
				      
				    packedy[0] = ubyte4((hi(b3) | hi(b2)) | (hi(b1) | hi(b0)));
				    packedy[4] = ubyte4((lo(b3) | lo(b2)) | (lo(b1) | lo(b0)));
				
				    b3 = shuffled(curry[4], h2_to_b3);
				    b2 = shuffled(curry[5], h2_to_b2);
				    b1 = shuffled(curry[6], h2_to_b1);
				    b0 = shuffled(curry[7], h2_to_b0);
				    
				    packedy[2] = ubyte4((hi(b3) | hi(b2)) | (hi(b1) | hi(b0)));
				    packedy[6] = ubyte4((lo(b3) | lo(b2)) | (lo(b1) | lo(b0)));
				
				    
				    diffy[idx0] = diffy43[idx0];
				    diffy[idx7] = commucperm(perm_a, diffy43[idx1]);
				    diffy[idx6] = commucperm(perm_b, diffy43[idx2]);
				    diffy[idx5] = commucperm(perm_c, diffy43[idx3]);
				    diffy[idx4] = commucperm(perm_d, diffy43[idx4]);
				    diffy[idx3] = commucperm(perm_e, diffy43[idx5]);
				    diffy[idx2] = commucperm(perm_f, diffy43[idx6]);
				    diffy[idx1] = commucperm(perm_g, diffy43[idx7]);
				
				    
				    h0 = shuffled(refy[1], b32_to_lo);
				    h1 = shuffled(refy[1], b10_to_lo);
				    h2 = shuffled(refy[3], b32_to_lo);
				    h3 = shuffled(refy[3], b10_to_lo);
				    h4 = shuffled(refy[5], b32_to_hi);
				    h5 = shuffled(refy[5], b10_to_hi);
				    h6 = shuffled(refy[7], b32_to_hi);
				    h7 = shuffled(refy[7], b10_to_hi);
				
				    ref[0] = half2(lo(h0) | lo(h4));
				    ref[1] = half2(hi(h0) | hi(h4));
				    ref[2] = half2(lo(h1) | lo(h5));
				    ref[3] = half2(hi(h1) | hi(h5));
				    ref[4] = half2(lo(h2) | lo(h6));
				    ref[5] = half2(hi(h2) | hi(h6));
				    ref[6] = half2(lo(h3) | lo(h7));
				    ref[7] = half2(hi(h3) | hi(h7));
				      
				    curry[0] = diffy[0] + select(pframe, ref[0], 0); 
				    curry[1] = diffy[1] + select(pframe, ref[1], 0); 
				    curry[2] = diffy[2] + select(pframe, ref[2], 0);
				    curry[3] = diffy[3] + select(pframe, ref[3], 0);
				    curry[4] = diffy[4] + select(pframe, ref[4], 0);
				    curry[5] = diffy[5] + select(pframe, ref[5], 0);
				    curry[6] = diffy[6] + select(pframe, ref[6], 0);
				    curry[7] = diffy[7] + select(pframe, ref[7], 0);
				
				    
				    b3 = shuffled(curry[0], h2_to_b3);
				    b2 = shuffled(curry[1], h2_to_b2);
				    b1 = shuffled(curry[2], h2_to_b1);
				    b0 = shuffled(curry[3], h2_to_b0);
				      
				    packedy[1] = ubyte4((hi(b3) | hi(b2)) | (hi(b1) | hi(b0)));
				    packedy[5] = ubyte4((lo(b3) | lo(b2)) | (lo(b1) | lo(b0)));
				
				    b3 = shuffled(curry[4], h2_to_b3);
				    b2 = shuffled(curry[5], h2_to_b2);
				    b1 = shuffled(curry[6], h2_to_b1);
				    b0 = shuffled(curry[7], h2_to_b0);
				    
				    packedy[3] = ubyte4((hi(b3) | hi(b2)) | (hi(b1) | hi(b0)));
				    packedy[7] = ubyte4((lo(b3) | lo(b2)) | (lo(b1) | lo(b0)));
				
				    newrefyblks 				    newrefyblks 				    newrefyblks 				    newrefyblks 				    newrefyblks 				    newrefyblks 				    newrefyblks 				    newrefyblks 				  }
				}
							

相关资源