#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 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\\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 curryblks,
istream currcblks,
istream refyblks,
istream refcblks,
ostream diffyblks,
ostream diffcblks)
{
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 b4_to_2h2 = 0x88138802;
byte4 h2_to_2lo = 0x88881302;
byte4 h2_to_2hi = 0x13028888;
cc merge = itocc(0x0000FFFFF);
loop_stream(curryblks) pipeline(1) {
expand currc(8);
expand refc(8);
expand 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 curry(8);
expand 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 diffcblks diffcblks diffcblks diffcblks diffcblks diffcblks diffcblks
array buf1(8), buf2(8);
expand diffy(16);
expand currlo(8), currhi(8), reflo(8), refhi(8);
double curr0, curr1, curr2, curr3, curr4, curr5, curr6, curr7;
double ref0, ref1, ref2, ref3, ref4, ref5, ref6, ref7;
double 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 diffyblks diffyblks diffyblks diffyblks diffyblks diffyblks diffyblks
array 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 diffyblks diffyblks diffyblks diffyblks diffyblks diffyblks diffyblks }
}