On 07/19/2012 10:15 AM, Anton Khirnov wrote: > > On Thu, 19 Jul 2012 03:41:11 +0200, Luca Barbato <lu_z...@gentoo.org> wrote: >> From: Michael Bradshaw <mbrads...@sorensonmedia.com> >> >> Based on FFmpeg version from >> commit 3275981207e30e140cffaea334ac390f1a04266a >> --- >> libavcodec/libopenjpegdec.c | 305 >> +++++++++++++++++++++++++++++++++++-------- >> 1 files changed, 250 insertions(+), 55 deletions(-) >> >> diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c >> index 799ccd7..1c08f8a 100644 >> --- a/libavcodec/libopenjpegdec.c >> +++ b/libavcodec/libopenjpegdec.c >> @@ -24,29 +24,200 @@ >> * JPEG 2000 decoder using libopenjpeg >> */ >> >> +#define OPJ_STATIC >> +#include <openjpeg.h> >> + >> +#include "libavutil/intreadwrite.h" >> #include "libavutil/imgutils.h" >> +#include "libavutil/pixfmt.h" >> +#include "libavutil/opt.h" >> #include "avcodec.h" >> -#include "libavutil/intreadwrite.h" >> #include "thread.h" >> -#define OPJ_STATIC >> -#include <openjpeg.h> >> >> #define JP2_SIG_TYPE 0x6A502020 >> #define JP2_SIG_VALUE 0x0D0A870A >> >> +// pix_fmts with lower bpp have to be listed before >> +// similar pix_fmts with higher bpp. >> +#define RGB_PIXEL_FORMATS PIX_FMT_RGB24, PIX_FMT_RGBA, \ >> + PIX_FMT_RGB48 >> + >> +#define GRAY_PIXEL_FORMATS PIX_FMT_GRAY8, PIX_FMT_Y400A, \ >> + PIX_FMT_GRAY16 >> + >> +#define YUV_PIXEL_FORMATS PIX_FMT_YUV410P, PIX_FMT_YUV411P, \ >> + PIX_FMT_YUVA420P, \ >> + PIX_FMT_YUV420P, PIX_FMT_YUV422P, \ >> + PIX_FMT_YUV440P, PIX_FMT_YUV444P, \ >> + PIX_FMT_YUV420P9, PIX_FMT_YUV422P9, \ >> + PIX_FMT_YUV444P9, \ >> + PIX_FMT_YUV420P10, PIX_FMT_YUV422P10, \ >> + PIX_FMT_YUV444P10, \ >> + PIX_FMT_YUV420P16, PIX_FMT_YUV422P16, \ >> + PIX_FMT_YUV444P16 >> + >> +static const enum PixelFormat rgb_pix_fmts[] = {RGB_PIXEL_FORMATS}; >> +static const enum PixelFormat gray_pix_fmts[] = {GRAY_PIXEL_FORMATS}; >> +static const enum PixelFormat yuv_pix_fmts[] = {YUV_PIXEL_FORMATS}; >> +static const enum PixelFormat any_pix_fmts[] = {RGB_PIXEL_FORMATS, >> + GRAY_PIXEL_FORMATS, >> + YUV_PIXEL_FORMATS}; >> + >> typedef struct { >> opj_dparameters_t dec_params; >> AVFrame image; >> } LibOpenJPEGContext; >> >> -static int check_image_attributes(opj_image_t *image) >> +static inline int libopenjpeg_matches_pix_fmt(const opj_image_t *image, >> + enum PixelFormat pix_fmt) > > What's with all the inlines? Does inlining them give any practical benefit? >
I doubt so, that decode function is huge and it is suppose to just pass data to and get data back from openjpeg. lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel