summaryrefslogtreecommitdiff
path: root/libswscale/swscale_internal.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-12 15:52:55 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-12 15:57:28 +0200
commita9bd51b1e647d7ec0b7661e19b87ade86098b38c (patch)
tree37682f77a88bc8e09eb97fbc923192292a1abbe4 /libswscale/swscale_internal.h
parenta33ed6bc74b6b8ada925c76c4084afcf8870a048 (diff)
parent9953ff3cd844eb5f6d8dfce98cad94b78a0fc7dc (diff)
Merge commit '9953ff3cd844eb5f6d8dfce98cad94b78a0fc7dc'
* commit '9953ff3cd844eb5f6d8dfce98cad94b78a0fc7dc': mpegvideo: fix indentation sws: do not use av_pix_fmt_descriptors directly. Conflicts: libavcodec/mpegvideo.c libswscale/swscale_internal.h libswscale/swscale_unscaled.c libswscale/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/swscale_internal.h')
-rw-r--r--libswscale/swscale_internal.h119
1 files changed, 81 insertions, 38 deletions
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 9a055b64c8..9a7baab7a2 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -27,6 +27,7 @@
#include <altivec.h>
#endif
+#include "libavutil/avassert.h"
#include "libavutil/avutil.h"
#include "libavutil/common.h"
#include "libavutil/log.h"
@@ -555,28 +556,50 @@ attribute_deprecated
const char *sws_format_name(enum AVPixelFormat format);
#endif
-#define is16BPS(x) \
- (av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 15)
+static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return desc->comp[0].depth_minus1 == 15;
+}
-#define is9_OR_10BPS(x) \
- (av_pix_fmt_descriptors[x].comp[0].depth_minus1 >= 8 && \
- av_pix_fmt_descriptors[x].comp[0].depth_minus1 <= 13)
+static av_always_inline int is9_OR_10BPS(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return desc->comp[0].depth_minus1 >= 8 && desc->comp[0].depth_minus1 <= 13;
+}
#define isNBPS(x) is9_OR_10BPS(x)
-#define isBE(x) \
- (av_pix_fmt_descriptors[x].flags & PIX_FMT_BE)
+static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return desc->flags & PIX_FMT_BE;
+}
+
+static av_always_inline int isYUV(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return !(desc->flags & PIX_FMT_RGB) && desc->nb_components >= 2;
+}
+
+static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return ((desc->flags & PIX_FMT_PLANAR) && isYUV(pix_fmt));
+}
+
+static av_always_inline int isRGB(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return (desc->flags & PIX_FMT_RGB);
+}
-#define isYUV(x) \
- (!(av_pix_fmt_descriptors[x].flags & PIX_FMT_RGB) && \
- av_pix_fmt_descriptors[x].nb_components >= 2)
-
-#define isPlanarYUV(x) \
- ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR) && \
- isYUV(x))
-
-#define isRGB(x) \
- (av_pix_fmt_descriptors[x].flags & PIX_FMT_RGB)
#if 0 // FIXME
#define isGray(x) \
(!(av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) && \
@@ -658,9 +681,12 @@ const char *sws_format_name(enum AVPixelFormat format);
(x)==AV_PIX_FMT_GBR24P \
)
-#define isALPHA(x) \
- (av_pix_fmt_descriptors[x].nb_components == 2 || \
- av_pix_fmt_descriptors[x].nb_components == 4)
+static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return desc->nb_components == 2 || desc->nb_components == 4;
+}
#if 1
#define isPacked(x) ( \
@@ -672,26 +698,43 @@ const char *sws_format_name(enum AVPixelFormat format);
|| isBGRinInt(x) \
)
#else
-#define isPacked(x) \
- ((av_pix_fmt_descriptors[x].nb_components >= 2 && \
- !(av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR)) || \
- (x) == AV_PIX_FMT_PAL8)
+static av_always_inline int isPacked(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return ((desc->nb_components >= 2 && !(desc->flags & PIX_FMT_PLANAR)) ||
+ pix_fmt == AV_PIX_FMT_PAL8);
+}
#endif
-#define isPlanar(x) \
- (av_pix_fmt_descriptors[x].nb_components >= 2 && \
- (av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR))
-
-#define isPackedRGB(x) \
- ((av_pix_fmt_descriptors[x].flags & \
- (PIX_FMT_PLANAR | PIX_FMT_RGB)) == PIX_FMT_RGB)
-
-#define isPlanarRGB(x) \
- ((av_pix_fmt_descriptors[x].flags & \
- (PIX_FMT_PLANAR | PIX_FMT_RGB)) == (PIX_FMT_PLANAR | PIX_FMT_RGB))
-
-#define usePal(x) ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) || \
- (av_pix_fmt_descriptors[x].flags & PIX_FMT_PSEUDOPAL))
+static av_always_inline int isPlanar(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return (desc->nb_components >= 2 && (desc->flags & PIX_FMT_PLANAR));
+}
+
+static av_always_inline int isPackedRGB(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return ((desc->flags & (PIX_FMT_PLANAR | PIX_FMT_RGB)) == PIX_FMT_RGB);
+}
+
+static av_always_inline int isPlanarRGB(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return ((desc->flags & (PIX_FMT_PLANAR | PIX_FMT_RGB)) ==
+ (PIX_FMT_PLANAR | PIX_FMT_RGB));
+}
+
+static av_always_inline int usePal(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return (desc->flags & PIX_FMT_PAL) || (desc->flags & PIX_FMT_PSEUDOPAL);
+}
extern const uint64_t ff_dither4[2];
extern const uint64_t ff_dither8[2];