diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2009-03-21 22:24:44 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2009-03-21 22:24:44 +0000 |
commit | a61ec8e7ae1f74716142d72c07740f90c33ff67b (patch) | |
tree | 6607e192bc93f75c5582ed97a55835d5a592f2d4 /libavcodec/imgconvert.c | |
parent | cc9aced32f554e51e3bc5f46a5aa36a9927957a2 (diff) | |
download | ffmpeg-a61ec8e7ae1f74716142d72c07740f90c33ff67b.tar.gz |
Globally prefer enum PixelFormat over int when it makes sense.
Originally committed as revision 18129 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/imgconvert.c')
-rw-r--r-- | libavcodec/imgconvert.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 576da86ae5..962c012194 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -443,13 +443,13 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { }, }; -void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift) +void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift) { *h_shift = pix_fmt_info[pix_fmt].x_chroma_shift; *v_shift = pix_fmt_info[pix_fmt].y_chroma_shift; } -const char *avcodec_get_pix_fmt_name(int pix_fmt) +const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt) { if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB) return NULL; @@ -467,7 +467,7 @@ enum PixelFormat avcodec_get_pix_fmt(const char* name) return PIX_FMT_NONE; } -void avcodec_pix_fmt_string (char *buf, int buf_size, int pix_fmt) +void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt) { /* print header */ if (pix_fmt < 0) @@ -533,7 +533,7 @@ int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt){ return 0; } -int ff_fill_linesize(AVPicture *picture, int pix_fmt, int width) +int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width) { int w2; const PixFmtInfo *pinfo; @@ -621,7 +621,7 @@ int ff_fill_linesize(AVPicture *picture, int pix_fmt, int width) return 0; } -int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, int pix_fmt, +int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt, int height) { int size, h2, size2; @@ -712,7 +712,7 @@ int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, int pix_fmt, } int avpicture_fill(AVPicture *picture, uint8_t *ptr, - int pix_fmt, int width, int height) + enum PixelFormat pix_fmt, int width, int height) { if(avcodec_check_dimensions(NULL, width, height)) @@ -724,7 +724,7 @@ int avpicture_fill(AVPicture *picture, uint8_t *ptr, return ff_fill_pointer(picture, ptr, pix_fmt, height); } -int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height, +int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height, unsigned char *dest, int dest_size) { const PixFmtInfo* pf = &pix_fmt_info[pix_fmt]; @@ -783,7 +783,7 @@ int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height, return size; } -int avpicture_get_size(int pix_fmt, int width, int height) +int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height) { AVPicture dummy_pict; if(avcodec_check_dimensions(NULL, width, height)) @@ -800,7 +800,7 @@ int avpicture_get_size(int pix_fmt, int width, int height) return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height); } -int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt, +int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt, int has_alpha) { const PixFmtInfo *pf, *ps; @@ -855,7 +855,7 @@ int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt, return loss; } -static int avg_bits_per_pixel(int pix_fmt) +static int avg_bits_per_pixel(enum PixelFormat pix_fmt) { int bits; const PixFmtInfo *pf; @@ -898,12 +898,13 @@ static int avg_bits_per_pixel(int pix_fmt) return bits; } -static int avcodec_find_best_pix_fmt1(int64_t pix_fmt_mask, - int src_pix_fmt, +static enum PixelFormat avcodec_find_best_pix_fmt1(int64_t pix_fmt_mask, + enum PixelFormat src_pix_fmt, int has_alpha, int loss_mask) { - int dist, i, loss, min_dist, dst_pix_fmt; + int dist, i, loss, min_dist; + enum PixelFormat dst_pix_fmt; /* find exact color match with smallest size */ dst_pix_fmt = -1; @@ -923,10 +924,11 @@ static int avcodec_find_best_pix_fmt1(int64_t pix_fmt_mask, return dst_pix_fmt; } -int avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, int src_pix_fmt, +enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr) { - int dst_pix_fmt, loss_mask, i; + enum PixelFormat dst_pix_fmt; + int loss_mask, i; static const int loss_mask_order[] = { ~0, /* no loss first */ ~FF_LOSS_ALPHA, @@ -1010,7 +1012,7 @@ int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane) } void av_picture_copy(AVPicture *dst, const AVPicture *src, - int pix_fmt, int width, int height) + enum PixelFormat pix_fmt, int width, int height) { int i; const PixFmtInfo *pf = &pix_fmt_info[pix_fmt]; @@ -1131,7 +1133,7 @@ void ff_shrink88(uint8_t *dst, int dst_wrap, int avpicture_alloc(AVPicture *picture, - int pix_fmt, int width, int height) + enum PixelFormat pix_fmt, int width, int height) { int size; void *ptr; @@ -1188,7 +1190,7 @@ int av_picture_crop(AVPicture *dst, const AVPicture *src, } int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, - int pix_fmt, int padtop, int padbottom, int padleft, int padright, + enum PixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright, int *color) { uint8_t *optr; @@ -1274,7 +1276,7 @@ static int get_alpha_info_pal8(const AVPicture *src, int width, int height) } int img_get_alpha_info(const AVPicture *src, - int pix_fmt, int width, int height) + enum PixelFormat pix_fmt, int width, int height) { const PixFmtInfo *pf = &pix_fmt_info[pix_fmt]; int ret; @@ -1480,7 +1482,7 @@ static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, } int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, - int pix_fmt, int width, int height) + enum PixelFormat pix_fmt, int width, int height) { int i; |