[FFmpeg-cvslog] libavcodec/exr : cosmetics, rename variable in b44_uncompress func
ffmpeg | branch: master | Martin Vignali | Sun Jun 26 22:27:37 2016 +0200| [f2b08a07028ebf6511929ed4f5f55a4479d4f825] | committer: Michael Niedermayer libavcodec/exr : cosmetics, rename variable in b44_uncompress func Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f2b08a07028ebf6511929ed4f5f55a4479d4f825 --- libavcodec/exr.c | 66 +++--- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 6960a29..9ad11d6 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -944,74 +944,74 @@ static void unpack_3(const uint8_t b[3], uint16_t s[16]) static int b44_uncompress(EXRContext *s, const uint8_t *src, int compressed_size, int uncompressed_size, EXRThreadData *td) { const int8_t *sr = src; -int stayToUncompress = compressed_size; -int nbB44BlockW, nbB44BlockH; -int indexHgX, indexHgY, indexOut, indexTmp; -uint16_t tmpBuffer[16]; /* B44 use 4x4 half float pixel */ +int stay_to_uncompress = compressed_size; +int nb_b44_block_w, nb_b44_block_h; +int index_tl_x, index_tl_y, index_out, index_tmp; +uint16_t tmp_buffer[16]; /* B44 use 4x4 half float pixel */ int c, iY, iX, y, x; int target_channel_offset = 0; /* calc B44 block count */ -nbB44BlockW = td->xsize / 4; +nb_b44_block_w = td->xsize / 4; if ((td->xsize % 4) != 0) -nbB44BlockW++; +nb_b44_block_w++; -nbB44BlockH = td->ysize / 4; +nb_b44_block_h = td->ysize / 4; if ((td->ysize % 4) != 0) -nbB44BlockH++; +nb_b44_block_h++; for (c = 0; c < s->nb_channels; c++) { if (s->channels[c].pixel_type == EXR_HALF) {/* B44 only compress half float data */ -for (iY = 0; iY < nbB44BlockH; iY++) { -for (iX = 0; iX < nbB44BlockW; iX++) {/* For each B44 block */ -if (stayToUncompress < 3) { -av_log(s, AV_LOG_ERROR, "Not enough data for B44A block: %d", stayToUncompress); +for (iY = 0; iY < nb_b44_block_h; iY++) { +for (iX = 0; iX < nb_b44_block_w; iX++) {/* For each B44 block */ +if (stay_to_uncompress < 3) { +av_log(s, AV_LOG_ERROR, "Not enough data for B44A block: %d", stay_to_uncompress); return AVERROR_INVALIDDATA; } -if (src[compressed_size - stayToUncompress + 2] == 0xfc) { /* B44A block */ -unpack_3(sr, tmpBuffer); +if (src[compressed_size - stay_to_uncompress + 2] == 0xfc) { /* B44A block */ +unpack_3(sr, tmp_buffer); sr += 3; -stayToUncompress -= 3; +stay_to_uncompress -= 3; } else {/* B44 Block */ -if (stayToUncompress < 14) { -av_log(s, AV_LOG_ERROR, "Not enough data for B44 block: %d", stayToUncompress); +if (stay_to_uncompress < 14) { +av_log(s, AV_LOG_ERROR, "Not enough data for B44 block: %d", stay_to_uncompress); return AVERROR_INVALIDDATA; } -unpack_14(sr, tmpBuffer); +unpack_14(sr, tmp_buffer); sr += 14; -stayToUncompress -= 14; +stay_to_uncompress -= 14; } /* copy data to uncompress buffer (B44 block can exceed target resolution)*/ -indexHgX = iX * 4; -indexHgY = iY * 4; - -for (y = indexHgY; y < FFMIN(indexHgY + 4, td->ysize); y++) { -for (x = indexHgX; x < FFMIN(indexHgX + 4, td->xsize); x++) { -indexOut = target_channel_offset * td->xsize + y * td->channel_line_size + 2 * x; -indexTmp = (y-indexHgY) * 4 + (x-indexHgX); -td->uncompressed_data[indexOut] = tmpBuffer[indexTmp] & 0xff; -td->uncompressed_data[indexOut + 1] = tmpBuffer[indexTmp] >> 8; +index_tl_x = iX * 4; +index_tl_y = iY * 4; + +for (y = index_tl_y; y < FFMIN(index_tl_y + 4, td->ysize); y++) { +for (x = index_tl_x; x < FFMIN(index_tl_x + 4, td->xsize); x++) { +index_out = target_channel_offset * td->xsize + y * td->channel_line_size + 2 * x; +index_tmp = (y-index_tl_y) * 4 + (x-index_tl_x); +td->uncompressed_data[index_out] = tmp_buffer[index_tmp] & 0xff; +td->uncompressed_data[index_out + 1] = tm
[FFmpeg-cvslog] Merge commit '76729970049fe95659346503f7401a5d869f9959'
ffmpeg | branch: master | Matthieu Bouron | Wed Jul 13 16:34:39 2016 +0200| [3c058f570128dcfa3a68f0860e2be7f098e8d6e1] | committer: Matthieu Bouron Merge commit '76729970049fe95659346503f7401a5d869f9959' * commit '76729970049fe95659346503f7401a5d869f9959': mov: Implement support for multiple sample description tables Notes: * The sc->stsc_data[index].id checks have been moved from the mov_read_stsc to mov_read_packet before the value is used in mov_change_extradata to not break playback of samples with broken stsc entries (see sample of ticket #1918). * sc->stsc_index is now checked against sc->stsc_count - 1 before it is incremented so it remains lesser than sc->stsc_count. Fixes a crash with: ./ffmpeg -i matrixbench_mpeg2.mpg -t 1 -frag_duration 200k test.mov ./ffprobe -show_packets test.mov Merged-by: Matthieu Bouron > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3c058f570128dcfa3a68f0860e2be7f098e8d6e1 --- libavformat/isom.h |8 libavformat/mov.c | 123 +--- 2 files changed, 125 insertions(+), 6 deletions(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index 726f350..df6c15a 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -128,6 +128,8 @@ typedef struct MOVStreamContext { MOVStts *ctts_data; unsigned int stsc_count; MOVStsc *stsc_data; +int stsc_index; +int stsc_sample; unsigned int stps_count; unsigned *stps_data; ///< partial sync sample for mpeg-2 open gop MOVElst *elst_data; @@ -169,6 +171,12 @@ typedef struct MOVStreamContext { int nb_frames_for_fps; int64_t duration_for_fps; +/** extradata array (and size) for multiple stsd */ +uint8_t **extradata; +int *extradata_size; +int last_stsd_index; +int stsd_count; + int32_t *display_matrix; uint32_t format; diff --git a/libavformat/mov.c b/libavformat/mov.c index 485bb0b..756d0e8 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2215,8 +2215,7 @@ static int mov_skip_multiple_stsd(MOVContext *c, AVIOContext *pb, avio_skip(pb, size); return 1; } -if ( codec_tag == AV_RL32("avc1") || - codec_tag == AV_RL32("hvc1") || +if ( codec_tag == AV_RL32("hvc1") || codec_tag == AV_RL32("hev1") ) av_log(c->fc, AV_LOG_WARNING, "Concatenated H.264 or H.265 might not play correctly.\n"); @@ -2294,6 +2293,19 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) return ret; } else if (a.size > 0) avio_skip(pb, a.size); + +if (sc->extradata) { +int extra_size = st->codecpar->extradata_size; + +/* Move the current stream extradata to the stream context one. */ +sc->extradata_size[pseudo_stream_id] = extra_size; +sc->extradata[pseudo_stream_id] = av_malloc(extra_size + AV_INPUT_BUFFER_PADDING_SIZE); +if (!sc->extradata[pseudo_stream_id]) +return AVERROR(ENOMEM); +memcpy(sc->extradata[pseudo_stream_id], st->codecpar->extradata, extra_size); +av_freep(&st->codecpar->extradata); +st->codecpar->extradata_size = 0; +} } if (pb->eof_reached) @@ -2304,13 +2316,41 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { -int entries; +AVStream *st; +MOVStreamContext *sc; +int ret; + +if (c->fc->nb_streams < 1) +return 0; +st = c->fc->streams[c->fc->nb_streams - 1]; +sc = st->priv_data; avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ -entries = avio_rb32(pb); +sc->stsd_count = avio_rb32(pb); /* entries */ + +/* Prepare space for hosting multiple extradata. */ +sc->extradata = av_mallocz_array(sc->stsd_count, sizeof(*sc->extradata)); +if (!sc->extradata) +return AVERROR(ENOMEM); + +sc->extradata_size = av_mallocz_array(sc->stsd_count, sizeof(sc->extradata_size)); +if (!sc->extradata_size) +return AVERROR(ENOMEM); + +ret = ff_mov_read_stsd_entries(c, pb, sc->stsd_count); +if (ret < 0) +return ret; + +/* Restore back the primary extradata. */ +av_free(st->codecpar->extradata); +st->codecpar->extradata_size = sc->extradata_size[0]; +st->codecpar->extradata = av_mallocz(sc->extradata_size[0] + AV_INPUT_BUFFER_PADDING_SIZE); +if (!st->codecpar->extradata) +return AVERROR(ENOMEM); +memcpy(st->codecpar->extradata, sc->extradata[0], sc->extradata_size[0]); -return ff_mov_read_stsd_entries(c, pb, entries); +return 0; } static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) @@ -2355,6 +2395,19 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } +/* Compute the samples value for the stsc entry at the giv
[FFmpeg-cvslog] mov: Implement support for multiple sample description tables
ffmpeg | branch: master | Vittorio Giovara | Wed Jun 15 15:24:30 2016 -0400| [76729970049fe95659346503f7401a5d869f9959] | committer: Vittorio Giovara mov: Implement support for multiple sample description tables Store data from each stsd in a separate extradata buffer, keep track of the stsc index for read and seek operations, switch buffers when the index differs. Decoder is notified with an AV_PKT_DATA_NEW_EXTRADATA packet side data. Since H264 supports this notification, and can be reset midstream, enable this feature only for multiple avcC's. All other stsd types (such as hvc1 and hev1) need decoder-side changes, so they are left disabled for now. This is implemented only in non-fragmented MOVs. Signed-off-by: Vittorio Giovara > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=76729970049fe95659346503f7401a5d869f9959 --- libavformat/isom.h |8 libavformat/mov.c | 125 +--- 2 files changed, 127 insertions(+), 6 deletions(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index aec623b..75aa70b 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -105,6 +105,8 @@ typedef struct MOVStreamContext { MOVStts *ctts_data; unsigned int stsc_count; MOVStsc *stsc_data; +int stsc_index; +int stsc_sample; unsigned int stps_count; unsigned *stps_data; ///< partial sync sample for mpeg-2 open gop int ctts_index; @@ -137,6 +139,12 @@ typedef struct MOVStreamContext { unsigned int rap_group_count; MOVSbgp *rap_group; +/** extradata array (and size) for multiple stsd */ +uint8_t **extradata; +int *extradata_size; +int last_stsd_index; +int stsd_count; + int32_t *display_matrix; } MOVStreamContext; diff --git a/libavformat/mov.c b/libavformat/mov.c index 125919f..a9b826f 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1771,8 +1771,7 @@ static int mov_skip_multiple_stsd(MOVContext *c, AVIOContext *pb, int video_codec_id = ff_codec_get_id(ff_codec_movvideo_tags, format); if (codec_tag && -(codec_tag == AV_RL32("avc1") || - codec_tag == AV_RL32("hvc1") || +(codec_tag == AV_RL32("hvc1") || codec_tag == AV_RL32("hev1") || (codec_tag != format && (c->fc->video_codec_id ? video_codec_id != c->fc->video_codec_id @@ -1857,6 +1856,19 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) return ret; } else if (a.size > 0) avio_skip(pb, a.size); + +if (sc->extradata) { +int extra_size = st->codecpar->extradata_size; + +/* Move the current stream extradata to the stream context one. */ +sc->extradata_size[pseudo_stream_id] = extra_size; +sc->extradata[pseudo_stream_id] = av_malloc(extra_size + AV_INPUT_BUFFER_PADDING_SIZE); +if (!sc->extradata[pseudo_stream_id]) +return AVERROR(ENOMEM); +memcpy(sc->extradata[pseudo_stream_id], st->codecpar->extradata, extra_size); +av_freep(&st->codecpar->extradata); +st->codecpar->extradata_size = 0; +} } if (pb->eof_reached) @@ -1867,13 +1879,41 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { -int entries; +AVStream *st; +MOVStreamContext *sc; +int ret; + +if (c->fc->nb_streams < 1) +return 0; +st = c->fc->streams[c->fc->nb_streams - 1]; +sc = st->priv_data; avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ -entries = avio_rb32(pb); +sc->stsd_count = avio_rb32(pb); /* entries */ + +/* Prepare space for hosting multiple extradata. */ +sc->extradata = av_mallocz_array(sc->stsd_count, sizeof(*sc->extradata)); +if (!sc->extradata) +return AVERROR(ENOMEM); -return ff_mov_read_stsd_entries(c, pb, entries); +sc->extradata_size = av_mallocz_array(sc->stsd_count, sizeof(sc->extradata_size)); +if (!sc->extradata_size) +return AVERROR(ENOMEM); + +ret = ff_mov_read_stsd_entries(c, pb, sc->stsd_count); +if (ret < 0) +return ret; + +/* Restore back the primary extradata. */ +av_free(st->codecpar->extradata); +st->codecpar->extradata_size = sc->extradata_size[0]; +st->codecpar->extradata = av_mallocz(sc->extradata_size[0] + AV_INPUT_BUFFER_PADDING_SIZE); +if (!st->codecpar->extradata) +return AVERROR(ENOMEM); +memcpy(st->codecpar->extradata, sc->extradata[0], sc->extradata_size[0]); + +return 0; } static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) @@ -1906,6 +1946,8 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc->stsc_data[i].first = avio_rb32(pb); sc->stsc_data[i].count = avio_rb32(pb); sc->stsc_data[i].id = avio_rb32(pb); +
[FFmpeg-cvslog] mov: Support prores with multiple stsd
ffmpeg | branch: master | Vittorio Giovara | Thu Jun 9 18:55:19 2016 -0400| [846a3e78a535f05ee61bb23a160f3378f041f751] | committer: Vittorio Giovara mov: Support prores with multiple stsd This function needs to return false, or data in the additional tables will be skipped, and the decoder will not be able to decode frames associated with them. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=846a3e78a535f05ee61bb23a160f3378f041f751 --- libavformat/mov.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index a9b826f..fe1f264 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1774,6 +1774,8 @@ static int mov_skip_multiple_stsd(MOVContext *c, AVIOContext *pb, (codec_tag == AV_RL32("hvc1") || codec_tag == AV_RL32("hev1") || (codec_tag != format && + // prores is allowed to have differing data format and codec tag + codec_tag != AV_RL32("apcn") && codec_tag != AV_RL32("apch") && (c->fc->video_codec_id ? video_codec_id != c->fc->video_codec_id : codec_tag != MKTAG('j','p','e','g') { /* Multiple fourcc, we skip JPEG. This is not correct, we should ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '846a3e78a535f05ee61bb23a160f3378f041f751'
ffmpeg | branch: master | Matthieu Bouron | Wed Jul 13 16:56:20 2016 +0200| [354336490da0c1ee2c887bbf8f25b46610233608] | committer: Matthieu Bouron Merge commit '846a3e78a535f05ee61bb23a160f3378f041f751' * commit '846a3e78a535f05ee61bb23a160f3378f041f751': mov: Support prores with multiple stsd Merged-by: Matthieu Bouron > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=354336490da0c1ee2c887bbf8f25b46610233608 --- libavformat/mov.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 756d0e8..2712364 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2205,6 +2205,8 @@ static int mov_skip_multiple_stsd(MOVContext *c, AVIOContext *pb, if (codec_tag && (codec_tag != format && + // prores is allowed to have differing data format and codec tag + codec_tag != AV_RL32("apcn") && codec_tag != AV_RL32("apch") && (c->fc->video_codec_id ? video_codec_id != c->fc->video_codec_id : codec_tag != MKTAG('j','p','e','g' { /* Multiple fourcc, we skip JPEG. This is not correct, we should == diff --cc libavformat/mov.c index 756d0e8,fe1f264..2712364 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@@ -2204,9 -1771,13 +2204,11 @@@ static int mov_skip_multiple_stsd(MOVCo int video_codec_id = ff_codec_get_id(ff_codec_movvideo_tags, format); if (codec_tag && -(codec_tag == AV_RL32("hvc1") || - codec_tag == AV_RL32("hev1") || (codec_tag != format && + // prores is allowed to have differing data format and codec tag + codec_tag != AV_RL32("apcn") && codec_tag != AV_RL32("apch") && (c->fc->video_codec_id ? video_codec_id != c->fc->video_codec_id - : codec_tag != MKTAG('j','p','e','g') { + : codec_tag != MKTAG('j','p','e','g' { /* Multiple fourcc, we skip JPEG. This is not correct, we should * export it as a separate AVStream but this needs a few changes * in the MOV demuxer, patch welcome. */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] tests/checkasm: reduce cosmetic diff with libav
ffmpeg | branch: master | Matthieu Bouron | Wed Jul 13 17:11:58 2016 +0200| [495a40cecb4dc167b4acc686d44bba231eca0c18] | committer: Matthieu Bouron tests/checkasm: reduce cosmetic diff with libav Chunk was not merged in ca5ec2bf51d8c4f8bb0a829d0a65c70c96a3. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=495a40cecb4dc167b4acc686d44bba231eca0c18 --- tests/checkasm/Makefile | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 9f628447..db7395e 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -1,21 +1,21 @@ # libavcodec tests # subsystems -AVCODECOBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o -AVCODECOBJS-$(CONFIG_FLACDSP) += flacdsp.o -AVCODECOBJS-$(CONFIG_FMTCONVERT) += fmtconvert.o -AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o -AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o -AVCODECOBJS-$(CONFIG_VIDEODSP) += videodsp.o +AVCODECOBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o +AVCODECOBJS-$(CONFIG_FLACDSP) += flacdsp.o +AVCODECOBJS-$(CONFIG_FMTCONVERT)+= fmtconvert.o +AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o +AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o +AVCODECOBJS-$(CONFIG_VIDEODSP) += videodsp.o # decoders/encoders -AVCODECOBJS-$(CONFIG_ALAC_DECODER) += alacdsp.o -AVCODECOBJS-$(CONFIG_DCA_DECODER) += synth_filter.o -AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o -AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o -AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o -AVCODECOBJS-$(CONFIG_VP9_DECODER) += vp9dsp.o - -CHECKASMOBJS-$(CONFIG_AVCODEC) += $(AVCODECOBJS-yes) +AVCODECOBJS-$(CONFIG_ALAC_DECODER) += alacdsp.o +AVCODECOBJS-$(CONFIG_DCA_DECODER) += synth_filter.o +AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o +AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o +AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o +AVCODECOBJS-$(CONFIG_VP9_DECODER) += vp9dsp.o + +CHECKASMOBJS-$(CONFIG_AVCODEC) += $(AVCODECOBJS-yes) # libavfilter tests AVFILTEROBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '105998fb5ca3c343f5c8cb39ce3197f87a5e4d36'
ffmpeg | branch: master | Matthieu Bouron | Wed Jul 13 17:16:14 2016 +0200| [a91c330a29f3fa49f5a2991ce52e04213fe68f7b] | committer: Matthieu Bouron Merge commit '105998fb5ca3c343f5c8cb39ce3197f87a5e4d36' * commit '105998fb5ca3c343f5c8cb39ce3197f87a5e4d36': checkasm: Add tests for h264 idct Merged-by: Matthieu Bouron > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a91c330a29f3fa49f5a2991ce52e04213fe68f7b --- tests/checkasm/Makefile |1 + tests/checkasm/checkasm.c |3 + tests/checkasm/checkasm.h |1 + tests/checkasm/h264dsp.c | 232 + 4 files changed, 237 insertions(+) diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index db7395e..b886cb0 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -3,6 +3,7 @@ AVCODECOBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o AVCODECOBJS-$(CONFIG_FLACDSP) += flacdsp.o AVCODECOBJS-$(CONFIG_FMTCONVERT)+= fmtconvert.o +AVCODECOBJS-$(CONFIG_H264DSP) += h264dsp.o AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o AVCODECOBJS-$(CONFIG_VIDEODSP) += videodsp.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index e4ca116..cca227a 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -80,6 +80,9 @@ static const struct { #if CONFIG_FMTCONVERT { "fmtconvert", checkasm_check_fmtconvert }, #endif +#if CONFIG_H264DSP +{ "h264dsp", checkasm_check_h264dsp }, +#endif #if CONFIG_H264PRED { "h264pred", checkasm_check_h264pred }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 5a76f74..17374b4 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -36,6 +36,7 @@ void checkasm_check_bswapdsp(void); void checkasm_check_colorspace(void); void checkasm_check_flacdsp(void); void checkasm_check_fmtconvert(void); +void checkasm_check_h264dsp(void); void checkasm_check_h264pred(void); void checkasm_check_h264qpel(void); void checkasm_check_jpeg2000dsp(void); diff --git a/tests/checkasm/h264dsp.c b/tests/checkasm/h264dsp.c new file mode 100644 index 000..e2060db --- /dev/null +++ b/tests/checkasm/h264dsp.c @@ -0,0 +1,232 @@ +/* + * Copyright (c) 2016 Martin Storsjo + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 General Public License for more details. + * + * You should have received a copy of the GNU 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 "checkasm.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/h264dsp.h" +#include "libavutil/common.h" +#include "libavutil/internal.h" +#include "libavutil/intreadwrite.h" + +static const uint32_t pixel_mask[3] = { 0x, 0x01ff01ff, 0x03ff03ff }; + +#define SIZEOF_PIXEL ((bit_depth + 7) / 8) +#define SIZEOF_COEF (2 * ((bit_depth + 7) / 8)) +#define PIXEL_STRIDE 16 + +#define randomize_buffers() \ +do { \ +uint32_t mask = pixel_mask[bit_depth - 8]; \ +for (y = 0; y < sz; y++) { \ +for (x = 0; x < sz * SIZEOF_PIXEL; x += 4) { \ +AV_WN32A(src + y * PIXEL_STRIDE + x, rnd() & mask); \ +AV_WN32A(dst + y * PIXEL_STRIDE + x, rnd() & mask); \ +}\ +for (x = 0; x < sz; x++) { \ +if (bit_depth == 8) {\ +coef[y * sz + x] = src[y * PIXEL_STRIDE + x] - \ + dst[y * PIXEL_STRIDE + x];\ +} else { \ +((int32_t *)coef)[y * sz + x] = \ +((uint16_t *)src)[y * (PIXEL_STRIDE/2) + x] -\ +((uint16_t *)dst)[y * (PIXEL_STRIDE/2) + x]; \ +}\ +}\ +}
[FFmpeg-cvslog] checkasm: Add tests for h264 idct
ffmpeg | branch: master | Martin Storsjö | Sat Jun 11 14:17:37 2016 +0300| [105998fb5ca3c343f5c8cb39ce3197f87a5e4d36] | committer: Martin Storsjö checkasm: Add tests for h264 idct The tests are inspired by similar tests for vp9 by Ronald Bultje. Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=105998fb5ca3c343f5c8cb39ce3197f87a5e4d36 --- tests/checkasm/Makefile |1 + tests/checkasm/checkasm.c |3 + tests/checkasm/checkasm.h |1 + tests/checkasm/h264dsp.c | 232 + 4 files changed, 237 insertions(+) diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 8a0cee5..3c23853 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -2,6 +2,7 @@ # subsystems AVCODECOBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o AVCODECOBJS-$(CONFIG_FMTCONVERT)+= fmtconvert.o +AVCODECOBJS-$(CONFIG_H264DSP) += h264dsp.o AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index c75e431..15f9f68 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -74,6 +74,9 @@ static const struct { #if CONFIG_FMTCONVERT { "fmtconvert", checkasm_check_fmtconvert }, #endif +#if CONFIG_H264DSP +{ "h264dsp", checkasm_check_h264dsp }, +#endif #if CONFIG_H264PRED { "h264pred", checkasm_check_h264pred }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index c7aa19c..619ebc7 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -33,6 +33,7 @@ void checkasm_check_bswapdsp(void); void checkasm_check_dcadsp(void); void checkasm_check_fmtconvert(void); +void checkasm_check_h264dsp(void); void checkasm_check_h264pred(void); void checkasm_check_h264qpel(void); void checkasm_check_hevc_mc(void); diff --git a/tests/checkasm/h264dsp.c b/tests/checkasm/h264dsp.c new file mode 100644 index 000..082c3d4 --- /dev/null +++ b/tests/checkasm/h264dsp.c @@ -0,0 +1,232 @@ +/* + * Copyright (c) 2016 Martin Storsjo + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Libav 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with Libav; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include "checkasm.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/h264dsp.h" +#include "libavutil/common.h" +#include "libavutil/internal.h" +#include "libavutil/intreadwrite.h" + +static const uint32_t pixel_mask[3] = { 0x, 0x01ff01ff, 0x03ff03ff }; + +#define SIZEOF_PIXEL ((bit_depth + 7) / 8) +#define SIZEOF_COEF (2 * ((bit_depth + 7) / 8)) +#define PIXEL_STRIDE 16 + +#define randomize_buffers() \ +do { \ +uint32_t mask = pixel_mask[bit_depth - 8]; \ +for (y = 0; y < sz; y++) { \ +for (x = 0; x < sz * SIZEOF_PIXEL; x += 4) { \ +AV_WN32A(src + y * PIXEL_STRIDE + x, rnd() & mask); \ +AV_WN32A(dst + y * PIXEL_STRIDE + x, rnd() & mask); \ +}\ +for (x = 0; x < sz; x++) { \ +if (bit_depth == 8) {\ +coef[y * sz + x] = src[y * PIXEL_STRIDE + x] - \ + dst[y * PIXEL_STRIDE + x];\ +} else { \ +((int32_t *)coef)[y * sz + x] = \ +((uint16_t *)src)[y * (PIXEL_STRIDE/2) + x] -\ +((uint16_t *)dst)[y * (PIXEL_STRIDE/2) + x]; \ +}\ +}\ +}\ +} while (0) + +#define dct4x4_impl(size, dctcoef) \ +static void dct4x4_##size(dctcoef *coef)
[FFmpeg-cvslog] fate: fix fate-vp8 dependencies
ffmpeg | branch: master | James Almer | Tue Jul 12 16:50:30 2016 -0300| [fde9c5e4243087a0a612a38a705549e7f80362a9] | committer: James Almer fate: fix fate-vp8 dependencies Fix the demuxer dependencies in some of the tests and remove the vp8 decoder dependency for the stream copy tests Reviewed-by: Hendrik Leppkes Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fde9c5e4243087a0a612a38a705549e7f80362a9 --- tests/fate/vpx.mak | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak index f0bcfac..0212096 100644 --- a/tests/fate/vpx.mak +++ b/tests/fate/vpx.mak @@ -19,31 +19,31 @@ fate-vp60: CMD = framecrc -flags +bitexact -i $(TARGET_SAMPLES)/ea-vp6/g36.vp6 FATE_VP6-$(call DEMDEC, EA, VP6) += fate-vp61 fate-vp61: CMD = framecrc -flags +bitexact -i $(TARGET_SAMPLES)/ea-vp6/MovieSkirmishGondor.vp6 -t 4 -FATE_VP6-$(call DEMDEC, FLV, VP6A) += fate-vp6a +FATE_VP6-$(call DEMDEC, MOV, VP6A) += fate-vp6a fate-vp6a: CMD = framecrc -flags +bitexact -i $(TARGET_SAMPLES)/flash-vp6/300x180-Scr-f8-056alpha.mov -FATE_VP6-$(call DEMDEC, FLV, VP6A) += fate-vp6a-skip_alpha +FATE_VP6-$(call DEMDEC, MOV, VP6A) += fate-vp6a-skip_alpha fate-vp6a-skip_alpha: CMD = framecrc -flags +bitexact -skip_alpha 1 -i $(TARGET_SAMPLES)/flash-vp6/300x180-Scr-f8-056alpha.mov FATE_VP6-$(call DEMDEC, FLV, VP6F) += fate-vp6f fate-vp6f: CMD = framecrc -flags +bitexact -i $(TARGET_SAMPLES)/flash-vp6/clip1024.flv -FATE_VP8-$(call DEMDEC, FLV, VP8) += fate-vp8-alpha +FATE_VP8-$(CONFIG_MATROSKA_DEMUXER) += fate-vp8-alpha fate-vp8-alpha: CMD = framecrc -i $(TARGET_SAMPLES)/vp8_alpha/vp8_video_with_alpha.webm -vcodec copy -FATE_VP8-$(call DEMDEC, WEBM_DASH_MANIFEST, VP8) += fate-webm-dash-manifest +FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest fate-webm-dash-manifest: CMD = run $(FFMPEG) -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video2.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio2.webm -c copy -map 0 -map 1 -map 2 -map 3 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1 id=1,streams=2,3" - -FATE_VP8-$(call DEMDEC, WEBM_DASH_MANIFEST, VP8) += fate-webm-dash-manifest-unaligned-video-streams +FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest-unaligned-video-streams fate-webm-dash-manifest-unaligned-video-streams: CMD = run $(FFMPEG) -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video3.webm -c copy -map 0 -map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" - -FATE_VP8-$(call DEMDEC, WEBM_DASH_MANIFEST, VP8) += fate-webm-dash-manifest-unaligned-audio-streams +FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest-unaligned-audio-streams fate-webm-dash-manifest-unaligned-audio-streams: CMD = run $(FFMPEG) -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio3.webm -c copy -map 0 -map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" - -FATE_VP8-$(call DEMDEC, WEBM_DASH_MANIFEST, VP8) += fate-webm-dash-manifest-representations +FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest-representations fate-webm-dash-manifest-representations: CMD = run $(FFMPEG) -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video4.webm -c copy -map 0 -map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" - -FATE_VP8-$(call DEMDEC, WEBM_DASH_MANIFEST, VP8) += fate-webm-dash-manifest-live +FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest-live fate-webm-dash-manifest-live: CMD = run $(FFMPEG) -f webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr -f webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c copy -map 0 -map 1 -f webm_dash_manifest -live 1 -adaptation_sets "id=0,streams=0 id=1,streams=1" -chunk_start_index 1 -chunk_duration_ms 5000 -time_shift_buffer_depth 7200 -minimum_update_period 60 -debug_mode 1 - FATE_VP8-$(call DEMDEC, MATROSKA, VP8) += fate-vp8-2451 @@ -58,7 +58,7 @@ fate-vp7: CMD = framecrc -flags +bitexact -i $(TARGET_SAMPLES)/vp7/potter-40.vp7 VP8_SUITE = 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 define FATE_VP8_SUITE -FATE_VP8-$(CONFIG_IVF_DEMUXER) += fate-vp8-test-vector$(2)-$(1) +FATE_VP8-$(call DEMDEC, IVF, VP8) += fate-vp8-test-vector$(2)-$(1) fate-vp8-test-vector$(2)-$(1): CMD = framemd5 $(3) -i $(TARGET_SAMPLES)/vp8-test-vectors-r1/vp80-00-comprehensive-$(1).ivf fate-vp8-test-vector$(2)-$(1): REF = $(SRC_PATH)/tests/ref/fate/vp8-test-vector-$(1) endef @@ -68,18 +68,18 @@ $(foreach
[FFmpeg-cvslog] Merge commit 'ec9f04423b82afa323e90f5b2c677be74302c1fd'
ffmpeg | branch: master | Matthieu Bouron | Wed Jul 13 17:39:47 2016 +0200| [57fa9608e419ddc377d04f508329595ec1e027cb] | committer: Matthieu Bouron Merge commit 'ec9f04423b82afa323e90f5b2c677be74302c1fd' * commit 'ec9f04423b82afa323e90f5b2c677be74302c1fd': ffv1: Error out on unsupported format This commit is a noop, the feature is already present in FFmpeg. Merged-by: Matthieu Bouron > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=57fa9608e419ddc377d04f508329595ec1e027cb --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffv1: Error out on unsupported format
ffmpeg | branch: master | Jerome Martinez | Thu Jun 16 16:33:55 2016 +0200| [ec9f04423b82afa323e90f5b2c677be74302c1fd] | committer: Luca Barbato ffv1: Error out on unsupported format Transparency is supported only by YUV and within specific bit depths. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ec9f04423b82afa323e90f5b2c677be74302c1fd --- libavcodec/ffv1dec.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index 467fd0d..de3a019 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -597,6 +597,12 @@ static int read_header(FFV1Context *f) } if (f->colorspace == 0) { +if (f->transparency && f->avctx->bits_per_raw_sample > 8) { +av_log(f->avctx, AV_LOG_ERROR, + "Transparency not supported for bit depth %d\n", + f->avctx->bits_per_raw_sample); +return AVERROR(ENOSYS); +} if (!f->transparency && !f->chroma_planes) { if (f->avctx->bits_per_raw_sample <= 8) f->avctx->pix_fmt = AV_PIX_FMT_GRAY8; @@ -695,6 +701,11 @@ static int read_header(FFV1Context *f) "chroma subsampling not supported in this colorspace\n"); return AVERROR(ENOSYS); } +if (f->transparency) { +av_log(f->avctx, AV_LOG_ERROR, + "Transparency not supported in this colorspace\n"); + return AVERROR(ENOSYS); +} switch (f->avctx->bits_per_raw_sample) { case 0: case 8: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/vf_uspp: Check for encoding failure
ffmpeg | branch: master | Michael Niedermayer | Wed Jul 13 20:16:27 2016 +0200| [e879819e7b271e08cfdea9cbcf0f879b04bd09c3] | committer: Michael Niedermayer avfilter/vf_uspp: Check for encoding failure Fixes CID1363015 Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e879819e7b271e08cfdea9cbcf0f879b04bd09c3 --- libavfilter/vf_uspp.c |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_uspp.c b/libavfilter/vf_uspp.c index f963254..8a6d0fb 100644 --- a/libavfilter/vf_uspp.c +++ b/libavfilter/vf_uspp.c @@ -186,6 +186,7 @@ static void filter(USPPContext *p, uint8_t *dst[3], uint8_t *src[3], { int x, y, i, j; const int count = 1frame->data[2] = p->src[2] + x1c + y1c * p->frame->linesize[2]; p->frame->format = p->avctx_enc[i]->pix_fmt; -avcodec_encode_video2(p->avctx_enc[i], &pkt, p->frame, &got_pkt_ptr); +ret = avcodec_encode_video2(p->avctx_enc[i], &pkt, p->frame, &got_pkt_ptr); +if (ret < 0) { +av_log(p->avctx_enc[i], AV_LOG_ERROR, "Encoding failed\n"); +continue; +} + p->frame_dec = p->avctx_enc[i]->coded_frame; offset = (BLOCK-x1) + (BLOCK-y1) * p->frame_dec->linesize[0]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] diracdec: fix maximum quantization index checks
ffmpeg | branch: master | Rostislav Pehlivanov | Wed Jul 13 23:40:06 2016 +0100| [b2b12b2d4ab1347e06770bfb4ea1bdf1b1c70527] | committer: Rostislav Pehlivanov diracdec: fix maximum quantization index checks Found by Coverity, fixes CID1363961 and CID1363962 Signed-off-by: Rostislav Pehlivanov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b2b12b2d4ab1347e06770bfb4ea1bdf1b1c70527 --- libavcodec/diracdec.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 9275c50..dc42a42 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -513,7 +513,7 @@ static inline void codeblock(DiracContext *s, SubBand *b, b->quant = quant; } -if (b->quant > DIRAC_MAX_QUANT_INDEX) { +if (b->quant > (DIRAC_MAX_QUANT_INDEX - 1)) { av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", b->quant); b->quant = 0; return; @@ -703,7 +703,7 @@ static void decode_subband(DiracContext *s, GetBitContext *gb, int quant, uint8_t *buf2 = b2 ? b2->ibuf + top * b2->stride: NULL; int x, y; -if (quant > DIRAC_MAX_QUANT_INDEX) { +if (quant > (DIRAC_MAX_QUANT_INDEX - 1)) { av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", quant); return; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] dirac_vlc: fix undefined shifts
ffmpeg | branch: master | Rostislav Pehlivanov | Wed Jul 13 23:35:03 2016 +0100| [e24c31b656254b2516befbde78aeaca0122a6010] | committer: Rostislav Pehlivanov dirac_vlc: fix undefined shifts Shifting by more than 63 bits is undefined behavior, athough any compiler not returning 0 after shifting by any amount would be insane. Found by Coverity, fixes CID1363959 and CID1363960 Signed-off-by: Rostislav Pehlivanov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e24c31b656254b2516befbde78aeaca0122a6010 --- libavcodec/dirac_vlc.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/dirac_vlc.c b/libavcodec/dirac_vlc.c index d1271e5..caa6413 100644 --- a/libavcodec/dirac_vlc.c +++ b/libavcodec/dirac_vlc.c @@ -37,7 +37,7 @@ int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int i, b, c_idx = 0; int32_t *dst = (int32_t *)_dst; DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]]; -INIT_RESIDUE(res, 0, 0); +INIT_RESIDUE(res, 0, 1); #define APPEND_RESIDUE(N, M) \ N |= M >> (N ## _bits); \ @@ -81,7 +81,7 @@ int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int i, b, c_idx = 0; int16_t *dst = (int16_t *)_dst; DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]]; -INIT_RESIDUE(res, 0, 0); +INIT_RESIDUE(res, 0, 1); #define APPEND_RESIDUE(N, M) \ N |= M >> (N ## _bits); \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] dirac_vlc: remove redundant macro declaration
ffmpeg | branch: master | Rostislav Pehlivanov | Wed Jul 13 23:38:10 2016 +0100| [9c0aba434e774f9d8d99d6d3c4adc8dcabf3a052] | committer: Rostislav Pehlivanov dirac_vlc: remove redundant macro declaration Signed-off-by: Rostislav Pehlivanov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9c0aba434e774f9d8d99d6d3c4adc8dcabf3a052 --- libavcodec/dirac_vlc.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavcodec/dirac_vlc.c b/libavcodec/dirac_vlc.c index caa6413..74cf4a2 100644 --- a/libavcodec/dirac_vlc.c +++ b/libavcodec/dirac_vlc.c @@ -31,6 +31,10 @@ residual N = B ? CONVERT_TO_RESIDUE(I, B) : 0; \ av_unused int32_t N ## _bits = B +#define APPEND_RESIDUE(N, M) \ +N |= M >> (N ## _bits); \ +N ## _bits += (M ## _bits) + int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int bytes, uint8_t *_dst, int coeffs) { @@ -39,10 +43,6 @@ int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]]; INIT_RESIDUE(res, 0, 1); -#define APPEND_RESIDUE(N, M) \ -N |= M >> (N ## _bits); \ -N ## _bits += (M ## _bits) - for (b = 1; b <= bytes; b++) { future[0] = &lut_ctx[buf[b]]; future[1] = future[0] + 1*LUT_SIZE; @@ -83,10 +83,6 @@ int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]]; INIT_RESIDUE(res, 0, 1); -#define APPEND_RESIDUE(N, M) \ -N |= M >> (N ## _bits); \ -N ## _bits += (M ## _bits) - for (b = 1; b <= bytes; b++) { future[0] = &lut_ctx[buf[b]]; future[1] = future[0] + 1*LUT_SIZE; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] diracdec: fix unchecked byte length
ffmpeg | branch: master | Rostislav Pehlivanov | Wed Jul 13 23:53:05 2016 +0100| [000eb01a7d14ee635bd0e554ea92e05feb8cf685] | committer: Rostislav Pehlivanov diracdec: fix unchecked byte length Also drops the start variable since it's redundant. Found by Coverity, fixes CID1363964 Signed-off-by: Rostislav Pehlivanov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=000eb01a7d14ee635bd0e554ea92e05feb8cf685 --- libavcodec/diracdec.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index dc42a42..6cb098b 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -835,11 +835,10 @@ static int decode_hq_slice(DiracContext *s, DiracSlice *slice, uint8_t *tmp_buf) for (i = 0; i < 3; i++) { int coef_num, coef_par, off = 0; int64_t length = s->highquality.size_scaler*get_bits(gb, 8); -int64_t start = get_bits_count(gb); -int64_t bits_end = start + 8*length; +int64_t bits_end = get_bits_count(gb) + 8*length; const uint8_t *addr = align_get_bits(gb); -if (bits_end >= INT_MAX) { +if (length*8 > get_bits_left(gb)) { av_log(s->avctx, AV_LOG_ERROR, "end too far away\n"); return AVERROR_INVALIDDATA; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] dirac_vlc: add a SET_RESIDUE macro and fix recent regression
ffmpeg | branch: master | Rostislav Pehlivanov | Thu Jul 14 01:00:59 2016 +0100| [c4adcff976043dd3121660a90f654d5081ea9094] | committer: Rostislav Pehlivanov dirac_vlc: add a SET_RESIDUE macro and fix recent regression Can also be used in future cleanups since 99% of the time the leftover appending will just append to an already empty residue. Signed-off-by: Rostislav Pehlivanov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c4adcff976043dd3121660a90f654d5081ea9094 --- libavcodec/dirac_vlc.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/libavcodec/dirac_vlc.c b/libavcodec/dirac_vlc.c index 74cf4a2..d874278 100644 --- a/libavcodec/dirac_vlc.c +++ b/libavcodec/dirac_vlc.c @@ -27,9 +27,13 @@ #define CONVERT_TO_RESIDUE(a, b) \ (((residual)(a)) << (RSIZE_BITS - (b))) -#define INIT_RESIDUE(N, I, B) \ -residual N = B ? CONVERT_TO_RESIDUE(I, B) : 0; \ -av_unused int32_t N ## _bits = B +#define INIT_RESIDUE(N) \ +residual N = 0; \ +av_unused int32_t N ## _bits = 0 + +#define SET_RESIDUE(N, I, B) \ +N = CONVERT_TO_RESIDUE(I, B); \ +N ## _bits = B #define APPEND_RESIDUE(N, M) \ N |= M >> (N ## _bits); \ @@ -41,7 +45,7 @@ int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int i, b, c_idx = 0; int32_t *dst = (int32_t *)_dst; DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]]; -INIT_RESIDUE(res, 0, 1); +INIT_RESIDUE(res); for (b = 1; b <= bytes; b++) { future[0] = &lut_ctx[buf[b]]; @@ -61,7 +65,7 @@ int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1; } dst[c_idx++] = l->sign * (coeff - 1); -res_bits = res = 0; +SET_RESIDUE(res, 0, 0); } memcpy(&dst[c_idx], l->ready, LUT_BITS*sizeof(int32_t)); @@ -81,7 +85,7 @@ int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int i, b, c_idx = 0; int16_t *dst = (int16_t *)_dst; DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]]; -INIT_RESIDUE(res, 0, 1); +INIT_RESIDUE(res); for (b = 1; b <= bytes; b++) { future[0] = &lut_ctx[buf[b]]; @@ -100,7 +104,7 @@ int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1; } dst[c_idx++] = l->sign * (coeff - 1); -res_bits = res = 0; +SET_RESIDUE(res, 0, 0); } for (i = 0; i < LUT_BITS; i++) @@ -170,7 +174,8 @@ static void generate_parity_lut(DiracGolombLUT *lut, int even) uint32_t code; int i; -INIT_RESIDUE(res, idx, LUT_BITS); +INIT_RESIDUE(res); +SET_RESIDUE(res, idx, LUT_BITS); for (i = 0; i < LUT_BITS; i++) { const int cond = even ? (i & 1) : !(i & 1); @@ -208,7 +213,8 @@ static void generate_offset_lut(DiracGolombLUT *lut, int off) for (idx = 0; idx < LUT_SIZE; idx++) { DiracGolombLUT *l = &lut[idx]; -INIT_RESIDUE(res, idx, LUT_BITS); +INIT_RESIDUE(res); +SET_RESIDUE(res, idx, LUT_BITS); l->preamble = CONVERT_TO_RESIDUE(res >> (RSIZE_BITS - off), off); l->preamble_bits = off; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] dirac_vlc: prevent shifting a 0 by 64 bits when zeroing residue
ffmpeg | branch: master | Rostislav Pehlivanov | Thu Jul 14 01:26:51 2016 +0100| [f41e37b84f3d57c29d4a2a21f9337159135b981d] | committer: Rostislav Pehlivanov dirac_vlc: prevent shifting a 0 by 64 bits when zeroing residue Adding a check for bits == 0 would still make Coverity misdetect this, so just revert to the normal way of setting the residue to 0. Signed-off-by: Rostislav Pehlivanov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f41e37b84f3d57c29d4a2a21f9337159135b981d --- libavcodec/dirac_vlc.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/dirac_vlc.c b/libavcodec/dirac_vlc.c index d874278..336d22a 100644 --- a/libavcodec/dirac_vlc.c +++ b/libavcodec/dirac_vlc.c @@ -65,7 +65,7 @@ int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1; } dst[c_idx++] = l->sign * (coeff - 1); -SET_RESIDUE(res, 0, 0); +res_bits = res = 0; } memcpy(&dst[c_idx], l->ready, LUT_BITS*sizeof(int32_t)); @@ -104,7 +104,7 @@ int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1; } dst[c_idx++] = l->sign * (coeff - 1); -SET_RESIDUE(res, 0, 0); +res_bits = res = 0; } for (i = 0; i < LUT_BITS; i++) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog