((uint8_t*)avctx->extradata)[2]=
((uint8_t*)avctx->extradata)[2]= 0x20 | (s->interlaced ? 0x10 : 0);
static int encode_init(AVCodecContext *avctx){    HYuvContext *s = avctx->priv_data;    int i, j, width, height;    s->avctx= avctx;    s->flags= avctx->flags;            dsputil_init(&s->dsp, avctx);        width= s->width= avctx->width;    height= s->height= avctx->height;        assert(width && height);        avctx->extradata= av_mallocz(1024*30);    avctx->stats_out= av_mallocz(1024*30);    s->version=2;        avctx->coded_frame= &s->picture;        switch(avctx->pix_fmt){    case PIX_FMT_YUV420P:        s->bitstream_bpp= 12;        break;    case PIX_FMT_YUV422P:        s->bitstream_bpp= 16;        break;    default:        av_log(avctx, AV_LOG_ERROR, "format not supported\n");        return -1;    }    avctx->bits_per_sample= s->bitstream_bpp;    s->decorrelate= s->bitstream_bpp >= 24;    s->predictor= avctx->prediction_method;        ((uint8_t*)avctx->extradata)[0]= s->predictor;    ((uint8_t*)avctx->extradata)[1]= s->bitstream_bpp;    ((uint8_t*)avctx->extradata)[2]=    ((uint8_t*)avctx->extradata)[3]= 0;    s->avctx->extradata_size= 4;        if(avctx->stats_in){        char *p= avctx->stats_in;            for(i=0; i<3; i++)            for(j=0; j<256; j++)                s->stats[i][j]= 1;        for(;;){            for(i=0; i<3; i++){                char *next;                for(j=0; j<256; j++){                    s->stats[i][j]+= strtol(p, &next, 0);                    if(next==p) return -1;                    p=next;                }                    }            if(p[0]==0 || p[1]==0 || p[2]==0) break;        }    }else{        for(i=0; i<3; i++)            for(j=0; j<256; j++){                int d= FFMIN(j, 256-j);                                s->stats[i][j]= 100000000/(d+1);            }    }        for(i=0; i<3; i++){        generate_len_table(s->len[i], s->stats[i], 256);        if(generate_bits_table(s->bits[i], s->len[i])<0){            return -1;        }                store_table(s, s->len[i]);    }    for(i=0; i<3; i++)        for(j=0; j<256; j++)            s->stats[i][j]= 0;        s->interlaced= height > 288;//    printf("pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_sample, s->interlaced);    s->picture_number=0;    return 0;}