changeset 12386:b4b2f1006d9d libavcodec

Implement av_get_image_linesize() and use it in ff_get_plane_bytewidth(). The new implementation is more generic, more compact and more correct.
author stefano
date Thu, 12 Aug 2010 15:05:58 +0000
parents d0b25641338b
children e7de1ba6dbc0
files avcodec.h imgconvert.c
diffstat 2 files changed, 2 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/avcodec.h	Thu Aug 12 01:11:32 2010 +0000
+++ b/avcodec.h	Thu Aug 12 15:05:58 2010 +0000
@@ -31,7 +31,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR 52
 #define LIBAVCODEC_VERSION_MINOR 85
-#define LIBAVCODEC_VERSION_MICRO  0
+#define LIBAVCODEC_VERSION_MICRO  1
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
--- a/imgconvert.c	Thu Aug 12 01:11:32 2010 +0000
+++ b/imgconvert.c	Thu Aug 12 15:05:58 2010 +0000
@@ -796,53 +796,7 @@
 
 int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane)
 {
-    int bits;
-    const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
-    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
-
-    pf = &pix_fmt_info[pix_fmt];
-    switch(pf->pixel_type) {
-    case FF_PIXEL_PACKED:
-        switch(pix_fmt) {
-        case PIX_FMT_YUYV422:
-        case PIX_FMT_UYVY422:
-        case PIX_FMT_RGB565BE:
-        case PIX_FMT_RGB565LE:
-        case PIX_FMT_RGB555BE:
-        case PIX_FMT_RGB555LE:
-        case PIX_FMT_RGB444BE:
-        case PIX_FMT_RGB444LE:
-        case PIX_FMT_BGR565BE:
-        case PIX_FMT_BGR565LE:
-        case PIX_FMT_BGR555BE:
-        case PIX_FMT_BGR555LE:
-        case PIX_FMT_BGR444BE:
-        case PIX_FMT_BGR444LE:
-            bits = 16;
-            break;
-        case PIX_FMT_UYYVYY411:
-            bits = 12;
-            break;
-        default:
-            bits = pf->depth * pf->nb_channels;
-            break;
-        }
-        return (width * bits + 7) >> 3;
-        break;
-    case FF_PIXEL_PLANAR:
-            if ((pix_fmt != PIX_FMT_NV12 && pix_fmt != PIX_FMT_NV21) &&
-                (plane == 1 || plane == 2))
-                width= -((-width)>>desc->log2_chroma_w);
-
-            return (width * pf->depth + 7) >> 3;
-        break;
-    case FF_PIXEL_PALETTE:
-        if (plane == 0)
-            return width;
-        break;
-    }
-
-    return -1;
+    return av_get_image_linesize(pix_fmt, width, plane);
 }
 
 void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],