comparison imgutils.c @ 24:c063c88b1309 libavcore

Move av_picture_data_copy() to libavcore, and rename it av_image_copy().
author stefano
date Tue, 07 Sep 2010 21:23:55 +0000
parents 478992775cf8
children 63d8168fa16a
comparison
equal deleted inserted replaced
23:478992775cf8 24:c063c88b1309
150 dst += dst_linesize; 150 dst += dst_linesize;
151 src += src_linesize; 151 src += src_linesize;
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 #if FF_API_OLD_IMAGE_NAMES 189 #if FF_API_OLD_IMAGE_NAMES
156 void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], 190 void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
157 const AVPixFmtDescriptor *pixdesc) 191 const AVPixFmtDescriptor *pixdesc)
158 { 192 {
159 av_image_fill_max_pixsteps(max_pixsteps, max_pixstep_comps, pixdesc); 193 av_image_fill_max_pixsteps(max_pixsteps, max_pixstep_comps, pixdesc);