[libav-commits] rgb2rgb: allow conversion for <15 bpp

2012-01-09 Thread Paul B Mahol
Module: libav
Branch: master
Commit: 0b8b3387a977dcdb6fb9e53bcc9966d34b2e4cec

Author:Paul B Mahol 
Committer: Ronald S. Bultje 
Date:  Tue Jan 10 02:54:34 2012 +

rgb2rgb: allow conversion for <15 bpp

Signed-off-by: Ronald S. Bultje 

---

 libswscale/swscale_unscaled.c |   62 
 1 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 7c339b6..5769548 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -360,8 +360,8 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t 
*src[], int srcStride[],
 const enum PixelFormat dstFormat = c->dstFormat;
 const int srcBpp = (c->srcFormatBpp + 7) >> 3;
 const int dstBpp = (c->dstFormatBpp + 7) >> 3;
-const int srcId = c->srcFormatBpp >> 2; /* 1:0, 4:1, 8:2, 15:3, 16:4, 
24:6, 32:8 */
-const int dstId = c->dstFormatBpp >> 2;
+const int srcId = c->srcFormatBpp;
+const int dstId = c->dstFormatBpp;
 void (*conv)(const uint8_t *src, uint8_t *dst, int src_size) = NULL;
 
 #define CONV_IS(src, dst) (srcFormat == PIX_FMT_##src && dstFormat == 
