Revision 34017fd9 libavcore/imgutils.c

View differences:

libavcore/imgutils.c
152 152
    }
153 153
}
154 154

  
155
void av_image_copy(uint8_t *dst_data[4], int dst_linesize[4],
156
                   const uint8_t *src_data[4], const int src_linesize[4],
157
                   enum PixelFormat pix_fmt, int width, int height)
158
{
159
    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
160

  
161
    if (desc->flags & PIX_FMT_HWACCEL)
162
        return;
163

  
164
    if (desc->flags & PIX_FMT_PAL) {
165
        av_image_copy_plane(dst_data[0], dst_linesize[0],
166
                            src_data[0], src_linesize[0],
167
                            width, height);
168
        /* copy the palette */
169
        memcpy(dst_data[1], src_data[1], 4*256);
170
    } else {
171
        int i, planes_nb = 0;
172

  
173
        for (i = 0; i < desc->nb_components; i++)
174
            planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1);
175

  
176
        for (i = 0; i < planes_nb; i++) {
177
            int h = height;
178
            int bwidth = av_image_get_linesize(pix_fmt, width, i);
179
            if (i == 1 || i == 2) {
180
                h= -((-height)>>desc->log2_chroma_h);
181
            }
182
            av_image_copy_plane(dst_data[i], dst_linesize[i],
183
                                src_data[i], src_linesize[i],
184
                                bwidth, h);
185
        }
186
    }
187
}
188

  
155 189
#if FF_API_OLD_IMAGE_NAMES
156 190
void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
157 191
                                const AVPixFmtDescriptor *pixdesc)

Also available in: Unified diff