53 for(plane_index=0; plane_index<3; plane_index++){
152 for (i = 0; i < h; i++) {
153 for (j = 0; j < w; j++) {
157 pix += line_size - w;
169 for (i = 0; i < w; i++) {
170 for (j = 0; j < w; j ++) {
174 pix += line_size - w;
185 return (3*lambda)>>(FF_LAMBDA_SHIFT+1);
206 #define P_TOPRIGHT P[3]
207 #define P_MEDIAN P[4]
209 #define FLAG_QPEL 1 //must be 1
219 int score, score2, iscore, i_len, p_len, block_s, sum, base_bits;
223 const int index= (x + y*w) << rem_depth;
225 int trx= (x+1)<<rem_depth;
226 int try= (y+1)<<rem_depth;
232 const BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->
block[index-w+(1<<rem_depth)] : tl;
233 int pl = left->
color[0];
234 int pcb= left->
color[1];
235 int pcr= left->
color[2];
245 int16_t last_mv[3][2];
247 const int shift= 1+qpel;
253 int ref, best_ref, ref_score, ref_mx, ref_my;
257 set_blocks(s, level, x, y, pl, pcb, pcr, 0, 0, 0,
BLOCK_INTRA);
272 last_mv[1][0]= right->
mx;
273 last_mv[1][1]= right->
my;
274 last_mv[2][0]= bottom->
mx;
275 last_mv[2][1]= bottom->
my;
290 c->
xmin = - x*block_w - 16+3;
291 c->
ymin = - y*block_w - 16+3;
335 if(score > ref_score){
348 pc.bytestream= p_buffer;
352 put_rac(&pc, &p_state[4 + s_context], 1);
355 put_symbol(&pc, &p_state[128 + 1024 + 32*ref_context], best_ref, 0);
356 pred_mv(s, &pmx, &pmy, best_ref, left, top, tr);
357 put_symbol(&pc, &p_state[128 + 32*(mx_context + 16*!!best_ref)], mx - pmx, 1);
358 put_symbol(&pc, &p_state[128 + 32*(my_context + 16*!!best_ref)], my - pmy, 1);
359 p_len= pc.bytestream - pc.bytestream_start;
362 block_s= block_w*block_w;
363 sum =
pix_sum(current_data[0], stride, block_w, block_w);
364 l= (sum + block_s/2)/block_s;
365 iscore =
pix_norm1(current_data[0], stride, block_w) - 2*l*sum + l*l*block_s;
370 cb= (sum + block_s/2)/block_s;
373 cr= (sum + block_s/2)/block_s;
380 ic.bytestream= i_buffer;
383 put_rac(&ic, &i_state[4 + s_context], 1);
390 i_len= ic.bytestream - ic.bytestream_start;
393 av_assert1(iscore < 255*255*256 + s->lambda2*10);
399 int varc= iscore >> 8;
400 int vard= score >> 8;
401 if (vard <= 64 || vard < varc)
415 if(score2 < score && score2 < iscore)
420 pred_mv(s, &pmx, &pmy, 0, left, top, tr);
421 memcpy(pbbak, i_buffer, i_len);
425 set_blocks(s, level, x, y, l, cb, cr, pmx, pmy, 0,
BLOCK_INTRA);
429 memcpy(pbbak, p_buffer, p_len);
433 set_blocks(s, level, x, y, pl, pcb, pcr, mx, my, best_ref, 0);
442 const int index= (x + y*w) << rem_depth;
443 int trx= (x+1)<<rem_depth;
448 const BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->
block[index-w+(1<<rem_depth)] : tl;
449 int pl = left->
color[0];
450 int pcb= left->
color[1];
451 int pcr= left->
color[2];
459 set_blocks(s, level, x, y, pl, pcb, pcr, 0, 0, 0,
BLOCK_INTRA);
476 pred_mv(s, &pmx, &pmy, 0, left, top, tr);
483 set_blocks(s, level, x, y, b->
color[0], b->
color[1], b->
color[2], pmx, pmy, 0,
BLOCK_INTRA);
485 pred_mv(s, &pmx, &pmy, b->
ref, left, top, tr);
491 set_blocks(s, level, x, y, pl, pcb, pcr, b->
mx, b->
my, b->
ref, 0);
499 const int block_w = plane_index ? block_size>>s->
chroma_h_shift : block_size;
500 const int block_h = plane_index ? block_size>>s->
chroma_v_shift : block_size;
502 const int obmc_stride= plane_index ? (2*block_size)>>s->
chroma_h_shift : 2*block_size;
504 uint8_t *
src= s-> input_picture->data[plane_index];
507 const int w= p->
width;
509 int index= mb_x + mb_y*b_stride;
518 b->
color[plane_index]= 0;
519 memset(dst, 0, obmc_stride*obmc_stride*
sizeof(
IDWTELEM));
522 int mb_x2= mb_x + (i &1) - 1;
523 int mb_y2= mb_y + (i>>1) - 1;
524 int x= block_w*mb_x2 + block_w/2;
525 int y= block_h*mb_y2 + block_h/2;
527 add_yblock(s, 0, NULL, dst + (i&1)*block_w + (i>>1)*obmc_stride*block_h, NULL, obmc,
528 x, y, block_w, block_h, w, h, obmc_stride, ref_stride, obmc_stride, mb_x2, mb_y2, 0, 0, plane_index);
530 for(y2=
FFMAX(y, 0); y2<
FFMIN(h, y+block_h); y2++){
531 for(x2=
FFMAX(x, 0); x2<
FFMIN(w, x+block_w); x2++){
532 int index= x2-(block_w*mb_x - block_w/2) + (y2-(block_h*mb_y - block_h/2))*obmc_stride;
533 int obmc_v= obmc[
index];
535 if(y<0) obmc_v += obmc[index + block_h*obmc_stride];
536 if(x<0) obmc_v += obmc[index + block_w];
537 if(y+block_h>h) obmc_v += obmc[index - block_h*obmc_stride];
538 if(x+block_w>w) obmc_v += obmc[index - block_w];
543 ab += (
src[x2 + y2*ref_stride] - (d>>
FRAC_BITS)) * obmc_v;
544 aa += obmc_v * obmc_v;
556 int index= x + y*b_stride;
560 const BlockNode *tl = y && x ? &s->
block[index-b_stride-1] : left;
561 const BlockNode *tr = y && x+w<b_stride ? &s->
block[index-b_stride+w] : tl;
566 if(x<0 || x>=b_stride || y>=b_height)
582 pred_mv(s, &dmx, &dmy, b->
ref, left, top, tr);
594 const int block_w = plane_index ? block_size>>s->
chroma_h_shift : block_size;
595 const int block_h = plane_index ? block_size>>s->
chroma_v_shift : block_size;
596 const int obmc_stride= plane_index ? (2*block_size)>>s->
chroma_h_shift : 2*block_size;
599 uint8_t *
src= s-> input_picture->data[plane_index];
605 const int w= p->
width;
610 int sx= block_w*mb_x - block_w/2;
611 int sy= block_h*mb_y - block_h/2;
612 int x0=
FFMAX(0,-sx);
613 int y0=
FFMAX(0,-sy);
614 int x1=
FFMIN(block_w*2, w-sx);
615 int y1=
FFMIN(block_h*2, h-sy);
620 ff_snow_pred_block(s, cur, tmp, ref_stride, sx, sy, block_w*2, block_h*2, &s->
block[mb_x + mb_y*b_stride], plane_index, w, h);
622 for(y=y0; y<y1; y++){
623 const uint8_t *obmc1= obmc_edged[
y];
625 uint8_t *cur1 = cur + y*ref_stride;
626 uint8_t *dst1 = dst + sx + (sy+
y)*ref_stride;
627 for(x=x0; x<x1; x++){
628 #if FRAC_BITS >= LOG2_OBMC_MAX
634 if(v&(~255)) v= ~(v>>31);
641 && (mb_x == 0 || mb_x == b_stride-1)
642 && (mb_y == 0 || mb_y == b_height-1)){
652 memcpy(dst + sx+x0 + (sy+y)*ref_stride, cur + x0 + y*ref_stride, x1-x0);
663 distortion =
ff_w97_32_c(&s->
m,
src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, 32);
665 distortion =
ff_w53_32_c(&s->
m,
src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, 32);
669 int off = sx+16*(i&1) + (sy+16*(i>>1))*ref_stride;
670 distortion += s->
mecc.
me_cmp[0](&s->
m,
src + off, dst + off, ref_stride, 16);
675 distortion = s->
mecc.
me_cmp[0](&s->
m,
src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, block_w*2);
684 rate +=
get_block_bits(s, mb_x + (i&1) - (i>>1), mb_y + (i>>1), 1);
686 if(mb_x == b_stride-2)
689 return distortion + rate*penalty_factor;
696 const int block_w = plane_index ? block_size>>s->
chroma_h_shift : block_size;
697 const int block_h = plane_index ? block_size>>s->
chroma_v_shift : block_size;
699 const int obmc_stride= plane_index ? (2*block_size)>>s->
chroma_h_shift : 2*block_size;
702 uint8_t *
src= s-> input_picture->data[plane_index];
707 const int w= p->
width;
716 int mb_x2= mb_x + (i%3) - 1;
717 int mb_y2= mb_y + (i/3) - 1;
718 int x= block_w*mb_x2 + block_w/2;
719 int y= block_h*mb_y2 + block_h/2;
722 x, y, block_w, block_h, w, h, 0, ref_stride, obmc_stride, mb_x2, mb_y2, 1, 1, plane_index);
725 for(y2= y; y2<0; y2++)
726 memcpy(dst + x + y2*ref_stride,
src + x + y2*ref_stride, block_w);
727 for(y2= h; y2<y+block_h; y2++)
728 memcpy(dst + x + y2*ref_stride,
src + x + y2*ref_stride, block_w);
730 for(y2= y; y2<y+block_h; y2++)
731 memcpy(dst + x + y2*ref_stride,
src + x + y2*ref_stride, -x);
734 for(y2= y; y2<y+block_h; y2++)
735 memcpy(dst + w + y2*ref_stride,
src + w + y2*ref_stride, x+block_w - w);
739 distortion += s->
mecc.
me_cmp[block_w==8](&s->
m,
src + x + y*ref_stride, dst + x + y*ref_stride, ref_stride, block_h);
753 for(i=merged?4:0; i<9; i++){
754 static const int dxy[9][2] = {{0,0},{1,0},{0,1},{1,1},{2,0},{2,1},{-1,2},{0,2},{1,2}};
758 return distortion + rate*penalty_factor;
762 const int w= b->
width;
775 int l=0, lt=0, t=0, rt=0;
776 v= src[x + y*stride];
779 t= src[x + (y-1)*stride];
781 lt= src[x - 1 + (y-1)*stride];
784 rt= src[x + 1 + (y-1)*stride];
788 l= src[x - 1 + y*stride];
797 if(px<b->parent->width && py<b->parent->height)
798 p= parent[px + py*2*stride];
802 runs[run_index++]=
run;
810 max_index= run_index;
811 runs[run_index++]=
run;
813 run= runs[run_index++];
816 if(run_index <= max_index)
826 int l=0, lt=0, t=0, rt=0;
827 v= src[x + y*stride];
830 t= src[x + (y-1)*stride];
832 lt= src[x - 1 + (y-1)*stride];
835 rt= src[x + 1 + (y-1)*stride];
839 l= src[x - 1 + y*stride];
848 if(px<b->parent->width && py<b->parent->height)
849 p= parent[px + py*2*stride];
857 run= runs[run_index++];
859 if(run_index <= max_index)
869 int l2= 2*
FFABS(l) + (l<0);
899 block->
color[0] = p[0];
900 block->
color[1] = p[1];
901 block->
color[2] = p[2];
931 return check_block(s, mb_x, mb_y, p, 0, obmc_edged, best_rd);
944 backup[0] = block[0];
945 backup[1] = block[1];
946 backup[2] = block[b_stride];
947 backup[3] = block[b_stride + 1];
963 block[1]= block[b_stride]= block[b_stride+1]= *
block;
974 block[b_stride]= backup[2];
975 block[b_stride+1]= backup[3];
981 int pass, mb_x, mb_y;
984 const int b_stride= b_width;
991 for(mb_y= 0; mb_y<s->
b_height; mb_y++)
992 for(mb_x= 0; mb_x<s->
b_width; mb_x++)
998 for(pass=0; pass<25; pass++){
1001 for(mb_y= 0; mb_y<b_height; mb_y++){
1002 for(mb_x= 0; mb_x<b_width; mb_x++){
1003 int dia_change, i, j, ref;
1004 int best_rd= INT_MAX, ref_rd;
1006 const int index= mb_x + mb_y * b_stride;
1011 BlockNode *bb = mb_y+1<b_height ? &s->
block[index+b_stride ] : NULL;
1012 BlockNode *tlb= mb_x && mb_y ? &s->
block[index-b_stride-1] : NULL;
1013 BlockNode *trb= mb_x+1<b_width && mb_y ? &s->
block[index-b_stride+1] : NULL;
1014 BlockNode *blb= mb_x && mb_y+1<b_height ? &s->
block[index+b_stride-1] : NULL;
1015 BlockNode *brb= mb_x+1<b_width && mb_y+1<b_height ? &s->
block[index+b_stride+1] : NULL;
1032 for (y = 0; y < b_w * 2; y++)
1035 for(y=0; y<b_w*2; y++)
1036 memset(obmc_edged[y], obmc_edged[y][0] + obmc_edged[y][b_w-1], b_w);
1037 if(mb_x==b_stride-1)
1038 for(y=0; y<b_w*2; y++)
1039 memset(obmc_edged[y]+b_w, obmc_edged[y][b_w] + obmc_edged[y][b_w*2-1], b_w);
1041 for(x=0; x<b_w*2; x++)
1042 obmc_edged[0][x] += obmc_edged[b_w-1][x];
1043 for(y=1; y<b_w; y++)
1044 memcpy(obmc_edged[y], obmc_edged[0], b_w*2);
1046 if(mb_y==b_height-1){
1047 for(x=0; x<b_w*2; x++)
1048 obmc_edged[b_w*2-1][x] += obmc_edged[b_w][x];
1049 for(y=b_w; y<b_w*2-1; y++)
1050 memcpy(obmc_edged[y], obmc_edged[b_w*2-1], b_w*2);
1055 if(mb_x==0 || mb_y==0 || mb_x==b_width-1 || mb_y==b_height-1){
1061 const int sx= block_w*mb_x - block_w/2;
1062 const int sy= block_h*mb_y - block_h/2;
1068 memcpy(dst + sx + y*stride, src + sx + y*stride, block_w*2);
1069 for(y=h; y<sy+block_h*2; y++)
1070 memcpy(dst + sx + y*stride, src + sx + y*stride, block_w*2);
1072 for(y=sy; y<sy+block_h*2; y++)
1073 memcpy(dst + sx + y*stride, src + sx + y*stride, -sx);
1075 if(sx+block_w*2 > w){
1076 for(y=sy; y<sy+block_h*2; y++)
1077 memcpy(dst + w + y*stride, src + w + y*stride, sx+block_w*2 - w);
1083 color[i]=
get_dc(s, mb_x, mb_y, i);
1088 check_block(s, mb_x, mb_y, color0, 1, obmc_edged, &best_rd);
1104 check_block_inter(s, mb_x, mb_y, mvr[-b_stride][0], mvr[-b_stride][1], obmc_edged, &best_rd);
1110 check_block_inter(s, mb_x, mb_y, mvr[b_stride][0], mvr[b_stride][1], obmc_edged, &best_rd);
1118 dia_change |=
check_block_inter(s, mb_x, mb_y, block->
mx+4*(i-j), block->
my+(4*j), obmc_edged, &best_rd);
1119 dia_change |=
check_block_inter(s, mb_x, mb_y, block->
mx-4*(i-j), block->
my-(4*j), obmc_edged, &best_rd);
1120 dia_change |=
check_block_inter(s, mb_x, mb_y, block->
mx+4*(i-j), block->
my-(4*j), obmc_edged, &best_rd);
1121 dia_change |=
check_block_inter(s, mb_x, mb_y, block->
mx-4*(i-j), block->
my+(4*j), obmc_edged, &best_rd);
1127 static const int square[8][2]= {{+1, 0},{-1, 0},{ 0,+1},{ 0,-1},{+1,+1},{-1,-1},{+1,-1},{-1,+1},};
1130 dia_change |=
check_block_inter(s, mb_x, mb_y, block->
mx+square[i][0], block->
my+square[i][1], obmc_edged, &best_rd);
1134 mvr[0][0]= block->
mx;
1135 mvr[0][1]= block->
my;
1136 if(ref_rd > best_rd){
1143 check_block(s, mb_x, mb_y, color, 1, obmc_edged, &best_rd);
1165 for(mb_y= 0; mb_y<b_height; mb_y+=2){
1166 for(mb_x= 0; mb_x<b_width; mb_x+=2){
1168 int best_rd, init_rd;
1169 const int index= mb_x + mb_y * b_stride;
1174 b[2]= b[0]+b_stride;
1189 (b[0]->mx + b[1]->mx + b[2]->mx + b[3]->mx + 2) >> 2,
1190 (b[0]->my + b[1]->my + b[2]->my + b[3]->my + 2) >> 2, 0, &best_rd);
1196 if(init_rd != best_rd)
1227 const int w= b->
width;
1236 dst[x + y*stride]= src[x + y*stride];
1240 bias= bias ? 0 : (3*qmul)>>3;
1247 int i= src[x + y*stride];
1249 if((
unsigned)(i+thres1) > thres2){
1253 dst[x + y*stride]= i;
1258 dst[x + y*stride]= -i;
1261 dst[x + y*stride]= 0;
1267 int i= src[x + y*stride];
1269 if((
unsigned)(i+thres1) > thres2){
1272 i= (i + bias) / qmul;
1273 dst[x + y*stride]= i;
1277 i= (i + bias) / qmul;
1278 dst[x + y*stride]= -i;
1281 dst[x + y*stride]= 0;
1288 const int w= b->
width;
1299 int i= src[x + y*stride];
1301 src[x + y*stride]= -((-i*qmul + qadd)>>(
QEXPSHIFT));
1303 src[x + y*stride]= (( i*qmul + qadd)>>(
QEXPSHIFT));
1310 const int w= b->
width;
1314 for(y=h-1; y>=0; y--){
1315 for(x=w-1; x>=0; x--){
1316 int i= x + y*stride;
1320 if(y && x+1<w) src[i] -=
mid_pred(src[i - 1], src[i - stride], src[i - stride + 1]);
1321 else src[i] -= src[i - 1];
1323 if(y) src[i] -=
mid_pred(src[i - 1], src[i - stride], src[i - 1] + src[i - stride] - src[i - 1 - stride]);
1324 else src[i] -= src[i - 1];
1327 if(y) src[i] -= src[i - stride];
1334 const int w= b->
width;
1340 int i= x + y*stride;
1344 if(y && x+1<w) src[i] +=
mid_pred(src[i - 1], src[i - stride], src[i - stride + 1]);
1345 else src[i] += src[i - 1];
1347 if(y) src[i] +=
mid_pred(src[i - 1], src[i - stride], src[i - 1] + src[i - stride] - src[i - 1 - stride]);
1348 else src[i] += src[i - 1];
1351 if(y) src[i] += src[i - stride];
1358 int plane_index,
level, orientation;
1360 for(plane_index=0; plane_index<
FFMIN(s->
nb_planes, 2); plane_index++){
1362 for(orientation=level ? 1:0; orientation<4; orientation++){
1363 if(orientation==2)
continue;
1374 memset(kstate,
MID_STATE,
sizeof(kstate));
1384 for(plane_index=0; plane_index<2; plane_index++){
1411 for(plane_index=0; plane_index<
FFMIN(s->
nb_planes, 2); plane_index++){
1419 for(plane_index=0; plane_index<
FFMIN(s->
nb_planes, 2); plane_index++){
1423 for(i= p->
htaps/2; i; i--)
1447 for(plane_index=0; plane_index<2; plane_index++){
1473 uint32_t coef_sum= 0;
1474 int level, orientation, delta_qlog;
1477 for(orientation=level ? 1 : 0; orientation<4; orientation++){
1480 const int w= b->
width;
1482 const int stride= b->
stride;
1485 const int qdiv= (1<<16)/qmul;
1490 buf[x+y*stride]= b->
buf[x+y*stride];
1495 coef_sum+= abs(buf[x+y*stride]) * qdiv >> 16;
1501 coef_sum = (uint64_t)coef_sum * coef_sum >> 16;
1516 s->
qlog+= delta_qlog;
1523 int level, orientation, x,
y;
1526 for(orientation=level ? 1 : 0; orientation<4; orientation++){
1535 for(x=0; x<
width; x++){
1541 b->
qlog= (int)(log(352256.0/sqrt(error)) / log(pow(2.0, 1.0/
QROOT))+0.5);
1547 const AVFrame *pict,
int *got_packet)
1554 int level, orientation, plane_index, i,
y,
ret;
1567 for(y=0; y<(height>>vshift); y++)
1572 width >> hshift, height >> vshift,
1629 int block_width = (width +15)>>4;
1630 int block_height= (height+15)>>4;
1639 s->
m. last_picture_ptr= &s->
m. last_picture;
1693 for(plane_index=0; plane_index < s->
nb_planes; plane_index++){
1703 for(plane_index=0; plane_index < s->nb_planes; plane_index++){
1712 if(pict->
data[plane_index])
1750 if (delta_qlog <= INT_MIN)
1763 for(orientation=level ? 1 : 0; orientation<4; orientation++){
1778 for(orientation=level ? 1 : 0; orientation<4; orientation++){
1800 pict->
data[plane_index][y*pict->
linesize[plane_index] + x];
1811 if(pict->
data[plane_index])
1870 #define OFFSET(x) offsetof(SnowContext, x)
1871 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
1873 {
"memc_only",
"Only do ME/MC (I frames -> ref, P frame -> ME+MC).",
OFFSET(memc_only),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
VE },
1874 {
"no_bitstream",
"Skip final bitstream writeout.",
OFFSET(no_bitstream),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
VE },
1926 printf(
"testing 5/3 DWT\n");
1928 buffer[0][i] = buffer[1][i] =
av_lfg_get(&prng) % 54321 - 12345;
1934 if(buffer[0][i]!= buffer[1][i]) printf(
"fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][i]);
1936 printf(
"testing 9/7 DWT\n");
1939 buffer[0][i] = buffer[1][i] =
av_lfg_get(&prng) % 54321 - 12345;
1945 if(
FFABS(buffer[0][i] - buffer[1][i])>20) printf(
"fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][i]);
1948 int level, orientation, x,
y;
1949 int64_t errors[8][4];
1952 memset(errors, 0,
sizeof(errors));
1956 for(orientation=level ? 1 : 0; orientation<4; orientation++){
1963 if(orientation&1) buf+=w;
1964 if(orientation>1) buf+=stride>>1;
1966 memset(buffer[0], 0,
sizeof(
int)*
width*height);
1967 buf[w/2 + h/2*stride]= 256*256;
1970 for(x=0; x<
width; x++){
1971 int64_t d= buffer[0][x + y*
width];
1973 if(
FFABS(width/2-x)<9 &&
FFABS(height/2-y)<9 && level==2) printf(
"%8"PRId64
" ", d);
1975 if(
FFABS(height/2-y)<9 && level==2) printf(
"\n");
1977 error= (int)(sqrt(error)+0.5);
1978 errors[
level][orientation]= error;
1979 if(g) g=
av_gcd(g, error);
1983 printf(
"static int const visual_weight[][4]={\n");
1986 for(orientation=0; orientation<4; orientation++){
1987 printf(
"%8"PRId64
",", errors[level][orientation]/g);
2003 memset(buffer[0], 0,
sizeof(
int)*width*height);
2005 for(x=0; x<
width; x++){
2006 int tab[4]={0,2,3,1};
2007 buffer[0][x+width*
y]= 256*256*tab[(x&1) + 2*(y&1)];
2012 for(x=0; x<
width; x++){
2013 int64_t d= buffer[0][x + y*
width];
2015 if(
FFABS(width/2-x)<9 &&
FFABS(height/2-y)<9) printf(
"%8"PRId64
" ", d);
2017 if(
FFABS(height/2-y)<9) printf(
"\n");