pic->data[i] = pic->base[i];
buf->data[i] = buf->base[i];
int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){    int i;    const int width = s->width;    const int height= s->height;    DefaultPicOpaque *opaque;        assert(pic->data[0]==NULL);    assert(pic->type==0 || pic->type==FF_BUFFER_TYPE_INTERNAL);    if(pic->opaque){        opaque= (DefaultPicOpaque *)pic->opaque;        for(i=0; i<3; i++)            pic->data[i]= opaque->data[i];//    printf("get_buffer %X coded_pic_num:%d last:%d\n", pic->opaque, pic->coded_picture_number, opaque->last_pic_num);            pic->age= pic->coded_picture_number - opaque->last_pic_num;        opaque->last_pic_num= pic->coded_picture_number;//printf("age: %d %d %d\n", pic->age, c->picture_number, pic->coded_picture_number);    }else{        int align, h_chroma_shift, v_chroma_shift;        int w, h, pixel_size;                avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift);                switch(s->pix_fmt){        case PIX_FMT_YUV422:            pixel_size=2;            break;        case PIX_FMT_RGB24:        case PIX_FMT_BGR24:            pixel_size=3;            break;        case PIX_FMT_RGBA32:            pixel_size=4;            break;        default:            pixel_size=1;        }                if(s->codec_id==CODEC_ID_SVQ1) align=63;        else                           align=15;            w= (width +align)&~align;        h= (height+align)&~align;            if(!(s->flags&CODEC_FLAG_EMU_EDGE)){            w+= EDGE_WIDTH*2;            h+= EDGE_WIDTH*2;        }                opaque= av_mallocz(sizeof(DefaultPicOpaque));        if(opaque==NULL) return -1;        pic->opaque= opaque;        opaque->last_pic_num= -256*256*256*64;        for(i=0; i<3; i++){            const int h_shift= i==0 ? 0 : h_chroma_shift;            const int v_shift= i==0 ? 0 : v_chroma_shift;            pic->linesize[i]= pixel_size*w>>h_shift;            pic->base[i]= av_mallocz((pic->linesize[i]*h>>v_shift)+16); //FIXME 16            if(pic->base[i]==NULL) return -1;            memset(pic->base[i], 128, pic->linesize[i]*h>>v_shift);                    if(s->flags&CODEC_FLAG_EMU_EDGE)                pic->data[i] = pic->base[i];            else                pic->data[i] = pic->base[i] + (pic->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift);                        opaque->data[i]= pic->data[i];        }        pic->age= 256*256*256*64;        pic->type= FF_BUFFER_TYPE_INTERNAL;    }    return 0;}