Add the prefix "av_" to img_crop(), img_copy() and img_pad(), and rename "img"

to "picture" as suggested by Baptiste Coudurier.

Originally committed as revision 8220 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Panagiotis Issaris 2007-03-04 11:53:11 +00:00
parent a3fd2bd87d
commit 636d6a4a47
6 changed files with 46 additions and 14 deletions

View File

@ -596,7 +596,7 @@ static void pre_process_video_frame(AVInputStream *ist, AVPicture *picture, void
picture2 = picture; picture2 = picture;
} }
} else { } else {
img_copy(picture2, picture, dec->pix_fmt, dec->width, dec->height); av_picture_copy(picture2, picture, dec->pix_fmt, dec->width, dec->height);
} }
} else { } else {
picture2 = picture; picture2 = picture;
@ -716,7 +716,7 @@ static void do_video_out(AVFormatContext *s,
return; return;
if (ost->video_crop) { if (ost->video_crop) {
if (img_crop((AVPicture *)&picture_crop_temp, (AVPicture *)in_picture, dec->pix_fmt, ost->topBand, ost->leftBand) < 0) { if (av_picture_crop((AVPicture *)&picture_crop_temp, (AVPicture *)in_picture, dec->pix_fmt, ost->topBand, ost->leftBand) < 0) {
av_log(NULL, AV_LOG_ERROR, "error cropping picture\n"); av_log(NULL, AV_LOG_ERROR, "error cropping picture\n");
goto the_end; goto the_end;
} }
@ -731,7 +731,7 @@ static void do_video_out(AVFormatContext *s,
if (ost->video_pad) { if (ost->video_pad) {
final_picture = &ost->pict_tmp; final_picture = &ost->pict_tmp;
if (ost->video_resample) { if (ost->video_resample) {
if (img_crop((AVPicture *)&picture_pad_temp, (AVPicture *)final_picture, enc->pix_fmt, ost->padtop, ost->padleft) < 0) { if (av_picture_crop((AVPicture *)&picture_pad_temp, (AVPicture *)final_picture, enc->pix_fmt, ost->padtop, ost->padleft) < 0) {
av_log(NULL, AV_LOG_ERROR, "error padding picture\n"); av_log(NULL, AV_LOG_ERROR, "error padding picture\n");
goto the_end; goto the_end;
} }
@ -747,7 +747,7 @@ static void do_video_out(AVFormatContext *s,
} }
if (ost->video_pad) { if (ost->video_pad) {
img_pad((AVPicture*)final_picture, (AVPicture *)padding_src, av_picture_pad((AVPicture*)final_picture, (AVPicture *)padding_src,
enc->height, enc->width, enc->pix_fmt, enc->height, enc->width, enc->pix_fmt,
ost->padtop, ost->padbottom, ost->padleft, ost->padright, padcolor); ost->padtop, ost->padbottom, ost->padleft, ost->padright, padcolor);
} }

View File

@ -3008,21 +3008,32 @@ void *av_mallocz_static(unsigned int size);
/** /**
* Copy image 'src' to 'dst'. * Copy image 'src' to 'dst'.
*/ */
void img_copy(AVPicture *dst, const AVPicture *src, void av_picture_copy(AVPicture *dst, const AVPicture *src,
int pix_fmt, int width, int height); int pix_fmt, int width, int height);
/** /**
* Crop image top and left side * Crop image top and left side
*/ */
int img_crop(AVPicture *dst, const AVPicture *src, int av_picture_crop(AVPicture *dst, const AVPicture *src,
int pix_fmt, int top_band, int left_band); int pix_fmt, int top_band, int left_band);
/** /**
* Pad image * Pad image
*/ */
int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt, int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt,
int padtop, int padbottom, int padleft, int padright, int *color); int padtop, int padbottom, int padleft, int padright, int *color);
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
attribute_deprecated void img_copy(AVPicture *dst, const AVPicture *src,
int pix_fmt, int width, int height);
attribute_deprecated int img_crop(AVPicture *dst, const AVPicture *src,
int pix_fmt, int top_band, int left_band);
attribute_deprecated int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt,
int padtop, int padbottom, int padleft, int padright, int *color);
#endif
extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v); extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
/* error handling */ /* error handling */

View File

@ -733,7 +733,7 @@ void ff_img_copy_plane(uint8_t *dst, int dst_wrap,
} }
} }
void img_copy(AVPicture *dst, const AVPicture *src, void av_picture_copy(AVPicture *dst, const AVPicture *src,
int pix_fmt, int width, int height) int pix_fmt, int width, int height)
{ {
int bwidth, bits, i; int bwidth, bits, i;
@ -2214,7 +2214,7 @@ static inline int is_yuv_planar(const PixFmtInfo *ps)
ps->pixel_type == FF_PIXEL_PLANAR; ps->pixel_type == FF_PIXEL_PLANAR;
} }
int img_crop(AVPicture *dst, const AVPicture *src, int av_picture_crop(AVPicture *dst, const AVPicture *src,
int pix_fmt, int top_band, int left_band) int pix_fmt, int top_band, int left_band)
{ {
int y_shift; int y_shift;
@ -2236,7 +2236,7 @@ int img_crop(AVPicture *dst, const AVPicture *src,
return 0; return 0;
} }
int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
int pix_fmt, int padtop, int padbottom, int padleft, int padright, int pix_fmt, int padtop, int padbottom, int padleft, int padright,
int *color) int *color)
{ {
@ -2296,6 +2296,27 @@ int img_pad(AVPicture *dst, const AVPicture *src, int height, int width,
return 0; return 0;
} }
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
void img_copy(AVPicture *dst, const AVPicture *src,
int pix_fmt, int width, int height)
{
av_picture_copy(dst, src, pix_fmt, width, height);
}
int img_crop(AVPicture *dst, const AVPicture *src,
int pix_fmt, int top_band, int left_band)
{
return av_picture_crop(dst, src, pix_fmt, top_band, left_band);
}
int img_pad(AVPicture *dst, const AVPicture *src, int height, int width,
int pix_fmt, int padtop, int padbottom, int padleft, int padright,
int *color)
{
return av_picture_pad(dst, src, height, width, pix_fmt, padtop, padbottom, padleft, padright, color);
}
#endif
#ifndef CONFIG_SWSCALER #ifndef CONFIG_SWSCALER
/* XXX: always use linesize. Return -1 if not supported */ /* XXX: always use linesize. Return -1 if not supported */
int img_convert(AVPicture *dst, int dst_pix_fmt, int img_convert(AVPicture *dst, int dst_pix_fmt,
@ -2326,7 +2347,7 @@ int img_convert(AVPicture *dst, int dst_pix_fmt,
src_pix = &pix_fmt_info[src_pix_fmt]; src_pix = &pix_fmt_info[src_pix_fmt];
if (src_pix_fmt == dst_pix_fmt) { if (src_pix_fmt == dst_pix_fmt) {
/* no conversion needed: just copy */ /* no conversion needed: just copy */
img_copy(dst, src, dst_pix_fmt, dst_width, dst_height); av_picture_copy(dst, src, dst_pix_fmt, dst_width, dst_height);
return 0; return 0;
} }

View File

@ -802,7 +802,7 @@ int sws_scale(struct SwsContext *ctx, uint8_t* src[], int srcStride[],
goto the_end; goto the_end;
} }
} else if (resampled_picture != &dst_pict) { } else if (resampled_picture != &dst_pict) {
img_copy(&dst_pict, resampled_picture, current_pix_fmt, av_picture_copy(&dst_pict, resampled_picture, current_pix_fmt,
ctx->resampling_ctx->owidth, ctx->resampling_ctx->oheight); ctx->resampling_ctx->owidth, ctx->resampling_ctx->oheight);
} }

View File

@ -50,7 +50,7 @@ static void copy_frame(AVFrame *f, uint8_t *src,
int width, int height) { int width, int height) {
AVPicture pic; AVPicture pic;
avpicture_fill(&pic, src, PIX_FMT_YUV420P, width, height); avpicture_fill(&pic, src, PIX_FMT_YUV420P, width, height);
img_copy((AVPicture *)f, &pic, PIX_FMT_YUV420P, width, height); av_picture_copy((AVPicture *)f, &pic, PIX_FMT_YUV420P, width, height);
} }
/** /**

View File

@ -370,7 +370,7 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){
if (s->get_buffer(s, pic)) if (s->get_buffer(s, pic))
return -1; return -1;
/* Copy image data from old buffer to new buffer */ /* Copy image data from old buffer to new buffer */
img_copy((AVPicture*)pic, (AVPicture*)&temp_pic, s->pix_fmt, s->width, av_picture_copy((AVPicture*)pic, (AVPicture*)&temp_pic, s->pix_fmt, s->width,
s->height); s->height);
s->release_buffer(s, &temp_pic); // Release old frame s->release_buffer(s, &temp_pic); // Release old frame
return 0; return 0;