From b62d4c16c901a7e3fe0296345970bce815ac410e Mon Sep 17 00:00:00 2001 From: Derek Buitenhuis Date: Tue, 25 Sep 2012 12:54:26 -0400 Subject: Revert "cbrt_tablegen: Include libm.h" This code runs on the host and should not use libm.h, which is meant for the target. This reverts commit 2768b717987d4e19d2774890d7d84aef531b1d9f. --- libavcodec/cbrt_tablegen.c | 1 - 1 file changed, 1 deletion(-) (limited to 'libavcodec') diff --git a/libavcodec/cbrt_tablegen.c b/libavcodec/cbrt_tablegen.c index 44c2695560..e92c0f1db1 100644 --- a/libavcodec/cbrt_tablegen.c +++ b/libavcodec/cbrt_tablegen.c @@ -21,7 +21,6 @@ */ #include -#include "libavutil/libm.h" #define CONFIG_HARDCODED_TABLES 0 #include "cbrt_tablegen.h" #include "tableprint.h" -- cgit v1.2.3 From a10190dcd8e4f357119676510bd182699b61cf36 Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Tue, 25 Sep 2012 08:31:44 +0300 Subject: libfdk-aac: Warn the user that the VBR modes are unsupported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These modes were not originally exposed by the library at all. In practice, only a few of them work for each sample rate/profile combination, and they don't work at all for the more uncommon sample rates. Signed-off-by: Martin Storsjö --- libavcodec/libfdk-aacenc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libavcodec') diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c index 289c7aca9e..362a17ccdf 100644 --- a/libavcodec/libfdk-aacenc.c +++ b/libavcodec/libfdk-aacenc.c @@ -180,6 +180,9 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) "VBR quality %d out of range, should be 1-5\n", mode); mode = av_clip(mode, 1, 5); } + av_log(avctx, AV_LOG_WARNING, + "Note, the VBR setting is unsupported and only works with " + "some parameter combinations\n"); if ((err = aacEncoder_SetParam(s->handle, AACENC_BITRATEMODE, mode)) != AACENC_OK) { av_log(avctx, AV_LOG_ERROR, "Unable to set the VBR bitrate mode %d: %s\n", -- cgit v1.2.3 From 375bff7084fd836a6c60b1f5d28a427ab55b66bc Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Tue, 25 Sep 2012 08:37:21 +0300 Subject: libfdk-aac: Allow setting VBR modes via a private option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids using the global_quality field and QSCALE flag for passing the VBR modes, since the value range of the global_quality field doesn't really map cleanly to this codec's VBR modes. Signed-off-by: Martin Storsjö --- libavcodec/libfdk-aacenc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c index 362a17ccdf..fada1c2550 100644 --- a/libavcodec/libfdk-aacenc.c +++ b/libavcodec/libfdk-aacenc.c @@ -36,6 +36,7 @@ typedef struct AACContext { int signaling; int latm; int header_period; + int vbr; AudioFrameQueue afq; } AACContext; @@ -50,6 +51,7 @@ static const AVOption aac_enc_options[] = { { "explicit_hierarchical", "Explicit hierarchical signaling", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" }, { "latm", "Output LATM/LOAS encapsulated data", offsetof(AACContext, latm), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, { "header_period", "StreamMuxConfig and PCE repetition period (in frames)", offsetof(AACContext, header_period), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 0xffff, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, + { "vbr", "VBR mode (1-5)", offsetof(AACContext, vbr), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 5, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, { NULL } }; @@ -173,8 +175,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) goto error; } - if (avctx->flags & CODEC_FLAG_QSCALE) { - int mode = avctx->global_quality; + if (avctx->flags & CODEC_FLAG_QSCALE || s->vbr) { + int mode = s->vbr ? s->vbr : avctx->global_quality; if (mode < 1 || mode > 5) { av_log(avctx, AV_LOG_WARNING, "VBR quality %d out of range, should be 1-5\n", mode); -- cgit v1.2.3 From 92d2b909a0de6e2f77a98405280c78052b35b421 Mon Sep 17 00:00:00 2001 From: Alexandre Colucci Date: Mon, 2 May 2011 18:55:02 +0200 Subject: xsub: feed init_get_bits the whole buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not use rlelen field for buffer size in init_get_bits, it is only the size of the data for the first field. Since it is not reliable, just use the size of the whole buffer. Additional comments add removal of unused rlelen variable by Reimar Döffinger. Signed-off-by: Luca Barbato --- libavcodec/xsubdec.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c index b66a57e2c2..6a1acc7b03 100644 --- a/libavcodec/xsubdec.c +++ b/libavcodec/xsubdec.c @@ -53,7 +53,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVSubtitle *sub = data; const uint8_t *buf_end = buf + buf_size; uint8_t *bitmap; - int w, h, x, y, rlelen, i; + int w, h, x, y, i; int64_t packet_time = 0; GetBitContext gb; @@ -86,7 +86,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, // skip bottom right position, it gives no new information bytestream_get_le16(&buf); bytestream_get_le16(&buf); - rlelen = bytestream_get_le16(&buf); + // The following value is supposed to indicate the start offset + // (relative to the palette) of the data for the second field, + // however there are files in which it has a bogus value and thus + // we just ignore it + bytestream_get_le16(&buf); // allocate sub and set values sub->rects = av_mallocz(sizeof(*sub->rects)); @@ -108,8 +112,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, ((uint32_t*)sub->rects[0]->pict.data[1])[i] |= 0xff000000; // process RLE-compressed data - rlelen = FFMIN(rlelen, buf_end - buf); - init_get_bits(&gb, buf, rlelen * 8); + init_get_bits(&gb, buf, (buf_end - buf) * 8); bitmap = sub->rects[0]->pict.data[0]; for (y = 0; y < h; y++) { // interlaced: do odd lines -- cgit v1.2.3