[FFmpeg-cvslog] avfilter/vf_shuffleframes: allow also dropping frames
ffmpeg | branch: master | Paul B Mahol | Fri Jan 6 12:27:46 2017 +0100| [520c0736fd2079f04a2a0ba09562bae49f62f472] | committer: Paul B Mahol avfilter/vf_shuffleframes: allow also dropping frames Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=520c0736fd2079f04a2a0ba09562bae49f62f472 --- doc/filters.texi | 3 ++- libavfilter/vf_shuffleframes.c | 14 -- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 42cdd2e..94548b1 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -12285,7 +12285,7 @@ Set the size of the box used to represent one palette color entry. Default is @section shuffleframes -Reorder and/or duplicate video frames. +Reorder and/or duplicate and/or drop video frames. It accepts the following parameters: @@ -12294,6 +12294,7 @@ It accepts the following parameters: Set the destination indexes of input frames. This is space or '|' separated list of indexes that maps input frames to output frames. Number of indexes also sets maximal value that each index may have. +'-1' index have special meaning and that is to drop frame. @end table The first frame has the index 0. The default is to keep the input unchanged. diff --git a/libavfilter/vf_shuffleframes.c b/libavfilter/vf_shuffleframes.c index bfbf4bd..8e59511 100644 --- a/libavfilter/vf_shuffleframes.c +++ b/libavfilter/vf_shuffleframes.c @@ -68,7 +68,7 @@ static av_cold int init(AVFilterContext *ctx) return AVERROR(EINVAL); } -if (s->map[n] < 0 || s->map[n] >= nb_items) { +if (s->map[n] < -1 || s->map[n] >= nb_items) { av_log(ctx, AV_LOG_ERROR, "Index out of range.\n"); av_free(mapping); return AVERROR(EINVAL); @@ -99,11 +99,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) AVFrame *out; x = s->map[n]; -out = av_frame_clone(s->frames[x]); -if (!out) -return AVERROR(ENOMEM); -out->pts = s->pts[n]; -ret = ff_filter_frame(ctx->outputs[0], out); +if (x >= 0) { +out = av_frame_clone(s->frames[x]); +if (!out) +return AVERROR(ENOMEM); +out->pts = s->pts[n]; +ret = ff_filter_frame(ctx->outputs[0], out); +} s->in_frames--; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/asrc_flite: Fix textbuf leak
ffmpeg | branch: master | Michael Niedermayer | Fri Jan 6 15:46:56 2017 +0100| [bc6b53ae99cded18296e6beb8dc840722d08be76] | committer: Michael Niedermayer avfilter/asrc_flite: Fix textbuf leak Fixes CID1244189 Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bc6b53ae99cded18296e6beb8dc840722d08be76 --- libavfilter/asrc_flite.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavfilter/asrc_flite.c b/libavfilter/asrc_flite.c index b3f83ab..2e5bd4b 100644 --- a/libavfilter/asrc_flite.c +++ b/libavfilter/asrc_flite.c @@ -170,8 +170,10 @@ static av_cold int init(AVFilterContext *ctx) return ret; } -if (!(flite->text = av_malloc(textbuf_size+1))) +if (!(flite->text = av_malloc(textbuf_size+1))) { +av_file_unmap(textbuf, textbuf_size); return AVERROR(ENOMEM); +} memcpy(flite->text, textbuf, textbuf_size); flite->text[textbuf_size] = 0; av_file_unmap(textbuf, textbuf_size); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libavcodec/exr: Fix blank output when data window != display window
ffmpeg | branch: master | Kevin Wheatley | Tue Jan 3 16:31:16 2017 +| [09905c412ddb2dc3dd24e5741f64a59c7610e8ea] | committer: Paul B Mahol libavcodec/exr: Fix blank output when data window != display window looks like there is a bug in commit 1a08758e7c4e14a9ea8d2fef6c33ad411b2d3c40 relating to the handling of ptr in decode_frame after decode_block is called, before this commit ptr would have been incremented for each line in the data window, now after the commit it is left at the start of the first included line rather than the line after the data window then the code sets the remaining lines to 0 and thus the whole image is over written. Fix by adjusting ptr to the correct line after decode_block returns Signed-off-by: Kevin Wheatley > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=09905c412ddb2dc3dd24e5741f64a59c7610e8ea --- libavcodec/exr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 7852727..2c213b3 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -1729,6 +1729,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, avctx->execute2(avctx, decode_block, s->thread_data, NULL, nb_blocks); // Zero out the end if ymax+1 is not h +ptr = picture->data[0] + ((s->ymax+1) * picture->linesize[0]); for (y = s->ymax + 1; y < avctx->height; y++) { memset(ptr, 0, out_line_size); ptr += picture->linesize[0]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] omadec: fix overflows during bit rate calculation
ffmpeg | branch: master | Andreas Cadhalpun | Tue Dec 13 00:35:12 2016 +0100| [d74c471a39db2919a0e1db9666df725cbcb83d86] | committer: Andreas Cadhalpun omadec: fix overflows during bit rate calculation Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d74c471a39db2919a0e1db9666df725cbcb83d86 --- libavformat/omadec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/omadec.c b/libavformat/omadec.c index 6e476db..757ae53 100644 --- a/libavformat/omadec.c +++ b/libavformat/omadec.c @@ -365,7 +365,7 @@ static int oma_read_header(AVFormatContext *s) st->codecpar->channels= 2; st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; st->codecpar->sample_rate = samplerate; -st->codecpar->bit_rate= st->codecpar->sample_rate * framesize * 8 / 1024; +st->codecpar->bit_rate= st->codecpar->sample_rate * framesize / (1024 / 8); /* fake the ATRAC3 extradata * (wav format, makes stream copy to wav work) */ @@ -398,7 +398,7 @@ static int oma_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; } st->codecpar->sample_rate = samplerate; -st->codecpar->bit_rate= samplerate * framesize * 8 / 2048; +st->codecpar->bit_rate= samplerate * framesize / (2048 / 8); avpriv_set_pts_info(st, 64, 1, samplerate); break; case OMA_CODECID_MP3: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/iff: add support for vertical word compression in ILBM
ffmpeg | branch: master | Paul B Mahol | Fri Jan 6 21:44:14 2017 +0100| [49633f9f7498499d63391eb1351de66a8f603060] | committer: Paul B Mahol avcodec/iff: add support for vertical word compression in ILBM Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=49633f9f7498499d63391eb1351de66a8f603060 --- libavcodec/iff.c | 85 +++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/libavcodec/iff.c b/libavcodec/iff.c index c1c451c..96649db 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -413,7 +413,7 @@ static av_cold int decode_init(AVCodecContext *avctx) if ((err = av_image_check_size(avctx->width, avctx->height, 0, avctx))) return err; s->planesize = FFALIGN(avctx->width, 16) >> 3; // Align plane size in bits to word-boundary -s->planebuf = av_malloc(s->planesize + AV_INPUT_BUFFER_PADDING_SIZE); +s->planebuf = av_malloc(s->planesize * avctx->height + AV_INPUT_BUFFER_PADDING_SIZE); if (!s->planebuf) return AVERROR(ENOMEM); @@ -557,6 +557,76 @@ static int decode_byterun(uint8_t *dst, int dst_size, return bytestream2_tell(gb); } +static int decode_byterun2(uint8_t *dst, int height, int line_size, + GetByteContext *gb) +{ +GetByteContext cmds; +unsigned count; +int i, y_pos = 0, x_pos = 0; + +if (bytestream2_get_be32(gb) != MKBETAG('V', 'D', 'A', 'T')) +return 0; + +bytestream2_skip(gb, 4); +count = bytestream2_get_be16(gb) - 2; +if (bytestream2_get_bytes_left(gb) < count) +return 0; + +bytestream2_init(&cmds, gb->buffer, count); +bytestream2_skip(gb, count); + +for (i = 0; i < count && x_pos < line_size; i++) { +int8_t cmd = bytestream2_get_byte(&cmds); +int l, r; + +if (cmd == 0) { +l = bytestream2_get_be16(gb); +while (l-- > 0 && x_pos < line_size) { +dst[x_pos + y_pos * line_size] = bytestream2_get_byte(gb); +dst[x_pos + y_pos++ * line_size + 1] = bytestream2_get_byte(gb); +if (y_pos >= height) { +y_pos = 0; +x_pos += 2; +} +} +} else if (cmd < 0) { +l = -cmd; +while (l-- > 0 && x_pos < line_size) { +dst[x_pos + y_pos * line_size] = bytestream2_get_byte(gb); +dst[x_pos + y_pos++ * line_size + 1] = bytestream2_get_byte(gb); +if (y_pos >= height) { +y_pos = 0; +x_pos += 2; +} +} +} else if (cmd == 1) { +l = bytestream2_get_be16(gb); +r = bytestream2_get_be16(gb); +while (l-- > 0 && x_pos < line_size) { +dst[x_pos + y_pos * line_size] = r >> 8; +dst[x_pos + y_pos++ * line_size + 1] = r & 0xFF; +if (y_pos >= height) { +y_pos = 0; +x_pos += 2; +} +} +} else { +l = cmd; +r = bytestream2_get_be16(gb); +while (l-- > 0 && x_pos < line_size) { +dst[x_pos + y_pos * line_size] = r >> 8; +dst[x_pos + y_pos++ * line_size + 1] = r & 0xFF; +if (y_pos >= height) { +y_pos = 0; +x_pos += 2; +} +} +} +} + +return bytestream2_tell(gb); +} + #define DECODE_RGBX_COMMON(type) \ if (!length) { \ length = bytestream2_get_byte(gb); \ @@ -1623,6 +1693,19 @@ static int decode_frame(AVCodecContext *avctx, return unsupported(avctx); } break; +case 0x2: +if (avctx->codec_tag == MKTAG('I', 'L', 'B', 'M') && avctx->pix_fmt == AV_PIX_FMT_PAL8) { +for (plane = 0; plane < s->bpp; plane++) { +decode_byterun2(s->planebuf, avctx->height, s->planesize, gb); +for (y = 0; y < avctx->height; y++) { +uint8_t *row = &frame->data[0][y * frame->linesize[0]]; +decodeplane8(row, s->planebuf + s->planesize * y, s->planesize, plane); +} +} +} else { +return unsupported(avctx); +} +break; case 0x4: if (avctx->codec_tag == MKTAG('R', 'G', 'B', '8') && avctx->pix_fmt == AV_PIX_FMT_RGB32) decode_rgb8(gb, frame->data[0], avctx->width, avctx->height, frame->linesize[0]); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec: add QDMC decoder
ffmpeg | branch: master | Paul B Mahol | Mon Dec 26 16:58:46 2016 +0100| [90ac9f4094afc2aa7ee64a7b02df8fb05cbd7d8a] | committer: Paul B Mahol avcodec: add QDMC decoder Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=90ac9f4094afc2aa7ee64a7b02df8fb05cbd7d8a --- Changelog | 1 + doc/general.texi | 1 + libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/qdmc.c | 783 + libavcodec/version.h | 4 +- 6 files changed, 789 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index aff9ab0..e09bf20 100644 --- a/Changelog +++ b/Changelog @@ -12,6 +12,7 @@ version : - 16.8 floating point pcm decoder - 24.0 floating point pcm decoder - Apple Pixlet decoder +- QDMC audio decoder version 3.2: - libopenmpt demuxer diff --git a/doc/general.texi b/doc/general.texi index 084c0a1..a13a8fc 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -1048,6 +1048,7 @@ following image formats are supported: @item PCM unsigned 32-bit little-endian @tab X @tab X @item PCM Zork @tab @tab X @item QCELP / PureVoice @tab @tab X +@item QDesign Music Codec 1 @tab @tab X @item QDesign Music Codec 2 @tab @tab X @tab There are still some distortions. @item RealAudio 1.0 (14.4K) @tab X @tab X diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 58feb31..44e416e 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -466,6 +466,7 @@ OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o \ celp_filters.o acelp_vectors.o \ acelp_filters.o OBJS-$(CONFIG_QDM2_DECODER)+= qdm2.o +OBJS-$(CONFIG_QDMC_DECODER)+= qdmc.o OBJS-$(CONFIG_QDRAW_DECODER) += qdrw.o OBJS-$(CONFIG_QPEG_DECODER)+= qpeg.o OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 678f54a..4540ef7 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -449,6 +449,7 @@ void avcodec_register_all(void) REGISTER_DECODER(PAF_AUDIO, paf_audio); REGISTER_DECODER(QCELP, qcelp); REGISTER_DECODER(QDM2, qdm2); +REGISTER_DECODER(QDMC, qdmc); REGISTER_ENCDEC (RA_144,ra_144); REGISTER_DECODER(RA_288,ra_288); REGISTER_DECODER(RALF, ralf); diff --git a/libavcodec/qdmc.c b/libavcodec/qdmc.c new file mode 100644 index 000..9560a3b --- /dev/null +++ b/libavcodec/qdmc.c @@ -0,0 +1,783 @@ +/* + * QDMC compatible decoder + * Copyright (c) 2017 Paul B Mahol + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include + +#define BITSTREAM_READER_LE + +#include "libavutil/channel_layout.h" + +#include "avcodec.h" +#include "bytestream.h" +#include "get_bits.h" +#include "internal.h" +#include "fft.h" + +typedef struct QDMCTone { +uint8_t mode; +uint8_t phase; +uint8_t offset; +int16_t freq; +int16_t amplitude; +} QDMCTone; + +typedef struct QDMCContext { +AVCodecContext *avctx; + +uint8_t frame_bits; +int band_index; +int frame_size; +int subframe_size; +int fft_offset; +int buffer_offset; +int nb_channels; +int checksum_size; + +uint8_t noise[2][19][16]; +QDMCTone tones[5][8192]; +int nb_tones[5]; +int cur_tone[5]; +float alt_sin[5][31]; +float fft_buffer[4][8192 * 2]; +float noise2_buffer[4096 * 2]; +float noise_buffer[4096 * 2]; +float buffer[2 * 32768]; +float *buffer_ptr; +int rndval; + +DECLARE_ALIGNED(32, FFTComplex, cmplx)[2][512]; +FFTContext fft_ctx; +} QDMCContext; + +static float sin_table[512]; +static VLC vtable[6]; + +static const unsigned code_prefix[] = { +0x0, 0x1, 0x2, 0x3, 0x4, 0x6, 0x8, 0xA, +0xC, 0x10, 0x14, 0x18, 0x1C, 0x24, 0x2C, 0x34, +0x3C, 0x4C, 0x5C, 0x6C, 0x7C, 0x9C, 0xBC, 0xDC, +0xFC, 0x13C, 0x17C, 0x1BC, 0x1FC, 0x27C, 0x2FC, 0x37C, +0x3FC, 0x4FC, 0x5FC, 0x6FC, 0x7FC, 0x9FC, 0xBFC, 0xDFC, +0xFFC, 0x13FC, 0x17FC, 0x1BFC, 0x1FFC,