static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, int orientation){

    const int w= b->width;

    const int h= b->height;

    int x,y;

    

    if(1){

        int run;

        x_and_coeff *xc= b->x_coeff;

        x_and_coeff *prev_xc= NULL;

        x_and_coeff *prev2_xc= xc;

        x_and_coeff *parent_xc= parent ? parent->x_coeff : NULL;

        x_and_coeff *prev_parent_xc= parent_xc;



        run= get_symbol2(&s->c, b->state[1], 3);

        for(y=0; y<h; y++){

            int v=0;

            int lt=0, t=0, rt=0;



            if(y && prev_xc->x == 0){

                rt= prev_xc->coeff;

            }

            for(x=0; x<w; x++){

                int p=0;

                const int l= v;

                

                lt= t; t= rt;



                if(y){

                    if(prev_xc->x <= x)

                        prev_xc++;

                    if(prev_xc->x == x + 1)

                        rt= prev_xc->coeff;

                    else

                        rt=0;

                }

                if(parent_xc){

                    if(x>>1 > parent_xc->x){

                        parent_xc++;

                    }

                    if(x>>1 == parent_xc->x){

                        p= parent_xc->coeff;

                    }

                }

                if(/*ll|*/l|lt|t|rt|p){

                    int context= av_log2(/*ABS(ll) + */3*(l>>1) + (lt>>1) + (t&~1) + (rt>>1) + (p>>1));



                    v=get_rac(&s->c, &b->state[0][context]);

                    if(v){

                        v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1);

                        v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l&0xFF] + 3*quant3bA[t&0xFF]]);

                        

                        xc->x=x;

                        (xc++)->coeff= v;

                    }

                }else{

                    if(!run){

                        run= get_symbol2(&s->c, b->state[1], 3);

                        v= 2*(get_symbol2(&s->c, b->state[0 + 2], 0-4) + 1);

                        v+=get_rac(&s->c, &b->state[0][16 + 1 + 3]);

                        

                        xc->x=x;

                        (xc++)->coeff= v;

                    }else{

                        int max_run;

                        run--;

                        v=0;



                        if(y) max_run= FFMIN(run, prev_xc->x - x - 2);

                        else  max_run= FFMIN(run, w-x-1);

                        if(parent_xc)

                            max_run= FFMIN(max_run, 2*parent_xc->x - x - 1);

                        x+= max_run;

                        run-= max_run;

                    }

                }

            }

            (xc++)->x= w+1; //end marker

            prev_xc= prev2_xc;

            prev2_xc= xc;

            

            if(parent_xc){

                if(y&1){

                    while(parent_xc->x != parent->width+1)

                        parent_xc++;

                    parent_xc++;

                    prev_parent_xc= parent_xc;

                }else{

                    parent_xc= prev_parent_xc;

                }

            }

        }



        (xc++)->x= w+1; //end marker

    }

}

static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, int orientation){

    const int w= b->width;

    const int h= b->height;

    int x,y;

    

    if(1){

        int run;

        x_and_coeff *xc= b->x_coeff;

        x_and_coeff *prev_xc= NULL;

        x_and_coeff *prev2_xc= xc;

        x_and_coeff *parent_xc= parent ? parent->x_coeff : NULL;

        x_and_coeff *prev_parent_xc= parent_xc;



        run= get_symbol2(&s->c, b->state[1], 3);

        for(y=0; y<h; y++){

            int v=0;

            int lt=0, t=0, rt=0;



            if(y && prev_xc->x == 0){

                rt= prev_xc->coeff;

            }

            for(x=0; x<w; x++){

                int p=0;

                const int l= v;

                

                lt= t; t= rt;



                if(y){

                    if(prev_xc->x <= x)

                        prev_xc++;

                    if(prev_xc->x == x + 1)

                        rt= prev_xc->coeff;

                    else

                        rt=0;

                }

                if(parent_xc){

                    if(x>>1 > parent_xc->x){

                        parent_xc++;

                    }

                    if(x>>1 == parent_xc->x){

                        p= parent_xc->coeff;

                    }

                }

                if(l|lt|t|rt|p){

                    int context= av_log2(3*(l>>1) + (lt>>1) + (t&~1) + (rt>>1) + (p>>1));



                    v=get_rac(&s->c, &b->state[0][context]);

                    if(v){

                        v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1);

                        v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l&0xFF] + 3*quant3bA[t&0xFF]]);

                        

                        xc->x=x;

                        (xc++)->coeff= v;

                    }

                }else{

                    if(!run){

                        run= get_symbol2(&s->c, b->state[1], 3);

                        v= 2*(get_symbol2(&s->c, b->state[0 + 2], 0-4) + 1);

                        v+=get_rac(&s->c, &b->state[0][16 + 1 + 3]);

                        

                        xc->x=x;

                        (xc++)->coeff= v;

                    }else{

                        int max_run;

                        run--;

                        v=0;



                        if(y) max_run= FFMIN(run, prev_xc->x - x - 2);

                        else  max_run= FFMIN(run, w-x-1);

                        if(parent_xc)

                            max_run= FFMIN(max_run, 2*parent_xc->x - x - 1);

                        x+= max_run;

                        run-= max_run;

                    }

                }

            }

            (xc++)->x= w+1; 

            prev_xc= prev2_xc;

            prev2_xc= xc;

            

            if(parent_xc){

                if(y&1){

                    while(parent_xc->x != parent->width+1)

                        parent_xc++;

                    parent_xc++;

                    prev_parent_xc= parent_xc;

                }else{

                    parent_xc= prev_parent_xc;

                }

            }

        }



        (xc++)->x= w+1; 

    }

}

