case PIX_FMT_YUV410P: img_copy(dst->data[0], dst->linesize[0], src->data[0], src->linesize[0], width, height); grow22(dst->data[1], dst->linesize[1], src->data[1], src->linesize[1], width/2, height/2); grow22(dst->data[2], dst->linesize[2], src->data[2], src->linesize[2], width/2, height/2); break;
int img_convert(AVPicture *dst, int dst_pix_fmt,                AVPicture *src, int pix_fmt,                 int width, int height){    int i;    assert(pix_fmt != PIX_FMT_ANY && dst_pix_fmt != PIX_FMT_ANY);    if (dst_pix_fmt == pix_fmt) {        switch(pix_fmt) {        case PIX_FMT_YUV420P:            for(i=0;i<3;i++) {                if (i == 1) {                    width >>= 1;                    height >>= 1;                }                img_copy(dst->data[i], dst->linesize[i],                         src->data[i], src->linesize[i],                         width, height);            }            break;        default:            return -1;        }    } else if (dst_pix_fmt == PIX_FMT_YUV420P) {                switch(pix_fmt) {        case PIX_FMT_YUV420P:            for(i=0;i<3;i++) {                img_copy(dst->data[i], dst->linesize[i],                         src->data[i], src->linesize[i],                         width, height);            }            break;        case PIX_FMT_YUV422P:            img_copy(dst->data[0], dst->linesize[0],                     src->data[0], src->linesize[0],                     width, height);            width >>= 1;            height >>= 1;            for(i=1;i<3;i++) {                shrink2(dst->data[i], dst->linesize[i],                        src->data[i], src->linesize[i],                        width, height);            }            break;        case PIX_FMT_YUV444P:            img_copy(dst->data[0], dst->linesize[0],                     src->data[0], src->linesize[0],                     width, height);            width >>= 1;            height >>= 1;            for(i=1;i<3;i++) {                shrink22(dst->data[i], dst->linesize[i],                         src->data[i], src->linesize[i],                         width, height);            }            break;        case PIX_FMT_YUV422:            yuv422_to_yuv420p(dst->data[0], dst->data[1], dst->data[2],                               src->data[0], width, height);            break;        case PIX_FMT_RGB24:            rgb24_to_yuv420p(dst->data[0], dst->data[1], dst->data[2],                              src->data[0], width, height);            break;        case PIX_FMT_BGR24:            bgr24_to_yuv420p(dst->data[0], dst->data[1], dst->data[2],                              src->data[0], width, height);            break;        default:            return -1;        }    } else if (dst_pix_fmt == PIX_FMT_RGB24) {        switch(pix_fmt) {        case PIX_FMT_YUV420P:            yuv420p_to_rgb24(dst, src, width, height);            break;        case PIX_FMT_YUV422P:            yuv422p_to_rgb24(dst, src, width, height);            break;        default:            return -1;        }    } else {        return -1;    }    return 0;}