00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef AVCODEC_SNOW_H
00023 #define AVCODEC_SNOW_H
00024
00025 #include "dsputil.h"
00026 #include "dwt.h"
00027
00028 #include "rangecoder.h"
00029 #include "mathops.h"
00030 #include "mpegvideo.h"
00031
00032 #define MID_STATE 128
00033
00034 #define MAX_PLANES 4
00035 #define QSHIFT 5
00036 #define QROOT (1<<QSHIFT)
00037 #define LOSSLESS_QLOG -128
00038 #define FRAC_BITS 4
00039 #define MAX_REF_FRAMES 8
00040
00041 #define LOG2_OBMC_MAX 8
00042 #define OBMC_MAX (1<<(LOG2_OBMC_MAX))
00043 typedef struct BlockNode{
00044 int16_t mx;
00045 int16_t my;
00046 uint8_t ref;
00047 uint8_t color[3];
00048 uint8_t type;
00049
00050 #define BLOCK_INTRA 1
00051 #define BLOCK_OPT 2
00052
00053 uint8_t level;
00054 }BlockNode;
00055
00056 static const BlockNode null_block= {
00057 .color= {128,128,128},
00058 .mx= 0,
00059 .my= 0,
00060 .ref= 0,
00061 .type= 0,
00062 .level= 0,
00063 };
00064
00065 #define LOG2_MB_SIZE 4
00066 #define MB_SIZE (1<<LOG2_MB_SIZE)
00067 #define ENCODER_EXTRA_BITS 4
00068 #define HTAPS_MAX 8
00069
00070 typedef struct x_and_coeff{
00071 int16_t x;
00072 uint16_t coeff;
00073 } x_and_coeff;
00074
00075 typedef struct SubBand{
00076 int level;
00077 int stride;
00078 int width;
00079 int height;
00080 int qlog;
00081 DWTELEM *buf;
00082 IDWTELEM *ibuf;
00083 int buf_x_offset;
00084 int buf_y_offset;
00085 int stride_line;
00086 x_and_coeff * x_coeff;
00087 struct SubBand *parent;
00088 uint8_t state[ 7 + 512][32];
00089 }SubBand;
00090
00091 typedef struct Plane{
00092 int width;
00093 int height;
00094 SubBand band[MAX_DECOMPOSITIONS][4];
00095
00096 int htaps;
00097 int8_t hcoeff[HTAPS_MAX/2];
00098 int diag_mc;
00099 int fast_mc;
00100
00101 int last_htaps;
00102 int8_t last_hcoeff[HTAPS_MAX/2];
00103 int last_diag_mc;
00104 }Plane;
00105
00106 typedef struct SnowContext{
00107 AVClass *class;
00108 AVCodecContext *avctx;
00109 RangeCoder c;
00110 DSPContext dsp;
00111 DWTContext dwt;
00112 AVFrame new_picture;
00113 AVFrame input_picture;
00114 AVFrame current_picture;
00115 AVFrame last_picture[MAX_REF_FRAMES];
00116 uint8_t *halfpel_plane[MAX_REF_FRAMES][4][4];
00117 AVFrame mconly_picture;
00118
00119 uint8_t header_state[32];
00120 uint8_t block_state[128 + 32*128];
00121 int keyframe;
00122 int always_reset;
00123 int version;
00124 int spatial_decomposition_type;
00125 int last_spatial_decomposition_type;
00126 int temporal_decomposition_type;
00127 int spatial_decomposition_count;
00128 int last_spatial_decomposition_count;
00129 int temporal_decomposition_count;
00130 int max_ref_frames;
00131 int ref_frames;
00132 int16_t (*ref_mvs[MAX_REF_FRAMES])[2];
00133 uint32_t *ref_scores[MAX_REF_FRAMES];
00134 DWTELEM *spatial_dwt_buffer;
00135 IDWTELEM *spatial_idwt_buffer;
00136 int colorspace_type;
00137 int chroma_h_shift;
00138 int chroma_v_shift;
00139 int spatial_scalability;
00140 int qlog;
00141 int last_qlog;
00142 int lambda;
00143 int lambda2;
00144 int pass1_rc;
00145 int mv_scale;
00146 int last_mv_scale;
00147 int qbias;
00148 int last_qbias;
00149 #define QBIAS_SHIFT 3
00150 int b_width;
00151 int b_height;
00152 int block_max_depth;
00153 int last_block_max_depth;
00154 Plane plane[MAX_PLANES];
00155 BlockNode *block;
00156 #define ME_CACHE_SIZE 1024
00157 unsigned me_cache[ME_CACHE_SIZE];
00158 unsigned me_cache_generation;
00159 slice_buffer sb;
00160 int memc_only;
00161 int no_bitstream;
00162
00163 MpegEncContext m;
00164
00165 uint8_t *scratchbuf;
00166 int *runs;
00167 }SnowContext;
00168
00169
00170 extern const uint8_t * const ff_obmc_tab[4];
00171 extern uint8_t ff_qexp[QROOT];
00172 extern int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
00173
00174
00175
00176 static av_always_inline void snow_interleave_line_header(int * i, int width, IDWTELEM * low, IDWTELEM * high){
00177 (*i) = (width) - 2;
00178
00179 if (width & 1){
00180 low[(*i)+1] = low[((*i)+1)>>1];
00181 (*i)--;
00182 }
00183 }
00184
00185 static av_always_inline void snow_interleave_line_footer(int * i, IDWTELEM * low, IDWTELEM * high){
00186 for (; (*i)>=0; (*i)-=2){
00187 low[(*i)+1] = high[(*i)>>1];
00188 low[*i] = low[(*i)>>1];
00189 }
00190 }
00191
00192 static av_always_inline void snow_horizontal_compose_lift_lead_out(int i, IDWTELEM * dst, IDWTELEM * src, IDWTELEM * ref, int width, int w, int lift_high, int mul, int add, int shift){
00193 for(; i<w; i++){
00194 dst[i] = src[i] - ((mul * (ref[i] + ref[i + 1]) + add) >> shift);
00195 }
00196
00197 if((width^lift_high)&1){
00198 dst[w] = src[w] - ((mul * 2 * ref[w] + add) >> shift);
00199 }
00200 }
00201
00202 static av_always_inline void snow_horizontal_compose_liftS_lead_out(int i, IDWTELEM * dst, IDWTELEM * src, IDWTELEM * ref, int width, int w){
00203 for(; i<w; i++){
00204 dst[i] = src[i] + ((ref[i] + ref[(i+1)]+W_BO + 4 * src[i]) >> W_BS);
00205 }
00206
00207 if(width&1){
00208 dst[w] = src[w] + ((2 * ref[w] + W_BO + 4 * src[w]) >> W_BS);
00209 }
00210 }
00211
00212
00213
00214 int ff_snow_common_init(AVCodecContext *avctx);
00215 int ff_snow_common_init_after_header(AVCodecContext *avctx);
00216 void ff_snow_common_end(SnowContext *s);
00217 void ff_snow_release_buffer(AVCodecContext *avctx);
00218 void ff_snow_reset_contexts(SnowContext *s);
00219 int ff_snow_alloc_blocks(SnowContext *s);
00220 int ff_snow_frame_start(SnowContext *s);
00221 void ff_snow_pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride,
00222 int sx, int sy, int b_w, int b_h, BlockNode *block,
00223 int plane_index, int w, int h);
00224
00225
00226
00227 static inline void snow_set_blocks(SnowContext *s, int level, int x, int y, int l, int cb, int cr, int mx, int my, int ref, int type){
00228 const int w= s->b_width << s->block_max_depth;
00229 const int rem_depth= s->block_max_depth - level;
00230 const int index= (x + y*w) << rem_depth;
00231 const int block_w= 1<<rem_depth;
00232 BlockNode block;
00233 int i,j;
00234
00235 block.color[0]= l;
00236 block.color[1]= cb;
00237 block.color[2]= cr;
00238 block.mx= mx;
00239 block.my= my;
00240 block.ref= ref;
00241 block.type= type;
00242 block.level= level;
00243
00244 for(j=0; j<block_w; j++){
00245 for(i=0; i<block_w; i++){
00246 s->block[index + i + j*w]= block;
00247 }
00248 }
00249 }
00250
00251 static inline void pred_mv(SnowContext *s, int *mx, int *my, int ref,
00252 const BlockNode *left, const BlockNode *top, const BlockNode *tr){
00253 if(s->ref_frames == 1){
00254 *mx = mid_pred(left->mx, top->mx, tr->mx);
00255 *my = mid_pred(left->my, top->my, tr->my);
00256 }else{
00257 const int *scale = ff_scale_mv_ref[ref];
00258 *mx = mid_pred((left->mx * scale[left->ref] + 128) >>8,
00259 (top ->mx * scale[top ->ref] + 128) >>8,
00260 (tr ->mx * scale[tr ->ref] + 128) >>8);
00261 *my = mid_pred((left->my * scale[left->ref] + 128) >>8,
00262 (top ->my * scale[top ->ref] + 128) >>8,
00263 (tr ->my * scale[tr ->ref] + 128) >>8);
00264 }
00265 }
00266
00267 static av_always_inline int same_block(BlockNode *a, BlockNode *b){
00268 if((a->type&BLOCK_INTRA) && (b->type&BLOCK_INTRA)){
00269 return !((a->color[0] - b->color[0]) | (a->color[1] - b->color[1]) | (a->color[2] - b->color[2]));
00270 }else{
00271 return !((a->mx - b->mx) | (a->my - b->my) | (a->ref - b->ref) | ((a->type ^ b->type)&BLOCK_INTRA));
00272 }
00273 }
00274
00275
00276
00277 static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer *sb, IDWTELEM *dst, uint8_t *dst8, const uint8_t *obmc, int src_x, int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index){
00278 const int b_width = s->b_width << s->block_max_depth;
00279 const int b_height= s->b_height << s->block_max_depth;
00280 const int b_stride= b_width;
00281 BlockNode *lt= &s->block[b_x + b_y*b_stride];
00282 BlockNode *rt= lt+1;
00283 BlockNode *lb= lt+b_stride;
00284 BlockNode *rb= lb+1;
00285 uint8_t *block[4];
00286 int tmp_step= src_stride >= 7*MB_SIZE ? MB_SIZE : MB_SIZE*src_stride;
00287 uint8_t *tmp = s->scratchbuf;
00288 uint8_t *ptmp;
00289 int x,y;
00290
00291 if(b_x<0){
00292 lt= rt;
00293 lb= rb;
00294 }else if(b_x + 1 >= b_width){
00295 rt= lt;
00296 rb= lb;
00297 }
00298 if(b_y<0){
00299 lt= lb;
00300 rt= rb;
00301 }else if(b_y + 1 >= b_height){
00302 lb= lt;
00303 rb= rt;
00304 }
00305
00306 if(src_x<0){
00307 obmc -= src_x;
00308 b_w += src_x;
00309 if(!sliced && !offset_dst)
00310 dst -= src_x;
00311 src_x=0;
00312 }else if(src_x + b_w > w){
00313 b_w = w - src_x;
00314 }
00315 if(src_y<0){
00316 obmc -= src_y*obmc_stride;
00317 b_h += src_y;
00318 if(!sliced && !offset_dst)
00319 dst -= src_y*dst_stride;
00320 src_y=0;
00321 }else if(src_y + b_h> h){
00322 b_h = h - src_y;
00323 }
00324
00325 if(b_w<=0 || b_h<=0) return;
00326
00327 assert(src_stride > 2*MB_SIZE + 5);
00328
00329 if(!sliced && offset_dst)
00330 dst += src_x + src_y*dst_stride;
00331 dst8+= src_x + src_y*src_stride;
00332
00333
00334 ptmp= tmp + 3*tmp_step;
00335 block[0]= ptmp;
00336 ptmp+=tmp_step;
00337 ff_snow_pred_block(s, block[0], tmp, src_stride, src_x, src_y, b_w, b_h, lt, plane_index, w, h);
00338
00339 if(same_block(lt, rt)){
00340 block[1]= block[0];
00341 }else{
00342 block[1]= ptmp;
00343 ptmp+=tmp_step;
00344 ff_snow_pred_block(s, block[1], tmp, src_stride, src_x, src_y, b_w, b_h, rt, plane_index, w, h);
00345 }
00346
00347 if(same_block(lt, lb)){
00348 block[2]= block[0];
00349 }else if(same_block(rt, lb)){
00350 block[2]= block[1];
00351 }else{
00352 block[2]= ptmp;
00353 ptmp+=tmp_step;
00354 ff_snow_pred_block(s, block[2], tmp, src_stride, src_x, src_y, b_w, b_h, lb, plane_index, w, h);
00355 }
00356
00357 if(same_block(lt, rb) ){
00358 block[3]= block[0];
00359 }else if(same_block(rt, rb)){
00360 block[3]= block[1];
00361 }else if(same_block(lb, rb)){
00362 block[3]= block[2];
00363 }else{
00364 block[3]= ptmp;
00365 ff_snow_pred_block(s, block[3], tmp, src_stride, src_x, src_y, b_w, b_h, rb, plane_index, w, h);
00366 }
00367 if(sliced){
00368 s->dwt.inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
00369 }else{
00370 for(y=0; y<b_h; y++){
00371
00372 const uint8_t *obmc1= obmc + y*obmc_stride;
00373 const uint8_t *obmc2= obmc1+ (obmc_stride>>1);
00374 const uint8_t *obmc3= obmc1+ obmc_stride*(obmc_stride>>1);
00375 const uint8_t *obmc4= obmc3+ (obmc_stride>>1);
00376 for(x=0; x<b_w; x++){
00377 int v= obmc1[x] * block[3][x + y*src_stride]
00378 +obmc2[x] * block[2][x + y*src_stride]
00379 +obmc3[x] * block[1][x + y*src_stride]
00380 +obmc4[x] * block[0][x + y*src_stride];
00381
00382 v <<= 8 - LOG2_OBMC_MAX;
00383 if(FRAC_BITS != 8){
00384 v >>= 8 - FRAC_BITS;
00385 }
00386 if(add){
00387 v += dst[x + y*dst_stride];
00388 v = (v + (1<<(FRAC_BITS-1))) >> FRAC_BITS;
00389 if(v&(~255)) v= ~(v>>31);
00390 dst8[x + y*src_stride] = v;
00391 }else{
00392 dst[x + y*dst_stride] -= v;
00393 }
00394 }
00395 }
00396 }
00397 }
00398
00399 static av_always_inline void predict_slice(SnowContext *s, IDWTELEM *buf, int plane_index, int add, int mb_y){
00400 Plane *p= &s->plane[plane_index];
00401 const int mb_w= s->b_width << s->block_max_depth;
00402 const int mb_h= s->b_height << s->block_max_depth;
00403 int x, y, mb_x;
00404 int block_size = MB_SIZE >> s->block_max_depth;
00405 int block_w = plane_index ? block_size/2 : block_size;
00406 const uint8_t *obmc = plane_index ? ff_obmc_tab[s->block_max_depth+1] : ff_obmc_tab[s->block_max_depth];
00407 const int obmc_stride= plane_index ? block_size : 2*block_size;
00408 int ref_stride= s->current_picture.linesize[plane_index];
00409 uint8_t *dst8= s->current_picture.data[plane_index];
00410 int w= p->width;
00411 int h= p->height;
00412
00413 if(s->keyframe || (s->avctx->debug&512)){
00414 if(mb_y==mb_h)
00415 return;
00416
00417 if(add){
00418 for(y=block_w*mb_y; y<FFMIN(h,block_w*(mb_y+1)); y++){
00419 for(x=0; x<w; x++){
00420 int v= buf[x + y*w] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1));
00421 v >>= FRAC_BITS;
00422 if(v&(~255)) v= ~(v>>31);
00423 dst8[x + y*ref_stride]= v;
00424 }
00425 }
00426 }else{
00427 for(y=block_w*mb_y; y<FFMIN(h,block_w*(mb_y+1)); y++){
00428 for(x=0; x<w; x++){
00429 buf[x + y*w]-= 128<<FRAC_BITS;
00430 }
00431 }
00432 }
00433
00434 return;
00435 }
00436
00437 for(mb_x=0; mb_x<=mb_w; mb_x++){
00438 add_yblock(s, 0, NULL, buf, dst8, obmc,
00439 block_w*mb_x - block_w/2,
00440 block_w*mb_y - block_w/2,
00441 block_w, block_w,
00442 w, h,
00443 w, ref_stride, obmc_stride,
00444 mb_x - 1, mb_y - 1,
00445 add, 1, plane_index);
00446 }
00447 }
00448
00449 static av_always_inline void predict_plane(SnowContext *s, IDWTELEM *buf, int plane_index, int add){
00450 const int mb_h= s->b_height << s->block_max_depth;
00451 int mb_y;
00452 for(mb_y=0; mb_y<=mb_h; mb_y++)
00453 predict_slice(s, buf, plane_index, add, mb_y);
00454 }
00455
00456 static inline void set_blocks(SnowContext *s, int level, int x, int y, int l, int cb, int cr, int mx, int my, int ref, int type){
00457 const int w= s->b_width << s->block_max_depth;
00458 const int rem_depth= s->block_max_depth - level;
00459 const int index= (x + y*w) << rem_depth;
00460 const int block_w= 1<<rem_depth;
00461 BlockNode block;
00462 int i,j;
00463
00464 block.color[0]= l;
00465 block.color[1]= cb;
00466 block.color[2]= cr;
00467 block.mx= mx;
00468 block.my= my;
00469 block.ref= ref;
00470 block.type= type;
00471 block.level= level;
00472
00473 for(j=0; j<block_w; j++){
00474 for(i=0; i<block_w; i++){
00475 s->block[index + i + j*w]= block;
00476 }
00477 }
00478 }
00479
00480 static inline void init_ref(MotionEstContext *c, uint8_t *src[3], uint8_t *ref[3], uint8_t *ref2[3], int x, int y, int ref_index){
00481 const int offset[3]= {
00482 y*c-> stride + x,
00483 ((y*c->uvstride + x)>>1),
00484 ((y*c->uvstride + x)>>1),
00485 };
00486 int i;
00487 for(i=0; i<3; i++){
00488 c->src[0][i]= src [i];
00489 c->ref[0][i]= ref [i] + offset[i];
00490 }
00491 assert(!ref_index);
00492 }
00493
00494
00495
00496
00497 extern const int8_t ff_quant3bA[256];
00498
00499 #define QEXPSHIFT (7-FRAC_BITS+8) //FIXME try to change this to 0
00500
00501 static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signed){
00502 int i;
00503
00504 if(v){
00505 const int a= FFABS(v);
00506 const int e= av_log2(a);
00507 const int el= FFMIN(e, 10);
00508 put_rac(c, state+0, 0);
00509
00510 for(i=0; i<el; i++){
00511 put_rac(c, state+1+i, 1);
00512 }
00513 for(; i<e; i++){
00514 put_rac(c, state+1+9, 1);
00515 }
00516 put_rac(c, state+1+FFMIN(i,9), 0);
00517
00518 for(i=e-1; i>=el; i--){
00519 put_rac(c, state+22+9, (a>>i)&1);
00520 }
00521 for(; i>=0; i--){
00522 put_rac(c, state+22+i, (a>>i)&1);
00523 }
00524
00525 if(is_signed)
00526 put_rac(c, state+11 + el, v < 0);
00527 }else{
00528 put_rac(c, state+0, 1);
00529 }
00530 }
00531
00532 static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){
00533 if(get_rac(c, state+0))
00534 return 0;
00535 else{
00536 int i, e, a;
00537 e= 0;
00538 while(get_rac(c, state+1 + FFMIN(e,9))){
00539 e++;
00540 }
00541
00542 a= 1;
00543 for(i=e-1; i>=0; i--){
00544 a += a + get_rac(c, state+22 + FFMIN(i,9));
00545 }
00546
00547 e= -(is_signed && get_rac(c, state+11 + FFMIN(e,10)));
00548 return (a^e)-e;
00549 }
00550 }
00551
00552 static inline void put_symbol2(RangeCoder *c, uint8_t *state, int v, int log2){
00553 int i;
00554 int r= log2>=0 ? 1<<log2 : 1;
00555
00556 assert(v>=0);
00557 assert(log2>=-4);
00558
00559 while(v >= r){
00560 put_rac(c, state+4+log2, 1);
00561 v -= r;
00562 log2++;
00563 if(log2>0) r+=r;
00564 }
00565 put_rac(c, state+4+log2, 0);
00566
00567 for(i=log2-1; i>=0; i--){
00568 put_rac(c, state+31-i, (v>>i)&1);
00569 }
00570 }
00571
00572 static inline int get_symbol2(RangeCoder *c, uint8_t *state, int log2){
00573 int i;
00574 int r= log2>=0 ? 1<<log2 : 1;
00575 int v=0;
00576
00577 assert(log2>=-4);
00578
00579 while(get_rac(c, state+4+log2)){
00580 v+= r;
00581 log2++;
00582 if(log2>0) r+=r;
00583 }
00584
00585 for(i=log2-1; i>=0; i--){
00586 v+= get_rac(c, state+31-i)<<i;
00587 }
00588
00589 return v;
00590 }
00591
00592 static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, int orientation){
00593 const int w= b->width;
00594 const int h= b->height;
00595 int x,y;
00596
00597 int run, runs;
00598 x_and_coeff *xc= b->x_coeff;
00599 x_and_coeff *prev_xc= NULL;
00600 x_and_coeff *prev2_xc= xc;
00601 x_and_coeff *parent_xc= parent ? parent->x_coeff : NULL;
00602 x_and_coeff *prev_parent_xc= parent_xc;
00603
00604 runs= get_symbol2(&s->c, b->state[30], 0);
00605 if(runs-- > 0) run= get_symbol2(&s->c, b->state[1], 3);
00606 else run= INT_MAX;
00607
00608 for(y=0; y<h; y++){
00609 int v=0;
00610 int lt=0, t=0, rt=0;
00611
00612 if(y && prev_xc->x == 0){
00613 rt= prev_xc->coeff;
00614 }
00615 for(x=0; x<w; x++){
00616 int p=0;
00617 const int l= v;
00618
00619 lt= t; t= rt;
00620
00621 if(y){
00622 if(prev_xc->x <= x)
00623 prev_xc++;
00624 if(prev_xc->x == x + 1)
00625 rt= prev_xc->coeff;
00626 else
00627 rt=0;
00628 }
00629 if(parent_xc){
00630 if(x>>1 > parent_xc->x){
00631 parent_xc++;
00632 }
00633 if(x>>1 == parent_xc->x){
00634 p= parent_xc->coeff;
00635 }
00636 }
00637 if(l|lt|t|rt|p){
00638 int context= av_log2(3*(l>>1) + (lt>>1) + (t&~1) + (rt>>1) + (p>>1));
00639
00640 v=get_rac(&s->c, &b->state[0][context]);
00641 if(v){
00642 v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1);
00643 v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + ff_quant3bA[l&0xFF] + 3*ff_quant3bA[t&0xFF]]);
00644
00645 xc->x=x;
00646 (xc++)->coeff= v;
00647 }
00648 }else{
00649 if(!run){
00650 if(runs-- > 0) run= get_symbol2(&s->c, b->state[1], 3);
00651 else run= INT_MAX;
00652 v= 2*(get_symbol2(&s->c, b->state[0 + 2], 0-4) + 1);
00653 v+=get_rac(&s->c, &b->state[0][16 + 1 + 3]);
00654
00655 xc->x=x;
00656 (xc++)->coeff= v;
00657 }else{
00658 int max_run;
00659 run--;
00660 v=0;
00661
00662 if(y) max_run= FFMIN(run, prev_xc->x - x - 2);
00663 else max_run= FFMIN(run, w-x-1);
00664 if(parent_xc)
00665 max_run= FFMIN(max_run, 2*parent_xc->x - x - 1);
00666 x+= max_run;
00667 run-= max_run;
00668 }
00669 }
00670 }
00671 (xc++)->x= w+1;
00672 prev_xc= prev2_xc;
00673 prev2_xc= xc;
00674
00675 if(parent_xc){
00676 if(y&1){
00677 while(parent_xc->x != parent->width+1)
00678 parent_xc++;
00679 parent_xc++;
00680 prev_parent_xc= parent_xc;
00681 }else{
00682 parent_xc= prev_parent_xc;
00683 }
00684 }
00685 }
00686
00687 (xc++)->x= w+1;
00688 }
00689
00690 #endif