static inline void FUNC_0(SnowContext *VAR_0, SubBand *VAR_1, SubBand * VAR_2, int VAR_3){

    const int VAR_4= VAR_1->width;

    const int VAR_5= VAR_1->height;

    int VAR_6,VAR_7;

    

    if(1){

        int VAR_8;

        x_and_coeff *xc= VAR_1->x_coeff;

        x_and_coeff *prev_xc= NULL;

        x_and_coeff *prev2_xc= xc;

        x_and_coeff *parent_xc= VAR_2 ? VAR_2->x_coeff : NULL;

        x_and_coeff *prev_parent_xc= parent_xc;



        VAR_8= get_symbol2(&VAR_0->c, VAR_1->state[1], 3);

        for(VAR_7=0; VAR_7<VAR_5; VAR_7++){

            int VAR_9=0;

            int VAR_10=0, VAR_11=0, VAR_12=0;



            if(VAR_7 && prev_xc->VAR_6 == 0){

                VAR_12= prev_xc->coeff;

            }

            for(VAR_6=0; VAR_6<VAR_4; VAR_6++){

                int VAR_13=0;

                const int VAR_14= VAR_9;

                

                VAR_10= VAR_11; VAR_11= VAR_12;



                if(VAR_7){

                    if(prev_xc->VAR_6 <= VAR_6)

                        prev_xc++;

                    if(prev_xc->VAR_6 == VAR_6 + 1)

                        VAR_12= prev_xc->coeff;

                    else

                        VAR_12=0;

                }

                if(parent_xc){

                    if(VAR_6>>1 > parent_xc->VAR_6){

                        parent_xc++;

                    }

                    if(VAR_6>>1 == parent_xc->VAR_6){

                        VAR_13= parent_xc->coeff;

                    }

                }

                if(VAR_14|VAR_10|VAR_11|VAR_12|VAR_13){

                    int VAR_15= av_log2(3*(VAR_14>>1) + (VAR_10>>1) + (VAR_11&~1) + (VAR_12>>1) + (VAR_13>>1));



                    VAR_9=get_rac(&VAR_0->c, &VAR_1->state[0][VAR_15]);

                    if(VAR_9){

                        VAR_9= 2*(get_symbol2(&VAR_0->c, VAR_1->state[VAR_15 + 2], VAR_15-4) + 1);

                        VAR_9+=get_rac(&VAR_0->c, &VAR_1->state[0][16 + 1 + 3 + quant3bA[VAR_14&0xFF] + 3*quant3bA[VAR_11&0xFF]]);

                        

                        xc->VAR_6=VAR_6;

                        (xc++)->coeff= VAR_9;

                    }

                }else{

                    if(!VAR_8){

                        VAR_8= get_symbol2(&VAR_0->c, VAR_1->state[1], 3);

                        VAR_9= 2*(get_symbol2(&VAR_0->c, VAR_1->state[0 + 2], 0-4) + 1);

                        VAR_9+=get_rac(&VAR_0->c, &VAR_1->state[0][16 + 1 + 3]);

                        

                        xc->VAR_6=VAR_6;

                        (xc++)->coeff= VAR_9;

                    }else{

                        int VAR_16;

                        VAR_8--;

                        VAR_9=0;



                        if(VAR_7) VAR_16= FFMIN(VAR_8, prev_xc->VAR_6 - VAR_6 - 2);

                        else  VAR_16= FFMIN(VAR_8, VAR_4-VAR_6-1);

                        if(parent_xc)

                            VAR_16= FFMIN(VAR_16, 2*parent_xc->VAR_6 - VAR_6 - 1);

                        VAR_6+= VAR_16;

                        VAR_8-= VAR_16;

                    }

                }

            }

            (xc++)->VAR_6= VAR_4+1; 

            prev_xc= prev2_xc;

            prev2_xc= xc;

            

            if(parent_xc){

                if(VAR_7&1){

                    while(parent_xc->VAR_6 != VAR_2->width+1)

                        parent_xc++;

                    parent_xc++;

                    prev_parent_xc= parent_xc;

                }else{

                    parent_xc= prev_parent_xc;

                }

            }

        }



        (xc++)->VAR_6= VAR_4+1; 

    }

}

