summaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/attributes.h8
-rw-r--r--libavutil/avutil.h2
-rw-r--r--libavutil/internal.h2
-rw-r--r--libavutil/mem.h4
-rw-r--r--libavutil/pixdesc.c23
-rw-r--r--libavutil/pixfmt.h3
-rw-r--r--libavutil/samplefmt.c47
-rw-r--r--libavutil/samplefmt.h43
8 files changed, 123 insertions, 9 deletions
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index 65a9249..1a60244 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -65,7 +65,7 @@
#endif
#ifndef av_cold
-#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3)
+#if (!defined(__INTEL_COMPILER) || __INTEL_COMPILER > 1110) && AV_GCC_VERSION_AT_LEAST(4,3)
# define av_cold __attribute__((cold))
#else
# define av_cold
@@ -73,7 +73,7 @@
#endif
#ifndef av_flatten
-#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,1)
+#if (!defined(__INTEL_COMPILER) || __INTEL_COMPILER > 1110) && AV_GCC_VERSION_AT_LEAST(4,1)
# define av_flatten __attribute__((flatten))
#else
# define av_flatten
@@ -110,7 +110,7 @@
#endif
#ifndef av_alias
-#if (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(3,3)
+#if (!defined(__INTEL_COMPILER) || __INTEL_COMPILER > 1200) && AV_GCC_VERSION_AT_LEAST(3,3)
# define av_alias __attribute__((may_alias))
#else
# define av_alias
@@ -118,7 +118,7 @@
#endif
#ifndef av_uninit
-#if defined(__GNUC__) && !defined(__ICC)
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
# define av_uninit(x) x=x
#else
# define av_uninit(x) x
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index e887c4d..095540c 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -40,7 +40,7 @@
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 50
-#define LIBAVUTIL_VERSION_MINOR 39
+#define LIBAVUTIL_VERSION_MINOR 40
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 4c98a12..896e0b3 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -39,7 +39,7 @@
#include "timer.h"
#ifndef attribute_align_arg
-#if ARCH_X86_32 && (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(4,2)
+#if ARCH_X86_32 && (!defined(__INTEL_COMPILER) || __INTEL_COMPILER > 1200) && AV_GCC_VERSION_AT_LEAST(4,2)
# define attribute_align_arg __attribute__((force_align_arg_pointer))
#else
# define attribute_align_arg
diff --git a/libavutil/mem.h b/libavutil/mem.h
index 33ab48f..78a2449 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -29,7 +29,7 @@
#include "attributes.h"
#include "avutil.h"
-#if defined(__ICC) && _ICC < 1200 || defined(__SUNPRO_C)
+#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
#define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
#elif defined(__TI_COMPILER_VERSION__)
@@ -56,7 +56,7 @@
#define av_malloc_attrib
#endif
-#if (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(4,3)
+#if (!defined(__INTEL_COMPILER) || __INTEL_COMPILER > 1200) && AV_GCC_VERSION_AT_LEAST(4,3)
#define av_alloc_size(n) __attribute__((alloc_size(n)))
#else
#define av_alloc_size(n)
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 83aa8b0..82dda06 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -630,6 +630,29 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
{0,1,1,0,3}, /* B */
},
},
+ [PIX_FMT_BGR48BE] = {
+ .name = "bgr48be",
+ .nb_components= 3,
+ .log2_chroma_w= 0,
+ .log2_chroma_h= 0,
+ .comp = {
+ {0,5,1,0,15}, /* B */
+ {0,5,3,0,15}, /* G */
+ {0,5,5,0,15}, /* R */
+ },
+ .flags = PIX_FMT_BE,
+ },
+ [PIX_FMT_BGR48LE] = {
+ .name = "bgr48le",
+ .nb_components= 3,
+ .log2_chroma_w= 0,
+ .log2_chroma_h= 0,
+ .comp = {
+ {0,5,1,0,15}, /* B */
+ {0,5,3,0,15}, /* G */
+ {0,5,5,0,15}, /* R */
+ },
+ },
[PIX_FMT_BGR565BE] = {
.name = "bgr565be",
.nb_components= 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 8ec91c8..de92f8f 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -133,6 +133,8 @@ enum PixelFormat {
PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1
PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1
PIX_FMT_Y400A, ///< 8bit gray, 8bit alpha
+ PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
+ PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
};
@@ -152,6 +154,7 @@ enum PixelFormat {
#define PIX_FMT_RGB565 PIX_FMT_NE(RGB565BE, RGB565LE)
#define PIX_FMT_RGB555 PIX_FMT_NE(RGB555BE, RGB555LE)
#define PIX_FMT_RGB444 PIX_FMT_NE(RGB444BE, RGB444LE)
+#define PIX_FMT_BGR48 PIX_FMT_NE(BGR48BE, BGR48LE)
#define PIX_FMT_BGR565 PIX_FMT_NE(BGR565BE, BGR565LE)
#define PIX_FMT_BGR555 PIX_FMT_NE(BGR555BE, BGR555LE)
#define PIX_FMT_BGR444 PIX_FMT_NE(BGR444BE, BGR444LE)
diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c
index c9ffd1a..ea004d9 100644
--- a/libavutil/samplefmt.c
+++ b/libavutil/samplefmt.c
@@ -71,3 +71,50 @@ int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt)
return sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB ?
0 : sample_fmt_info[sample_fmt].bits;
}
+
+int av_samples_fill_arrays(uint8_t *pointers[8], int linesizes[8],
+ uint8_t *buf, int nb_channels, int nb_samples,
+ enum AVSampleFormat sample_fmt, int planar, int align)
+{
+ int i, step_size = 0;
+ int sample_size = av_get_bits_per_sample_fmt(sample_fmt) >> 3;
+ int channel_step = planar ? FFALIGN(nb_samples*sample_size, align) : sample_size;
+
+ if(nb_channels * (uint64_t)nb_samples * sample_size >= INT_MAX - align*(uint64_t)nb_channels)
+ return AVERROR(EINVAL);
+
+ if (pointers) {
+ pointers[0] = buf;
+ for (i = 0; i < nb_channels; i++) {
+ pointers[i] = buf + step_size;
+ step_size += channel_step;
+ }
+ memset(&pointers[nb_channels], 0, (8-nb_channels) * sizeof(pointers[0]));
+ }
+
+ if (linesizes) {
+ linesizes[0] = planar ? sample_size : nb_channels*sample_size;
+ memset(&linesizes[1], 0, (8-1) * sizeof(linesizes[0]));
+ }
+
+ return planar ? channel_step * nb_channels : FFALIGN(nb_channels*sample_size*nb_samples, align);
+}
+
+int av_samples_alloc(uint8_t *pointers[8], int linesizes[8],
+ int nb_samples, int nb_channels,
+ enum AVSampleFormat sample_fmt, int planar,
+ int align)
+{
+ uint8_t *buf;
+ int size = av_samples_fill_arrays(NULL, NULL,
+ NULL, nb_channels, nb_samples,
+ sample_fmt, planar, align);
+
+ buf = av_mallocz(size);
+ if (!buf)
+ return AVERROR(ENOMEM);
+
+ return av_samples_fill_arrays(pointers, linesizes,
+ buf, nb_channels, nb_samples,
+ sample_fmt, planar, align);
+}
diff --git a/libavutil/samplefmt.h b/libavutil/samplefmt.h
index 0604580..9b9c0d4 100644
--- a/libavutil/samplefmt.h
+++ b/libavutil/samplefmt.h
@@ -19,6 +19,8 @@
#ifndef AVUTIL_SAMPLEFMT_H
#define AVUTIL_SAMPLEFMT_H
+#include "avutil.h"
+
/**
* all in native-endian format
*/
@@ -67,4 +69,43 @@ char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat samp
*/
int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt);
-#endif /* AVUTIL_SAMPLEFMT_H */
+/**
+ * Fill channel data pointers and linesizes for samples with sample
+ * format sample_fmt.
+ *
+ * The pointers array is filled with the pointers to the samples data:
+ * data[c] points to the first sample of channel c.
+ * data[c] + linesize[0] points to the second sample of channel c
+ *
+ * @param pointers array to be filled with the pointer for each plane, may be NULL
+ * @param linesizes array to be filled with the linesize, may be NULL
+ * @param buf the pointer to a buffer containing the samples
+ * @param nb_samples the number of samples in a single channel
+ * @param planar 1 if the samples layout is planar, 0 if it is packed
+ * @param nb_channels the number of channels
+ * @return the total size of the buffer, a negative
+ * error code in case of failure
+ */
+int av_samples_fill_arrays(uint8_t *pointers[8], int linesizes[8],
+ uint8_t *buf, int nb_channels, int nb_samples,
+ enum AVSampleFormat sample_fmt, int planar, int align);
+
+/**
+ * Allocate a samples buffer for nb_samples samples, and
+ * fill pointers and linesizes accordingly.
+ * The allocated samples buffer has to be freed by using
+ * av_freep(&pointers[0]).
+ *
+ * @param nb_samples number of samples per channel
+ * @param planar 1 if the samples layout is planar, 0 if packed,
+ * @param align the value to use for buffer size alignment
+ * @return the size in bytes required for the samples buffer, a negative
+ * error code in case of failure
+ * @see av_samples_fill_arrays()
+ */
+int av_samples_alloc(uint8_t *pointers[8], int linesizes[8],
+ int nb_samples, int nb_channels,
+ enum AVSampleFormat sample_fmt, int planar,
+ int align);
+
+#endif /* AVCORE_SAMPLEFMT_H */
OpenPOWER on IntegriCloud