void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
                   const uint8_t *src_data[4], const int src_linesizes[4],
                   enum PixelFormat pix_fmt, int width, int height)
{
    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
    if (desc->flags & PIX_FMT_HWACCEL)
        return;
    if (desc->flags & PIX_FMT_PAL ||
        desc->flags & PIX_FMT_PSEUDOPAL) {
        av_image_copy_plane(dst_data[0], dst_linesizes[0],
                            src_data[0], src_linesizes[0],
                            width, height);
        memcpy(dst_data[1], src_data[1], 4*256);
    } else {
        int i, planes_nb = 0;
        for (i = 0; i < desc->nb_components; i++)
            planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1);
        for (i = 0; i < planes_nb; i++) {
            int h = height;
            int bwidth = av_image_get_linesize(pix_fmt, width, i);
            if (i == 1 || i == 2) {
                h= -((-height)>>desc->log2_chroma_h);
            }
            av_image_copy_plane(dst_data[i], dst_linesizes[i],
                                src_data[i], src_linesizes[i],
                                bwidth, h);
        }
    }
}
['int av_buffersrc_write_frame(AVFilterContext *buffer_filter, const AVFrame *frame)\n{\n    BufferSourceContext *c = buffer_filter->priv;\n    AVFilterBufferRef *buf;\n    int ret;\n    if (!frame) {\n        c->eof = 1;\n        return 0;\n    } else if (c->eof)\n        return AVERROR(EINVAL);\n    if (!av_fifo_space(c->fifo) &&\n        (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) +\n                                         sizeof(buf))) < 0)\n        return ret;\n    switch (buffer_filter->outputs[0]->type) {\n    case AVMEDIA_TYPE_VIDEO:\n        CHECK_VIDEO_PARAM_CHANGE(buffer_filter, c, frame->width, frame->height,\n                                 frame->format);\n        buf = ff_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE,\n                                  c->w, c->h);\n        if (!buf)\n            return AVERROR(ENOMEM);\n        av_image_copy(buf->data, buf->linesize, frame->data, frame->linesize,\n                      c->pix_fmt, c->w, c->h);\n        break;\n    case AVMEDIA_TYPE_AUDIO:\n        CHECK_AUDIO_PARAM_CHANGE(buffer_filter, c, frame->sample_rate, frame->channel_layout,\n                                 frame->format);\n        buf = ff_get_audio_buffer(buffer_filter->outputs[0], AV_PERM_WRITE,\n                                  frame->nb_samples);\n        if (!buf)\n            return AVERROR(ENOMEM);\n        av_samples_copy(buf->extended_data, frame->extended_data,\n                        0, 0, frame->nb_samples,\n                        av_get_channel_layout_nb_channels(frame->channel_layout),\n                        frame->format);\n        break;\n    default:\n        return AVERROR(EINVAL);\n    }\n    avfilter_copy_frame_props(buf, frame);\n    if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) {\n        avfilter_unref_buffer(buf);\n        return ret;\n    }\n    return 0;\n}', 'void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],\n                   const uint8_t *src_data[4], const int src_linesizes[4],\n                   enum PixelFormat pix_fmt, int width, int height)\n{\n    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];\n    if (desc->flags & PIX_FMT_HWACCEL)\n        return;\n    if (desc->flags & PIX_FMT_PAL ||\n        desc->flags & PIX_FMT_PSEUDOPAL) {\n        av_image_copy_plane(dst_data[0], dst_linesizes[0],\n                            src_data[0], src_linesizes[0],\n                            width, height);\n        memcpy(dst_data[1], src_data[1], 4*256);\n    } else {\n        int i, planes_nb = 0;\n        for (i = 0; i < desc->nb_components; i++)\n            planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1);\n        for (i = 0; i < planes_nb; i++) {\n            int h = height;\n            int bwidth = av_image_get_linesize(pix_fmt, width, i);\n            if (i == 1 || i == 2) {\n                h= -((-height)>>desc->log2_chroma_h);\n            }\n            av_image_copy_plane(dst_data[i], dst_linesizes[i],\n                                src_data[i], src_linesizes[i],\n                                bwidth, h);\n        }\n    }\n}']