PIX_FMT_##dst)
@@ -383,38 +383,38 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t 
*src[], int srcStride[],
 /* BGR -> BGR */
 if ((isBGRinInt(srcFormat) && isBGRinInt(dstFormat)) ||
 (isRGBinInt(srcFormat) && isRGBinInt(dstFormat))) {
-switch (srcId | (dstId << 4)) {
-case 0x34: conv = rgb16to15; break;
-case 0x36: conv = rgb24to15; break;
-case 0x38: conv = rgb32to15; break;
-case 0x43: conv = rgb15to16; break;
-case 0x46: conv = rgb24to16; break;
-case 0x48: conv = rgb32to16; break;
-case 0x63: conv = rgb15to24; break;
-case 0x64: conv = rgb16to24; break;
-case 0x68: conv = rgb32to24; break;
-case 0x83: conv = rgb15to32; break;
-case 0x84: conv = rgb16to32; break;
-case 0x86: conv = rgb24to32; break;
+switch (srcId | (dstId << 16)) {
+case 0x000F0010: conv = rgb16to15; break;
+case 0x000F0018: conv = rgb24to15; break;
+case 0x000F0020: conv = rgb32to15; break;
+case 0x001F: conv = rgb15to16; break;
+case 0x00100018: conv = rgb24to16; break;
+case 0x00100020: conv = rgb32to16; break;
+case 0x0018000F: conv = rgb15to24; break;
+case 0x00180010: conv = rgb16to24; break;
+case 0x00180020: conv = rgb32to24; break;
+case 0x002F: conv = rgb15to32; break;
+case 0x00200010: conv = rgb16to32; break;
+case 0x00200018: conv = rgb24to32; break;
 }
 } else if ((isBGRinInt(srcFormat) && isRGBinInt(dstFormat)) ||
(isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) {
-switch (srcId | (dstId << 4)) {
-case 0x33: conv = rgb15tobgr15; break;
-case 0x34: conv = rgb16tobgr15; break;
-case 0x36: conv = rgb24tobgr15; break;
-case 0x38: conv = rgb32tobgr15; break;
-case 0x43: conv = rgb15tobgr16; break;
-case 0x44: conv = rgb16tobgr16; break;
-case 0x46: conv = rgb24tobgr16; break;
-case 0x48: conv = rgb32tobgr16; break;
-case 0x63: conv = rgb15tobgr24; break;
-case 0x64: conv = rgb16tobgr24; break;
-case 0x66: conv = rgb24tobgr24; break;
-case 0x68: conv = rgb32tobgr24; break;
-case 0x83: conv = rgb15tobgr32; break;
-case 0x84: conv = rgb16tobgr32; break;
-case 0x86: conv = rgb24tobgr32; break;
+switch (srcId | (dstId << 16)) {
+case 0x000F000F: conv = rgb15tobgr15; break;
+case 0x000F0010: conv = rgb16tobgr15; break;
+case 0x000F0018: conv = rgb24tobgr15; break;
+case 0x000F0020: conv = rgb32tobgr15; break;
+case 0x001F: conv = rgb15tobgr16; break;
+case 0x00100010: conv = rgb16tobgr16; break;
+case 0x00100018: conv = rgb24tobgr16; break;
+case 0x00100020: conv = rgb32tobgr16; break;
+case 0x0018000F: conv = rgb15tobgr24; break;
+case 0x00180010: conv = rgb16tobgr24; break;
+case 0x00180018: conv = rgb24tobgr24; break;
+case 0x00180020: conv = rgb32tobgr24; break;
+case 0x002F: conv = rgb15tobgr32; break;
+case 0x00200010: conv = rgb16tobgr32; break;
+case 0x00200018: conv = rgb24tobgr32; break;
 }
 }
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] doc: fix stray reference to FFmpeg

2012-01-09 Thread Luca Barbato
Module: libav
Branch: master
Commit: 0c50edb789c6489aad477d19bab5b06b01a36d91

Author:Luca Barbato 
Committer: Luca Barbato 
Date:  Sun Jan  8 17:49:43 2012 +0100

doc: fix stray reference to FFmpeg

---

 doc/filters.texi |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index e022b46..4e7ede2 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -470,7 +470,7 @@ drawbox=10:20:200:60:red@@0.5"
 Draw text string or text from specified file on top of video using the
 libfreetype library.
 
-To enable compilation of this filter you need to configure FFmpeg with
+To enable compilation of this filter you need to configure Libav with
 @code{--enable-libfreetype}.
 
 The filter also recognizes strftime() sequences in the provided text

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] v4l2: support compressed formats

2012-01-09 Thread Luca Barbato
Module: libav
Branch: master
Commit: b8c310cb0a071d998b90e9b166ed29062524de8b

Author:Luca Barbato 
Committer: Luca Barbato 
Date:  Wed Jan  4 15:06:10 2012 +0100

v4l2: support compressed formats

Let pass the codec name to -pixel_format and introduce -input_format.

---

 libavdevice/v4l2.c |   11 ---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 71e5b11..9c5da39 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -708,11 +708,15 @@ static int v4l2_read_header(AVFormatContext *s1, 
AVFormatParameters *ap)
 }
 
 if (s->pixel_format) {
+AVCodec *codec = avcodec_find_decoder_by_name(s->pixel_format);
+
+if (codec)
+s1->video_codec_id = codec->id;
 
 pix_fmt = av_get_pix_fmt(s->pixel_format);
 
-if (pix_fmt == PIX_FMT_NONE) {
-av_log(s1, AV_LOG_ERROR, "No such pixel format: %s.\n",
+if (pix_fmt == PIX_FMT_NONE && !codec) {
+av_log(s1, AV_LOG_ERROR, "No such input format: %s.\n",
s->pixel_format);
 
 res = AVERROR(EINVAL);
@@ -818,7 +822,8 @@ static const AVOption options[] = {
 { "standard", "TV standard, used only by analog frame grabber",
OFFSET(standard), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0,   DEC },
 { "channel",  "TV channel, used only by frame grabber",
OFFSET(channel),  AV_OPT_TYPE_INT,{.dbl = 0 },0, INT_MAX, DEC },
 { "video_size",   "A string describing frame size, such as 640x480 or 
hd720.", OFFSET(video_size),   AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   
DEC },
-{ "pixel_format", "",  
OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   DEC },
+{ "pixel_format", "Preferred pixel format",
OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   DEC },
+{ "input_format", "Preferred pixel format (for raw video) or codec name",  
OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   DEC },
 { "framerate","",  
OFFSET(framerate),AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   DEC },
 { "list_formats", "List available formats and exit",   
OFFSET(list_format),  AV_OPT_TYPE_INT,{.dbl = 0 },  0, INT_MAX, DEC, 
"list_formats" },
 { "all",  "Show all available formats",
OFFSET(list_format),  AV_OPT_TYPE_CONST,  {.dbl = V4L_ALLFORMATS  },0, 
INT_MAX, DEC, "list_formats" },

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] v4l2: poll the file descriptor

2012-01-09 Thread Luca Barbato
Module: libav
Branch: master
Commit: 0efd48dfd15273a5ac85f2fd42f19d419fafe90d

Author:Luca Barbato 
Committer: Luca Barbato 
Date:  Thu Jan  5 12:17:45 2012 +0100

v4l2: poll the file descriptor

Instead of busy waiting use poll();

---

 libavdevice/v4l2.c |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 9c5da39..2da9872 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #if HAVE_SYS_VIDEOIO_H
 #include 
 #else
@@ -48,6 +49,7 @@
 #include "libavutil/parseutils.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/avstring.h"
+#include "libavutil/mathematics.h"
 
 static const int desired_video_buffers = 256;
 
@@ -61,6 +63,7 @@ struct video_data {
 int frame_format; /* V4L2_PIX_FMT_* */
 int width, height;
 int frame_size;
+int timeout;
 int interlaced;
 int top_field_first;
 
@@ -436,12 +439,20 @@ static int mmap_read_frame(AVFormatContext *ctx, AVPacket 
*pkt)
 struct video_data *s = ctx->priv_data;
 struct v4l2_buffer buf;
 struct buff_data *buf_descriptor;
+struct pollfd p = { .fd = s->fd, .events = POLLIN };
 int res;
 
 memset(&buf, 0, sizeof(struct v4l2_buffer));
 buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 buf.memory = V4L2_MEMORY_MMAP;
 
+res = poll(&p, 1, s->timeout);
+if (res < 0)
+return AVERROR(errno);
+
+if (!(p.revents & (POLLIN | POLLERR | POLLHUP)))
+return AVERROR(EAGAIN);
+
 /* FIXME: Some special treatment might be needed in case of loss of 
signal... */
 while ((res = ioctl(s->fd, VIDIOC_DQBUF, &buf)) < 0 && (errno == EINTR));
 if (res < 0) {
@@ -635,6 +646,10 @@ static int v4l2_set_parameters(AVFormatContext *s1, 
AVFormatParameters *ap)
 s1->streams[0]->codec->time_base.den = tpf->denominator;
 s1->streams[0]->codec->time_base.num = tpf->numerator;
 
+s->timeout = 100 +
+av_rescale_q(1, s1->streams[0]->codec->time_base,
+(AVRational){1, 1000});
+
 return 0;
 }
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] v4l2: use C99 struct initializer

2012-01-09 Thread Luca Barbato
Module: libav
Branch: master
Commit: b6db385922b79939b0dc124d53ddb4824afac040

Author:Luca Barbato 
Committer: Luca Barbato 
Date:  Sat Jan  7 10:59:35 2012 +0100

v4l2: use C99 struct initializer

Remove some unneeded memsets.

---

 libavdevice/v4l2.c |   58 ++-
 1 files changed, 25 insertions(+), 33 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 2da9872..191decd 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -169,14 +169,11 @@ static int device_init(AVFormatContext *ctx, int *width, 
int *height,
 {
 struct video_data *s = ctx->priv_data;
 int fd = s->fd;
-struct v4l2_format fmt;
+struct v4l2_format fmt = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE };
 struct v4l2_pix_format *pix = &fmt.fmt.pix;
 
 int res;
 
-memset(&fmt, 0, sizeof(struct v4l2_format));
-
-fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 pix->width = *width;
 pix->height = *height;
 pix->pixelformat = pix_fmt;
@@ -334,14 +331,14 @@ static void list_formats(AVFormatContext *ctx, int fd, 
int type)
 
 static int mmap_init(AVFormatContext *ctx)
 {
-struct video_data *s = ctx->priv_data;
-struct v4l2_requestbuffers req;
 int i, res;
+struct video_data *s = ctx->priv_data;
+struct v4l2_requestbuffers req = {
+.type   = V4L2_BUF_TYPE_VIDEO_CAPTURE,
+.count  = desired_video_buffers,
+.memory = V4L2_MEMORY_MMAP
+};
 
-memset(&req, 0, sizeof(struct v4l2_requestbuffers));
-req.count = desired_video_buffers;
-req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-req.memory = V4L2_MEMORY_MMAP;
 res = ioctl(s->fd, VIDIOC_REQBUFS, &req);
 if (res < 0) {
 if (errno == EINVAL) {
@@ -374,12 +371,12 @@ static int mmap_init(AVFormatContext *ctx)
 }
 
 for (i = 0; i < req.count; i++) {
-struct v4l2_buffer buf;
+struct v4l2_buffer buf = {
+.type   = V4L2_BUF_TYPE_VIDEO_CAPTURE,
+.index  = i,
+.memory = V4L2_MEMORY_MMAP
+};
 
-memset(&buf, 0, sizeof(struct v4l2_buffer));
-buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-buf.memory = V4L2_MEMORY_MMAP;
-buf.index = i;
 res = ioctl(s->fd, VIDIOC_QUERYBUF, &buf);
 if (res < 0) {
 av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYBUF)\n");
@@ -411,14 +408,13 @@ static int mmap_init(AVFormatContext *ctx)
 
 static void mmap_release_buffer(AVPacket *pkt)
 {
-struct v4l2_buffer buf;
+struct v4l2_buffer buf = { 0 };
 int res, fd;
 struct buff_data *buf_descriptor = pkt->priv;
 
 if (pkt->data == NULL)
 return;
 
-memset(&buf, 0, sizeof(struct v4l2_buffer));
 buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 buf.memory = V4L2_MEMORY_MMAP;
 buf.index = buf_descriptor->index;
@@ -437,15 +433,14 @@ static void mmap_release_buffer(AVPacket *pkt)
 static int mmap_read_frame(AVFormatContext *ctx, AVPacket *pkt)
 {
 struct video_data *s = ctx->priv_data;
-struct v4l2_buffer buf;
+struct v4l2_buffer buf = {
+.type   = V4L2_BUF_TYPE_VIDEO_CAPTURE,
+.memory = V4L2_MEMORY_MMAP
+};
 struct buff_data *buf_descriptor;
 struct pollfd p = { .fd = s->fd, .events = POLLIN };
 int res;
 
-memset(&buf, 0, sizeof(struct v4l2_buffer));
-buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-buf.memory = V4L2_MEMORY_MMAP;
-
 res = poll(&p, 1, s->timeout);
 if (res < 0)
 return AVERROR(errno);
@@ -504,12 +499,11 @@ static int mmap_start(AVFormatContext *ctx)
 int i, res;
 
 for (i = 0; i < s->buffers; i++) {
-struct v4l2_buffer buf;
-
-memset(&buf, 0, sizeof(struct v4l2_buffer));
-buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-buf.memory = V4L2_MEMORY_MMAP;
-buf.index  = i;
+struct v4l2_buffer buf = {
+.type   = V4L2_BUF_TYPE_VIDEO_CAPTURE,
+.index  = i,
+.memory = V4L2_MEMORY_MMAP
+};
 
 res = ioctl(s->fd, VIDIOC_QBUF, &buf);
 if (res < 0) {
@@ -552,12 +546,12 @@ static void mmap_close(struct video_data *s)
 static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap)
 {
 struct video_data *s = s1->priv_data;
-struct v4l2_input input;
-struct v4l2_standard standard;
+struct v4l2_input input = { 0 };
+struct v4l2_standard standard = { 0 };
 struct v4l2_streamparm streamparm = { 0 };
 struct v4l2_fract *tpf = &streamparm.parm.capture.timeperframe;
+AVRational framerate_q = { 0 };
 int i, ret;
-AVRational framerate_q;
 
 streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 
@@ -569,7 +563,6 @@ static int v4l2_set_parameters(AVFormatContext *s1, 
AVFormatParameters *ap)
 }
 
 /* set tv video input */
-memset (&input, 0, sizeof (input));
 input.index = s->channel;
 if (ioctl(s->fd, VIDIOC_ENUMINPUT, &input) < 0) {
 av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl e

[libav-commits] kmvc: Use bytestream2 functions to prevent buffer overreads.

2012-01-09 Thread Laurentiu Ion
Module: libav
Branch: master
Commit: da2e774fd6841da7cede8c8ef30337449329727c

Author:Laurentiu Ion 
Committer: Ronald S. Bultje 
Date:  Tue Jan 10 03:21:17 2012 +0200

kmvc: Use bytestream2 functions to prevent buffer overreads.

Signed-off-by: Ronald S. Bultje 

---

 libavcodec/kmvc.c |  150 
 1 files changed, 58 insertions(+), 92 deletions(-)

diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c
index 6c55863..2b54b84 100644
--- a/libavcodec/kmvc.c
+++ b/libavcodec/kmvc.c
@@ -46,6 +46,7 @@ typedef struct KmvcContext {
 uint32_t pal[256];
 uint8_t *cur, *prev;
 uint8_t *frm0, *frm1;
+GetByteContext g;
 } KmvcContext;
 
 typedef struct BitBuf {
@@ -55,23 +56,19 @@ typedef struct BitBuf {
 
 #define BLK(data, x, y)  data[(x) + (y) * 320]
 
-#define kmvc_init_getbits(bb, src)  bb.bits = 7; bb.bitbuf = *src++;
+#define kmvc_init_getbits(bb, g)  bb.bits = 7; bb.bitbuf = 
bytestream2_get_byte(g);
 
-#define kmvc_getbit(bb, src, src_end, res) {\
+#define kmvc_getbit(bb, g, res) {\
 res = 0; \
 if (bb.bitbuf & (1 << bb.bits)) res = 1; \
 bb.bits--; \
 if(bb.bits == -1) { \
-if (src >= src_end) { \
-av_log(ctx->avctx, AV_LOG_ERROR, "Data overrun\n"); \
-return AVERROR_INVALIDDATA; \
-} \
-bb.bitbuf = *src++; \
+bb.bitbuf = bytestream2_get_byte(g); \
 bb.bits = 7; \
 } \
 }
 
-static int kmvc_decode_intra_8x8(KmvcContext * ctx, const uint8_t * src, int 
src_size, int w, int h)
+static int kmvc_decode_intra_8x8(KmvcContext * ctx, int w, int h)
 {
 BitBuf bb;
 int res, val;
@@ -79,42 +76,33 @@ static int kmvc_decode_intra_8x8(KmvcContext * ctx, const 
uint8_t * src, int src
 int bx, by;
 int l0x, l1x, l0y, l1y;
 int mx, my;
-const uint8_t *src_end = src + src_size;
 
-kmvc_init_getbits(bb, src);
+kmvc_init_getbits(bb, &ctx->g);
 
 for (by = 0; by < h; by += 8)
 for (bx = 0; bx < w; bx += 8) {
-kmvc_getbit(bb, src, src_end, res);
+if (!bytestream2_get_bytes_left(&ctx->g)) {
+av_log(ctx->avctx, AV_LOG_ERROR, "Data overrun\n");
+return AVERROR_INVALIDDATA;
+}
+kmvc_getbit(bb, &ctx->g, res);
 if (!res) { // fill whole 8x8 block
-if (src >= src_end) {
-av_log(ctx->avctx, AV_LOG_ERROR, "Data overrun\n");
-return AVERROR_INVALIDDATA;
-}
-val = *src++;
+val = bytestream2_get_byte(&ctx->g);
 for (i = 0; i < 64; i++)
 BLK(ctx->cur, bx + (i & 0x7), by + (i >> 3)) = val;
 } else {// handle four 4x4 subblocks
 for (i = 0; i < 4; i++) {
 l0x = bx + (i & 1) * 4;
 l0y = by + (i & 2) * 2;
-kmvc_getbit(bb, src, src_end, res);
+kmvc_getbit(bb, &ctx->g, res);
 if (!res) {
-kmvc_getbit(bb, src, src_end, res);
+kmvc_getbit(bb, &ctx->g, res);
 if (!res) { // fill whole 4x4 block
-if (src >= src_end) {
-av_log(ctx->avctx, AV_LOG_ERROR, "Data 
overrun\n");
-return AVERROR_INVALIDDATA;
-}
-val = *src++;
+val = bytestream2_get_byte(&ctx->g);
 for (j = 0; j < 16; j++)
 BLK(ctx->cur, l0x + (j & 3), l0y + (j >> 2)) = 
val;
 } else {// copy block from already decoded 
place
-if (src >= src_end) {
-av_log(ctx->avctx, AV_LOG_ERROR, "Data 
overrun\n");
-return AVERROR_INVALIDDATA;
-}
-val = *src++;
+val = bytestream2_get_byte(&ctx->g);
 mx = val & 0xF;
 my = val >> 4;
 for (j = 0; j < 16; j++)
@@ -125,25 +113,17 @@ static int kmvc_decode_intra_8x8(KmvcContext * ctx, const 
uint8_t * src, int src
 for (j = 0; j < 4; j++) {
 l1x = l0x + (j & 1) * 2;
 l1y = l0y + (j & 2);
-kmvc_getbit(bb, src, src_end, res);
+kmvc_getbit(bb, &ctx->g, res);
 if (!res) {
-kmvc_getbit(bb, src, src_end, res);
+kmvc_getbit(bb, &ctx->g, res);
 if (!res) { // fill whole 2x2 block
-if (src >= src_end) {
-  

[libav-commits] aacps: Add missing newline in error message.

2012-01-09 Thread Alex Converse
Module: libav
Branch: master
Commit: 9de3cbc182577ad4813804ece967ccf401d1b559

Author:Alex Converse 
Committer: Alex Converse 
Date:  Fri Jan  6 14:49:11 2012 -0800

aacps: Add missing newline in error message.

---

 libavcodec/aacps.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/aacps.c b/libavcodec/aacps.c
index d7d6ef8..3da912c 100644
--- a/libavcodec/aacps.c
+++ b/libavcodec/aacps.c
@@ -223,7 +223,7 @@ int ff_ps_read_data(AVCodecContext *avctx, GetBitContext 
*gb_host, PSContext *ps
 cnt -= 2 + ps_read_extension_data(gb, ps, ps_extension_id);
 }
 if (cnt < 0) {
-av_log(avctx, AV_LOG_ERROR, "ps extension overflow %d", cnt);
+av_log(avctx, AV_LOG_ERROR, "ps extension overflow %d\n", cnt);
 goto err;
 }
 skip_bits(gb, cnt);

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] fate: Add tests for vc1/wmapro in ism.

2012-01-09 Thread Alex Converse
Module: libav
Branch: master
Commit: cd6e34d3693436c1732ff1e977ab659d53314dc1

Author:Alex Converse 
Committer: Alex Converse 
Date:  Thu Jan  5 18:39:20 2012 -0800

fate: Add tests for vc1/wmapro in ism.

---

 tests/fate/microsoft.mak |3 +
 tests/fate/wma.mak   |5 ++
 tests/ref/fate/vc1-ism   |  120 ++
 3 files changed, 128 insertions(+), 0 deletions(-)

diff --git a/tests/fate/microsoft.mak b/tests/fate/microsoft.mak
index bb7e701..b36f854 100644
--- a/tests/fate/microsoft.mak
+++ b/tests/fate/microsoft.mak
@@ -25,3 +25,6 @@ fate-vc1_sa10091: CMD = framecrc -i $(SAMPLES)/vc1/SA10091.vc1
 
 FATE_TESTS += fate-vc1_sa20021
 fate-vc1_sa20021: CMD = framecrc -i $(SAMPLES)/vc1/SA20021.vc1
+
+FATE_TESTS += fate-vc1-ism
+fate-vc1-ism: CMD = framecrc -i $(SAMPLES)/isom/vc1-wmapro.ism -an
diff --git a/tests/fate/wma.mak b/tests/fate/wma.mak
index 25626f3..e448d76 100644
--- a/tests/fate/wma.mak
+++ b/tests/fate/wma.mak
@@ -8,6 +8,11 @@ fate-wmapro-5.1: CMD = pcm -i 
$(SAMPLES)/wmapro/latin_192_mulitchannel_cut.wma
 fate-wmapro-5.1: CMP = oneoff
 fate-wmapro-5.1: REF = $(SAMPLES)/wmapro/latin_192_mulitchannel_cut.pcm
 
+FATE_TESTS += fate-wmapro-ism
+fate-wmapro-ism: CMD = pcm -i $(SAMPLES)/isom/vc1-wmapro.ism -vn
+fate-wmapro-ism: CMP = oneoff
+fate-wmapro-ism: REF = $(SAMPLES)/isom/vc1-wmapro.pcm
+
 FATE_TESTS += fate-wmavoice-7k
 fate-wmavoice-7k: CMD = pcm -i $(SAMPLES)/wmavoice/streaming_CBR-7K.wma
 fate-wmavoice-7k: CMP = stddev
diff --git a/tests/ref/fate/vc1-ism b/tests/ref/fate/vc1-ism
new file mode 100644
index 000..886e583
--- /dev/null
+++ b/tests/ref/fate/vc1-ism
@@ -0,0 +1,120 @@
+0, 0, 37440, 0xd1bc5235
+0, 3750, 37440, 0x158e6167
+0, 7500, 37440, 0x0faa4481
+0, 11250, 37440, 0x427158c5
+0, 15000, 37440, 0x4eb53ac6
+0, 18750, 37440, 0x99304eea
+0, 22500, 37440, 0xcc554a6f
+0, 26250, 37440, 0xabeb6c35
+0, 3, 37440, 0xddfc7e18
+0, 33750, 37440, 0xaa79b504
+0, 37500, 37440, 0x5cb1c839
+0, 41250, 37440, 0x7e36ecca
+0, 45000, 37440, 0xf486f425
+0, 48750, 37440, 0xf1b4138f
+0, 52500, 37440, 0x966f1a49
+0, 56250, 37440, 0x5eff21da
+0, 6, 37440, 0x333f39b1
+0, 63750, 37440, 0x62e5963e
+0, 67500, 37440, 0x26930671
+0, 71250, 37440, 0x27b4bb6c
+0, 75000, 37440, 0xdbd07766
+0, 78750, 37440, 0x04260104
+0, 82500, 37440, 0x9b1e078b
+0, 86250, 37440, 0xdf4e2474
+0, 9, 37440, 0x57d44986
+0, 93750, 37440, 0x8780e34c
+0, 97500, 37440, 0xf80c8bc0
+0, 101250, 37440, 0x630a7583
+0, 105000, 37440, 0x235ae089
+0, 108750, 37440, 0x984b8f0e
+0, 112500, 37440, 0x865cf592
+0, 116250, 37440, 0x70f376f2
+0, 12, 37440, 0x8b30c035
+0, 123750, 37440, 0xde772d79
+0, 127500, 37440, 0x8e076be5
+0, 131250, 37440, 0x3dc2bd9f
+0, 135000, 37440, 0xb782eb67
+0, 138750, 37440, 0x02025d73
+0, 142500, 37440, 0x86bbbce8
+0, 146250, 37440, 0xd6554f62
+0, 15, 37440, 0xb831b917
+0, 153750, 37440, 0x80643560
+0, 157500, 37440, 0x4ecf9afd
+0, 161250, 37440, 0x9ce51e0b
+0, 165000, 37440, 0x179466cd
+0, 168750, 37440, 0x145fc900
+0, 172500, 37440, 0xb1b50402
+0, 176250, 37440, 0x0a87552a
+0, 18, 37440, 0x8f53821d
+0, 183750, 37440, 0x1c07c825
+0, 187500, 37440, 0x49dde82f
+0, 191250, 37440, 0xb1a32605
+0, 195000, 37440, 0x410f3cd5
+0, 198750, 37440, 0xff5e6696
+0, 202500, 37440, 0x96f678c9
+0, 206250, 37440, 0x6c9e9e68
+0, 21, 37440, 0x79a2a655
+0, 213750, 37440, 0xf237bd6c
+0, 217500, 37440, 0x4051b611
+0, 221250, 37440, 0xc7ccc918
+0, 225000, 37440, 0xbd02c122
+0, 228750, 37440, 0xacb3c881
+0, 232500, 37440, 0x2abdb940
+0, 236250, 37440, 0x19d5be85
+0, 24, 37440, 0xfa5fb1ba
+0, 243750, 37440, 0xdae7a7aa
+0, 247500, 37440, 0x6b0f9f69
+0, 251250, 37440, 0x353e8201
+0, 255000, 37440, 0xa21443aa
+0, 258750, 37440, 0x66c8d7e0
+0, 262500, 37440, 0xc332068e
+0, 266250, 37440, 0x71431b9b
+0, 27, 37440, 0x392f15cb
+0, 273750, 37440, 0x95a146bb
+0, 277500, 37440, 0x7c51740a
+0, 281250, 37440, 0xa3bdd43c
+0, 285000, 37440, 0xa079f965
+0, 288750, 37440, 0xa95423ea
+0, 292500, 37440, 0xd1bd2c67
+0, 296250, 37440, 0x6cf82844
+0, 30, 37440, 0xd401e128
+0, 303750, 37440, 0x1f7db118
+0, 307500, 37440, 0x2e0a65a9
+0, 311250, 37440, 0x321c1c40
+0, 315000, 37440, 0x95b2a127
+0, 318750, 37440, 0xa1471f4b
+0, 322500, 37440, 0x29d148c0
+0, 326250, 37440, 0x24c07107
+0, 33, 37440, 0x0ead678d
+0, 333750, 37440, 0xd0ca6495
+0, 337500, 37440, 0x08f935ef
+0, 341250, 37440, 0xb5ec3c38
+0, 345000, 37440, 0xce371628
+0, 348750, 37440, 0x68170812
+0, 352500, 37440, 0xe222699e
+0, 356250, 37440, 0xd688706c
+0, 36, 37440, 0x81a033f9
+0, 363750, 37440, 0x28bd0fbf
+0, 367500, 37440, 0xe36db7b2
+0, 371250, 37440, 0x30559121
+0, 375000, 37440, 0xbf2b5fc8
+0, 378750, 37440, 0x4b427672
+0, 382500, 37440, 0x0544b0b4
+0, 386250, 37440, 0x38a70b06
+0, 39, 37440, 0x4ed62607
+0, 393750, 37440, 0x6efe8ea6
+0, 397500, 37440, 0x81197e11
+0, 401250, 37440, 0xf4060050
+0, 405000, 37440, 0xaf205f13
+0, 408750, 37440, 0x5fa21382
+0, 412500, 37440, 0x8627ad05
+0, 416250, 37440, 0x

[libav-commits] fate: Add tests for more AAC features.

2012-01-09 Thread Gaurav Narula
Module: libav
Branch: master
Commit: a67b8c86d06eb5b78a0fe4cb9be4e93b29726db1

Author:Gaurav Narula 
Committer: Alex Converse 
Date:  Fri Dec 30 03:08:22 2011 +0530

fate: Add tests for more AAC features.

al15_44 uses independent coupling.
al18_44 uses PNS (perceptual noise substitution).
am05_44 uses main prediction and independent coupling.

Signed-off-by: Alex Converse 

---

 tests/fate/aac.mak |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak
index a3e145f..ea87436 100644
--- a/tests/fate/aac.mak
+++ b/tests/fate/aac.mak
@@ -14,14 +14,26 @@ FATE_AAC += fate-aac-al07_96
 fate-aac-al07_96: CMD = pcm -i $(SAMPLES)/aac/al07_96.mp4
 fate-aac-al07_96: REF = $(SAMPLES)/aac/al07_96.s16
 
+FATE_AAC += fate-aac-al15_44
+fate-aac-al15_44: CMD = pcm -i $(SAMPLES)/aac/al15_44.mp4
+fate-aac-al15_44: REF = $(SAMPLES)/aac/al15_44.s16
+
 FATE_AAC += fate-aac-al17_44
 fate-aac-al17_44: CMD = pcm -i $(SAMPLES)/aac/al17_44.mp4
 fate-aac-al17_44: REF = $(SAMPLES)/aac/al17_44.s16
 
+FATE_AAC += fate-aac-al18_44
+fate-aac-al18_44: CMD = pcm -i $(SAMPLES)/aac/al18_44.mp4
+fate-aac-al18_44: REF = $(SAMPLES)/aac/al18_44.s16
+
 FATE_AAC += fate-aac-am00_88
 fate-aac-am00_88: CMD = pcm -i $(SAMPLES)/aac/am00_88.mp4
 fate-aac-am00_88: REF = $(SAMPLES)/aac/am00_88.s16
 
+FATE_AAC += fate-aac-am05_44
+fate-aac-am05_44: CMD = pcm -i $(SAMPLES)/aac/am05_44.mp4
+fate-aac-am05_44: REF = $(SAMPLES)/aac/am05_44.s16
+
 FATE_AAC += fate-aac-al_sbr_hq_cm_48_2
 fate-aac-al_sbr_hq_cm_48_2: CMD = pcm -i $(SAMPLES)/aac/al_sbr_cm_48_2.mp4
 fate-aac-al_sbr_hq_cm_48_2: REF = $(SAMPLES)/aac/al_sbr_hq_cm_48_2.s16

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] aacdec: Add a fate test for 5.1 channel SBR.

2012-01-09 Thread Alex Converse
Module: libav
Branch: master
Commit: 46ef355c652fed8984a5c92e961b78282d9ebb2c

Author:Alex Converse 
Committer: Alex Converse 
Date:  Fri Jan  6 17:23:49 2012 -0800

aacdec: Add a fate test for 5.1 channel SBR.

---

 tests/fate/aac.mak |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak
index f17c914..a3e145f 100644
--- a/tests/fate/aac.mak
+++ b/tests/fate/aac.mak
@@ -26,6 +26,10 @@ FATE_AAC += fate-aac-al_sbr_hq_cm_48_2
 fate-aac-al_sbr_hq_cm_48_2: CMD = pcm -i $(SAMPLES)/aac/al_sbr_cm_48_2.mp4
 fate-aac-al_sbr_hq_cm_48_2: REF = $(SAMPLES)/aac/al_sbr_hq_cm_48_2.s16
 
+FATE_AAC += fate-aac-al_sbr_hq_cm_48_5.1
+fate-aac-al_sbr_hq_cm_48_5.1: CMD = pcm -i $(SAMPLES)/aac/al_sbr_cm_48_5.1.mp4
+fate-aac-al_sbr_hq_cm_48_5.1: REF = $(SAMPLES)/aac/al_sbr_hq_cm_48_5.1.s16
+
 FATE_AAC += fate-aac-al_sbr_ps_06_ur
 fate-aac-al_sbr_ps_06_ur: CMD = pcm -i $(SAMPLES)/aac/al_sbr_ps_06_new.mp4
 fate-aac-al_sbr_ps_06_ur: REF = $(SAMPLES)/aac/al_sbr_ps_06_ur.s16

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] aacdec: Turn off PS for multichannel files that use PCE based configs.

2012-01-09 Thread Alex Converse
Module: libav
Branch: master
Commit: 4acd43a295aae0a88ae26cd54cd06b1df146e815

Author:Alex Converse 
Committer: Alex Converse 
Date:  Fri Jan  6 17:22:45 2012 -0800

aacdec: Turn off PS for multichannel files that use PCE based configs.

Fixes al_sbr_cm_48_5.1.mp4.

---

 libavcodec/aac.h|1 +
 libavcodec/aacdec.c |   21 +++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index 30491fe..a36080c 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -84,6 +84,7 @@ enum BandType {
 #define IS_CODEBOOK_UNSIGNED(x) ((x - 1) & 10)
 
 enum ChannelPosition {
+AAC_CHANNEL_OFF   = 0,
 AAC_CHANNEL_FRONT = 1,
 AAC_CHANNEL_SIDE  = 2,
 AAC_CHANNEL_BACK  = 3,
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 4d3f1ff..b2fc740 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -163,6 +163,19 @@ static ChannelElement *get_che(AACContext *ac, int type, 
int elem_id)
 }
 }
 
+static int count_channels(enum ChannelPosition che_pos[4][MAX_ELEM_ID])
+{
+int i, type, sum = 0;
+for (i = 0; i < MAX_ELEM_ID; i++) {
+for (type = 0; type < 4; type++) {
+sum += (1 + (type == TYPE_CPE)) *
+(che_pos[type][i] != AAC_CHANNEL_OFF &&
+ che_pos[type][i] != AAC_CHANNEL_CC);
+}
+}
+return sum;
+}
+
 /**
  * Check for the channel element in the current channel position configuration.
  * If it exists, make sure the appropriate element is allocated and map the
@@ -418,6 +431,12 @@ static int decode_ga_specific_config(AACContext *ac, 
AVCodecContext *avctx,
 if ((ret = set_default_channel_config(avctx, new_che_pos, 
channel_config)))
 return ret;
 }
+
+if (count_channels(new_che_pos) > 1) {
+m4ac->ps = 0;
+} else if (m4ac->sbr == 1 && m4ac->ps == -1)
+m4ac->ps = 1;
+
 if (ac && (ret = output_configure(ac, ac->che_pos, new_che_pos, 
channel_config, OC_GLOBAL_HDR)))
 return ret;
 
@@ -476,8 +495,6 @@ static int decode_audio_specific_config(AACContext *ac,
 av_log(avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", 
m4ac->sampling_index);
 return -1;
 }
-if (m4ac->sbr == 1 && m4ac->ps == -1)
-m4ac->ps = 1;
 
 skip_bits_long(&gb, i);
 

___
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits


[libav-commits] cabac: remove put_cabac_u/ueg from cabac-test.

2012-01-09 Thread Diego Biurrun
Module: libav
Branch: master
Commit: 1ef8ff4534706de0b1da3442f380be58a650acf2

Author:Diego Biurrun 
Committer: Diego Biurrun 
Date:  Sat Jan  7 20:27:31 2012 +0100

cabac: remove put_cabac_u/ueg from cabac-test.

The functions are not used in any part of Libav, therefore testing them in the
cabac-test is unnecessary. Since this makes them unused, remove the functions.

---

 libavcodec/cabac.c |   73 
 1 files changed, 0 insertions(+), 73 deletions(-)

diff --git a/libavcodec/cabac.c b/libavcodec/cabac.c
index 466d623..54414fa 100644
--- a/libavcodec/cabac.c
+++ b/libavcodec/cabac.c
@@ -248,67 +248,6 @@ static int put_cabac_terminate(CABACContext *c, int bit){
 return (put_bits_count(&c->pb)+7)>>3;
 }
 
-/**
- * put (truncated) unary binarization.
- */
-static void put_cabac_u(CABACContext *c, uint8_t * state, int v, int max, int 
max_index, int truncated){
-int i;
-
-assert(v <= max);
-
-for(i=0; i= m){ //FIXME optimize
-put_cabac_bypass(c, 1);
-v-= m;
-m+= m;
-}
-put_cabac_bypass(c, 0);
-while(m>>=1){
-put_cabac_bypass(c, v&m);
-}
-}
-
-if(is_signed)
-put_cabac_bypass(c, sign);
-}
-}
-
 int main(void){
 CABACContext c;
 uint8_t b[9*SIZE];
@@ -337,18 +276,6 @@ START_TIMER
 STOP_TIMER("put_cabac")
 }
 
-for(i=0; ihttps://lists.libav.org/mailman/listinfo/libav-commits