static inline void FUNC_0(SnowContext *VAR_0, SubBand *VAR_1, SubBand * VAR_2, int VAR_3){ const int VAR_4= VAR_1->width; const int VAR_5= VAR_1->height; int VAR_6,VAR_7; if(1){ int VAR_8; x_and_coeff *xc= VAR_1->x_coeff; x_and_coeff *prev_xc= NULL; x_and_coeff *prev2_xc= xc; x_and_coeff *parent_xc= VAR_2 ? VAR_2->x_coeff : NULL; x_and_coeff *prev_parent_xc= parent_xc; VAR_8= get_symbol2(&VAR_0->c, VAR_1->state[1], 3); for(VAR_7=0; VAR_7<VAR_5; VAR_7++){ int VAR_9=0; int VAR_10=0, VAR_11=0, VAR_12=0; if(VAR_7 && prev_xc->VAR_6 == 0){ VAR_12= prev_xc->coeff; } for(VAR_6=0; VAR_6<VAR_4; VAR_6++){ int VAR_13=0; const int VAR_14= VAR_9; VAR_10= VAR_11; VAR_11= VAR_12; if(VAR_7){ if(prev_xc->VAR_6 <= VAR_6)
prev_xc++; if(prev_xc->VAR_6 == VAR_6 + 1)
VAR_12= prev_xc->coeff; else
VAR_12=0; } if(parent_xc){ if(VAR_6>>1 > parent_xc->VAR_6){ parent_xc++; } if(VAR_6>>1 == parent_xc->VAR_6){ VAR_13= parent_xc->coeff; } } if(VAR_14|VAR_10|VAR_11|VAR_12|VAR_13){ int VAR_15= av_log2(3*(VAR_14>>1) + (VAR_10>>1) + (VAR_11&~1) + (VAR_12>>1) + (VAR_13>>1)); VAR_9=get_rac(&VAR_0->c, &VAR_1->state[0][VAR_15]); if(VAR_9){ VAR_9= 2*(get_symbol2(&VAR_0->c, VAR_1->state[VAR_15 + 2], VAR_15-4) + 1); VAR_9+=get_rac(&VAR_0->c, &VAR_1->state[0][16 + 1 + 3 + quant3bA[VAR_14&0xFF] + 3*quant3bA[VAR_11&0xFF]]); xc->VAR_6=VAR_6; (xc++)->coeff= VAR_9; } }else{ if(!VAR_8){ VAR_8= get_symbol2(&VAR_0->c, VAR_1->state[1], 3); VAR_9= 2*(get_symbol2(&VAR_0->c, VAR_1->state[0 + 2], 0-4) + 1); VAR_9+=get_rac(&VAR_0->c, &VAR_1->state[0][16 + 1 + 3]); xc->VAR_6=VAR_6; (xc++)->coeff= VAR_9; }else{ int VAR_16; VAR_8--; VAR_9=0; if(VAR_7) VAR_16= FFMIN(VAR_8, prev_xc->VAR_6 - VAR_6 - 2); else  VAR_16= FFMIN(VAR_8, VAR_4-VAR_6-1); if(parent_xc)
VAR_16= FFMIN(VAR_16, 2*parent_xc->VAR_6 - VAR_6 - 1); VAR_6+= VAR_16; VAR_8-= VAR_16; } } } (xc++)->VAR_6= VAR_4+1; prev_xc= prev2_xc; prev2_xc= xc; if(parent_xc){ if(VAR_7&1){ while(parent_xc->VAR_6 != VAR_2->width+1)
parent_xc++; parent_xc++; prev_parent_xc= parent_xc; }else{ parent_xc= prev_parent_xc; } } } (xc++)->VAR_6= VAR_4+1; } }