Mercurial > libavcodec.hg
comparison imgconvert.c @ 4624:6a900f539e2c libavcodec
Add the prefix "av_" to img_crop(), img_copy() and img_pad(), and rename "img"
to "picture" as suggested by Baptiste Coudurier.
author | takis |
---|---|
date | Sun, 04 Mar 2007 11:53:11 +0000 |
parents | 2aea8bf268d8 |
children | e02f7d142ce9 |
comparison
equal
deleted
inserted
replaced
4623:e541c0dd35dd | 4624:6a900f539e2c |
---|---|
731 dst += dst_wrap; | 731 dst += dst_wrap; |
732 src += src_wrap; | 732 src += src_wrap; |
733 } | 733 } |
734 } | 734 } |
735 | 735 |
736 void img_copy(AVPicture *dst, const AVPicture *src, | 736 void av_picture_copy(AVPicture *dst, const AVPicture *src, |
737 int pix_fmt, int width, int height) | 737 int pix_fmt, int width, int height) |
738 { | 738 { |
739 int bwidth, bits, i; | 739 int bwidth, bits, i; |
740 const PixFmtInfo *pf = &pix_fmt_info[pix_fmt]; | 740 const PixFmtInfo *pf = &pix_fmt_info[pix_fmt]; |
741 | 741 |
2212 return (ps->color_type == FF_COLOR_YUV || | 2212 return (ps->color_type == FF_COLOR_YUV || |
2213 ps->color_type == FF_COLOR_YUV_JPEG) && | 2213 ps->color_type == FF_COLOR_YUV_JPEG) && |
2214 ps->pixel_type == FF_PIXEL_PLANAR; | 2214 ps->pixel_type == FF_PIXEL_PLANAR; |
2215 } | 2215 } |
2216 | 2216 |
2217 int img_crop(AVPicture *dst, const AVPicture *src, | 2217 int av_picture_crop(AVPicture *dst, const AVPicture *src, |
2218 int pix_fmt, int top_band, int left_band) | 2218 int pix_fmt, int top_band, int left_band) |
2219 { | 2219 { |
2220 int y_shift; | 2220 int y_shift; |
2221 int x_shift; | 2221 int x_shift; |
2222 | 2222 |
2234 dst->linesize[1] = src->linesize[1]; | 2234 dst->linesize[1] = src->linesize[1]; |
2235 dst->linesize[2] = src->linesize[2]; | 2235 dst->linesize[2] = src->linesize[2]; |
2236 return 0; | 2236 return 0; |
2237 } | 2237 } |
2238 | 2238 |
2239 int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, | 2239 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, |
2240 int pix_fmt, int padtop, int padbottom, int padleft, int padright, | 2240 int pix_fmt, int padtop, int padbottom, int padleft, int padright, |
2241 int *color) | 2241 int *color) |
2242 { | 2242 { |
2243 uint8_t *optr; | 2243 uint8_t *optr; |
2244 int y_shift; | 2244 int y_shift; |
2294 } | 2294 } |
2295 } | 2295 } |
2296 return 0; | 2296 return 0; |
2297 } | 2297 } |
2298 | 2298 |
2299 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | |
2300 void img_copy(AVPicture *dst, const AVPicture *src, | |
2301 int pix_fmt, int width, int height) | |
2302 { | |
2303 av_picture_copy(dst, src, pix_fmt, width, height); | |
2304 } | |
2305 | |
2306 int img_crop(AVPicture *dst, const AVPicture *src, | |
2307 int pix_fmt, int top_band, int left_band) | |
2308 { | |
2309 return av_picture_crop(dst, src, pix_fmt, top_band, left_band); | |
2310 } | |
2311 | |
2312 int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, | |
2313 int pix_fmt, int padtop, int padbottom, int padleft, int padright, | |
2314 int *color) | |
2315 { | |
2316 return av_picture_pad(dst, src, height, width, pix_fmt, padtop, padbottom, padleft, padright, color); | |
2317 } | |
2318 #endif | |
2319 | |
2299 #ifndef CONFIG_SWSCALER | 2320 #ifndef CONFIG_SWSCALER |
2300 /* XXX: always use linesize. Return -1 if not supported */ | 2321 /* XXX: always use linesize. Return -1 if not supported */ |
2301 int img_convert(AVPicture *dst, int dst_pix_fmt, | 2322 int img_convert(AVPicture *dst, int dst_pix_fmt, |
2302 const AVPicture *src, int src_pix_fmt, | 2323 const AVPicture *src, int src_pix_fmt, |
2303 int src_width, int src_height) | 2324 int src_width, int src_height) |
2324 | 2345 |
2325 dst_pix = &pix_fmt_info[dst_pix_fmt]; | 2346 dst_pix = &pix_fmt_info[dst_pix_fmt]; |
2326 src_pix = &pix_fmt_info[src_pix_fmt]; | 2347 src_pix = &pix_fmt_info[src_pix_fmt]; |
2327 if (src_pix_fmt == dst_pix_fmt) { | 2348 if (src_pix_fmt == dst_pix_fmt) { |
2328 /* no conversion needed: just copy */ | 2349 /* no conversion needed: just copy */ |
2329 img_copy(dst, src, dst_pix_fmt, dst_width, dst_height); | 2350 av_picture_copy(dst, src, dst_pix_fmt, dst_width, dst_height); |
2330 return 0; | 2351 return 0; |
2331 } | 2352 } |
2332 | 2353 |
2333 ce = &convert_table[src_pix_fmt][dst_pix_fmt]; | 2354 ce = &convert_table[src_pix_fmt][dst_pix_fmt]; |
2334 if (ce->convert) { | 2355 if (ce->convert) { |