#line 1 "D:\\working\\im_apps\\h264\\mv2idx_kc.cpp"
#line 1 "D:/working/tools/isim/isimexe/blank_headers\\idb_kernelc.hpp"
#line 2 "D:\\working\\im_apps\\h264\\mv2idx_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 mb_encode(istream datain,
istream consts,
ostream color_out,
ostream dct_out,
costream out);
;
#decl me_fast(istream row0,
istream row1,
istream row2,
istream mblocks,
costream motions_out,
ostream refyblks,
ostream crcbindices,
uc& uc_margin,
uc& uc_offsets,
uc& uc_mblks,
uc& uc_mb_width);
;
#decl me_fast_search4(istream row0,
istream row1,
istream row2,
istream mblocks,
costream motions_out,
uc& uc_margin,
uc& uc_mblks);
;
#decl me_fast_jitter2(istream row0,
istream row1,
istream row2,
istream mblocks,
cistream motions_in,
costream motions_out,
uc& uc_margin,
uc& uc_mblks);
;
#decl me_fast_jitter1(istream row0,
istream row1,
istream row2,
istream mblocks,
cistream motions_in,
costream motions_out,
ostream refyblks,
ostream crcbindices,
uc& uc_margin,
uc& uc_offsets,
uc& uc_mblks,
uc& 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\\mv2idx_kc.cpp"
#line 1 "D:/working/tools/isim/isimexe/blank_headers\\idb_kernelc2.hpp"
#line 4 "D:\\working\\im_apps\\h264\\mv2idx_kc.cpp"
;
kernel MV2idx(cistream motion,
ostream yindices,
ostream crcbindices,
uc& uc_offsets,
uc& uc_mblks,
uc& uc_mb_width)
{
uint fetchaddress;
uint fetchx, fetchy;
int yrefx, yrefy;
int crefx, crefy;
uint yout0, yout1, yout2, yout3, yout4, yout5, yout6, yout7;
uint cout0, cout1, cout2, cout3, cout4, cout5, cout6, cout7;
int offsets = commclperm(0x8, 0, uc_offsets);
int xoffset = offsets & 0xffff;
int yoffset = shift(offsets, -16);
uint mb_width = uint(commclperm(0x8, 0, uc_mb_width));
uint rowlen = shift(mb_width, 2);
uint crowlen = shift(mb_width, 6);
yrefx = xoffset;
yrefy = yoffset + cid();
crefx = shift(xoffset, -1) + cid();
crefy = shift(yoffset, -1);
byte4 unpackmv = 0x57571302;
cc ccin = itocc (cid() == 0);
cc ccend = itocc(0);
half2 dxdy, bestval;
loop_count(uc_mblks) pipeline(1) {
double dxdy2;
int dx, dy;
motion(ccin, ccend) >> dxdy >> bestval;
dxdy = shifta(dxdy, -1);
dxdy = commclperm(0, dxdy);
dxdy2 = shuffled(dxdy, unpackmv);
dx = int(hi(dxdy2));
dy = int(lo(dxdy2));
fetchx = uint(yrefx + dx);
fetchy = uint(yrefy + dy);
expand fetchxoffsets(4), fetchyoffsets(8);
fetchyoffsets[0] = shift(lo(shift(fetchy, -4) * rowlen), 4)
+ (fetchy & 0xf);
fetchy = fetchy + 8;
fetchyoffsets[1] = shift(lo(shift(fetchy, -4) * rowlen), 4)
+ (fetchy & 0xf);
fetchxoffsets[0] = shift(shift(fetchx, -4), 6)
+ shift(shift(fetchx & 0xf, -2), 4);
fetchx = fetchx + 4;
fetchxoffsets[1] = shift(shift(fetchx, -4), 6)
+ shift(shift(fetchx & 0xf, -2), 4);
fetchx = fetchx + 4;
fetchxoffsets[2] = shift(shift(fetchx, -4), 6)
+ shift(shift(fetchx & 0xf, -2), 4);
fetchx = fetchx + 4;
fetchxoffsets[3] = shift(shift(fetchx, -4), 6)
+ shift(shift(fetchx & 0xf, -2), 4);
yout0 = fetchyoffsets[0] + fetchxoffsets[0];
yout1 = fetchyoffsets[1] + fetchxoffsets[0];
yout2 = fetchyoffsets[0] + fetchxoffsets[1];
yout3 = fetchyoffsets[1] + fetchxoffsets[1];
yout4 = fetchyoffsets[0] + fetchxoffsets[2];
yout5 = fetchyoffsets[1] + fetchxoffsets[2];
yout6 = fetchyoffsets[0] + fetchxoffsets[3];
yout7 = fetchyoffsets[1] + fetchxoffsets[3];
yindices yindices
dx = dx + select(itocc(dx < 0), 1, 0);
dy = dy + select(itocc(dy < 0), 1, 0);
fetchx = uint(crefx + shifta(int(dx), -1));
fetchy = uint(crefy + shifta(int(dy), -1));
uint fetchxoffset = shift(shift(fetchx, -3), 6) + (fetchx & 0x7);
fetchyoffsets[0] = lo(shift(fetchy, -3) * crowlen)
+ shift(fetchy & 0x7, 3);
fetchy = fetchy + 1;
fetchyoffsets[1] = lo(shift(fetchy, -3) * crowlen)
+ shift(fetchy & 0x7, 3);
fetchy = fetchy + 1;
fetchyoffsets[2] = lo(shift(fetchy, -3) * crowlen)
+ shift(fetchy & 0x7, 3);
fetchy = fetchy + 1;
fetchyoffsets[3] = lo(shift(fetchy, -3) * crowlen)
+ shift(fetchy & 0x7, 3);
fetchy = fetchy + 1;
fetchyoffsets[4] = lo(shift(fetchy, -3) * crowlen)
+ shift(fetchy & 0x7, 3);
fetchy = fetchy + 1;
fetchyoffsets[5] = lo(shift(fetchy, -3) * crowlen)
+ shift(fetchy & 0x7, 3);
fetchy = fetchy + 1;
fetchyoffsets[6] = lo(shift(fetchy, -3) * crowlen)
+ shift(fetchy & 0x7, 3);
fetchy = fetchy + 1;
fetchyoffsets[7] = lo(shift(fetchy, -3) * crowlen)
+ shift(fetchy & 0x7, 3);
cout0 = fetchxoffset + fetchyoffsets[0];
cout1 = fetchxoffset + fetchyoffsets[1];
cout2 = fetchxoffset + fetchyoffsets[2];
cout3 = fetchxoffset + fetchyoffsets[3];
cout4 = fetchxoffset + fetchyoffsets[4];
cout5 = fetchxoffset + fetchyoffsets[5];
cout6 = fetchxoffset + fetchyoffsets[6];
cout7 = fetchxoffset + fetchyoffsets[7];
crcbindices crcbindices
yrefx = yrefx + 16;
crefx = crefx + 8;
}
cc always = itocc( 0xffffffff );
loop_until_any(ccend) {
motion( always, ccend) >> dxdy >> bestval;
}
}