static void encode_gray_bitstream(HYuvContext *s, int count){

    int i;

    

    count/=2;

    if(s->flags&CODEC_FLAG_PASS1){

        for(i=0; i<count; i++){

            s->stats[0][ s->temp[0][2*i  ] ]++;

            s->stats[0][ s->temp[0][2*i+1] ]++;

        }

    }else if(s->context){

        for(i=0; i<count; i++){

            s->stats[0][ s->temp[0][2*i  ] ]++;

            put_bits(&s->pb, s->len[0][ s->temp[0][2*i  ] ], s->bits[0][ s->temp[0][2*i  ] ]);

            s->stats[0][ s->temp[0][2*i+1] ]++;

            put_bits(&s->pb, s->len[0][ s->temp[0][2*i+1] ], s->bits[0][ s->temp[0][2*i+1] ]);

        }

    }else{

        for(i=0; i<count; i++){

            put_bits(&s->pb, s->len[0][ s->temp[0][2*i  ] ], s->bits[0][ s->temp[0][2*i  ] ]);

            put_bits(&s->pb, s->len[0][ s->temp[0][2*i+1] ], s->bits[0][ s->temp[0][2*i+1] ]);

        }

    }

}

static void encode_gray_bitstream(HYuvContext *s, int count){

    int i;

    

    count/=2;

    if(s->flags&CODEC_FLAG_PASS1){

        for(i=0; i<count; i++){

            s->stats[0][ s->temp[0][2*i  ] ]++;

            s->stats[0][ s->temp[0][2*i+1] ]++;

        }

    }else if(s->context){

        for(i=0; i<count; i++){

            s->stats[0][ s->temp[0][2*i  ] ]++;

            put_bits(&s->pb, s->len[0][ s->temp[0][2*i  ] ], s->bits[0][ s->temp[0][2*i  ] ]);

            s->stats[0][ s->temp[0][2*i+1] ]++;

            put_bits(&s->pb, s->len[0][ s->temp[0][2*i+1] ], s->bits[0][ s->temp[0][2*i+1] ]);

        }

    }else{

        for(i=0; i<count; i++){

            put_bits(&s->pb, s->len[0][ s->temp[0][2*i  ] ], s->bits[0][ s->temp[0][2*i  ] ]);

            put_bits(&s->pb, s->len[0][ s->temp[0][2*i+1] ], s->bits[0][ s->temp[0][2*i+1] ]);

        }

    }

}

static void encode_gray_bitstream(HYuvContext *s, int count){
static void FUNC_0(HYuvContext *VAR_0, int VAR_1){

    int VAR_2;

    

    VAR_1/=2;

    if(VAR_0->flags&CODEC_FLAG_PASS1){

        for(VAR_2=0; VAR_2<VAR_1; VAR_2++){

            VAR_0->stats[0][ VAR_0->temp[0][2*VAR_2  ] ]++;

            VAR_0->stats[0][ VAR_0->temp[0][2*VAR_2+1] ]++;

        }

    }else if(VAR_0->context){

        for(VAR_2=0; VAR_2<VAR_1; VAR_2++){

            VAR_0->stats[0][ VAR_0->temp[0][2*VAR_2  ] ]++;

            put_bits(&VAR_0->pb, VAR_0->len[0][ VAR_0->temp[0][2*VAR_2  ] ], VAR_0->bits[0][ VAR_0->temp[0][2*VAR_2  ] ]);

            VAR_0->stats[0][ VAR_0->temp[0][2*VAR_2+1] ]++;

            put_bits(&VAR_0->pb, VAR_0->len[0][ VAR_0->temp[0][2*VAR_2+1] ], VAR_0->bits[0][ VAR_0->temp[0][2*VAR_2+1] ]);

        }

    }else{

        for(VAR_2=0; VAR_2<VAR_1; VAR_2++){

            put_bits(&VAR_0->pb, VAR_0->len[0][ VAR_0->temp[0][2*VAR_2  ] ], VAR_0->bits[0][ VAR_0->temp[0][2*VAR_2  ] ]);

            put_bits(&VAR_0->pb, VAR_0->len[0][ VAR_0->temp[0][2*VAR_2+1] ], VAR_0->bits[0][ VAR_0->temp[0][2*VAR_2+1] ]);

        }

    }

}

static void FUNC_0(HYuvContext *VAR_0, int VAR_1){ int VAR_2; VAR_1/=2; if(VAR_0->flags&CODEC_FLAG_PASS1){ for(VAR_2=0; VAR_2<VAR_1; VAR_2++){ VAR_0->stats[0][ VAR_0->temp[0][2*VAR_2  ] ]++; VAR_0->stats[0][ VAR_0->temp[0][2*VAR_2+1] ]++; } }else if(VAR_0->context){ for(VAR_2=0; VAR_2<VAR_1; VAR_2++){ VAR_0->stats[0][ VAR_0->temp[0][2*VAR_2  ] ]++; put_bits(&VAR_0->pb, VAR_0->len[0][ VAR_0->temp[0][2*VAR_2  ] ], VAR_0->bits[0][ VAR_0->temp[0][2*VAR_2  ] ]); VAR_0->stats[0][ VAR_0->temp[0][2*VAR_2+1] ]++; put_bits(&VAR_0->pb, VAR_0->len[0][ VAR_0->temp[0][2*VAR_2+1] ], VAR_0->bits[0][ VAR_0->temp[0][2*VAR_2+1] ]); } }else{ for(VAR_2=0; VAR_2<VAR_1; VAR_2++){ put_bits(&VAR_0->pb, VAR_0->len[0][ VAR_0->temp[0][2*VAR_2  ] ], VAR_0->bits[0][ VAR_0->temp[0][2*VAR_2  ] ]); put_bits(&VAR_0->pb, VAR_0->len[0][ VAR_0->temp[0][2*VAR_2+1] ], VAR_0->bits[0][ VAR_0->temp[0][2*VAR_2+1] ]); } } }