[FFmpeg-devel] [PATCH v9] lavf/movenc: Add palette to video sample description
Include AV_PIX_FMT_GRAY8 in is_raw_rgb, and initialize the grayscale palette properly. -- Mats Peterson http://matsp888.no-ip.org/~mats/ >From 6ed97212c1333c6ba31cad5767bd7d13fbf760e5 Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Mon, 22 Feb 2016 09:04:41 +0100 Subject: [PATCH v9] lavf/movenc: Add palette to video sample description --- libavformat/movenc.c | 63 +- libavformat/movenc.h |5 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9c0f7a..ce9b462 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1714,7 +1714,27 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_wb16(pb, track->enc->bits_per_coded_sample); else avio_wb16(pb, 0x18); /* Reserved */ -avio_wb16(pb, 0x); /* Reserved */ + +if (track->enc->codec_id == AV_CODEC_ID_RAWVIDEO && mov->is_raw_rgb && +track->enc->bits_per_coded_sample >= 1 && track->enc->bits_per_coded_sample <= 8) { +int i; +int pal_size = 1 << track->enc->bits_per_coded_sample; +avio_wb16(pb, 0); /* Color table ID */ +avio_wb32(pb, 0); /* Color table seed */ +avio_wb16(pb, 0x8000);/* Color table flags */ +avio_wb16(pb, pal_size - 1); /* Color table size (zero-relative) */ +for (i = 0; i < pal_size; i++) { +uint16_t r = (mov->palette[i] >> 16) & 0xff; +uint16_t g = (mov->palette[i] >> 8) & 0xff; +uint16_t b = mov->palette[i] & 0xff; +avio_wb16(pb, 0); +avio_wb16(pb, (r << 8) | r); +avio_wb16(pb, (g << 8) | g); +avio_wb16(pb, (b << 8) | b); +} +} else +avio_wb16(pb, 0x); /* Color table ID, -1 for no or default palette */ + if (track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if (track->enc->codec_id == AV_CODEC_ID_H263) @@ -4703,6 +4723,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } else { int i; MOVMuxContext *mov = s->priv_data; +MOVTrack *trk = &mov->tracks[pkt->stream_index]; if (!pkt->size) return mov_write_single_packet(s, pkt); /* Passthrough. */ @@ -4739,6 +4760,46 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } +mov->is_raw_rgb = trk->enc->pix_fmt == AV_PIX_FMT_RGB24 || +trk->enc->pix_fmt == AV_PIX_FMT_ARGB || +trk->enc->pix_fmt == AV_PIX_FMT_RGB555BE || +trk->enc->pix_fmt == AV_PIX_FMT_PAL8 || +trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || +trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE || +trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK; + +if (trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO && mov->is_raw_rgb) { +const uint8_t *data = pkt->data; +int size = pkt->size; +int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16; +int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2; +int ret = ff_reshuffle_raw_rgb(s, &pkt, trk->enc, expected_stride); +if (ret < 0) +return ret; +if (!mov->pal_done) { +if (ret == CONTAINS_PAL) { +int pal_size = 1 << trk->enc->bits_per_coded_sample; +memcpy(mov->palette, data + size - 4*pal_size, 4*pal_size); +} else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8) { +/* Calculate 8 bpp grayscale palette */ +for (i = 0; i < 256; i++) +mov->palette[i] = (0xFFU << 24) | (i << 16) | (i << 8) | i; +} else if (trk->enc->bits_per_coded_sample == 1) { +/* Initialize 1 bpp palette to black & white */ +if (trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK) +mov->palette[1] = 0x; +else +mov->palette[0] = 0x; +} +mov->pal_done++; +} +if (ret) { +ret = mov_write_single_packet(s, pkt); +av_packet_free(&pkt); +return ret; +} +} + return mov_write_single_packet(s, pkt); } } diff --git a/libavformat/movenc.h b/libavformat/movenc.h index deb90fe..9170ade 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -209,6 +209,11 @@ typedef struct MOVMuxContext { uint8_t *encryption_kid; int encryption_kid_len; +uint32_t palette[AVPALETTE_COUNT]; +int pal_done; + +int is_raw_rgb; + } MOVMuxContext; #define FF_MOV_FLAG_RTP_HINT (1 << 0) -- 1.7.10.4 ___ ffm
Re: [FFmpeg-devel] [PATCH v9] lavf/movenc: Add palette to video sample description
On 02/22/2016 09:07 AM, Mats Peterson wrote: Include AV_PIX_FMT_GRAY8 in is_raw_rgb, and initialize the grayscale palette properly. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Faulty. New one coming. -- Mats Peterson http://matsp888.no-ip.org/~mats/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v10] lavf/movenc: Add palette to video sample description
Check for track being AVMEDIA_TYPE_VIDEO before doing anything else. -- Mats Peterson http://matsp888.no-ip.org/~mats/ >From dd6b19cad8753603a9c7c42d2685277112df85e4 Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Mon, 22 Feb 2016 09:54:52 +0100 Subject: [PATCH v10] lavf/movenc: Add palette to video sample description --- libavformat/movenc.c | 65 +- libavformat/movenc.h |5 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9c0f7a..da1952c 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1714,7 +1714,27 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_wb16(pb, track->enc->bits_per_coded_sample); else avio_wb16(pb, 0x18); /* Reserved */ -avio_wb16(pb, 0x); /* Reserved */ + +if (track->enc->codec_id == AV_CODEC_ID_RAWVIDEO && mov->is_raw_rgb && +track->enc->bits_per_coded_sample >= 1 && track->enc->bits_per_coded_sample <= 8) { +int i; +int pal_size = 1 << track->enc->bits_per_coded_sample; +avio_wb16(pb, 0); /* Color table ID */ +avio_wb32(pb, 0); /* Color table seed */ +avio_wb16(pb, 0x8000);/* Color table flags */ +avio_wb16(pb, pal_size - 1); /* Color table size (zero-relative) */ +for (i = 0; i < pal_size; i++) { +uint16_t r = (mov->palette[i] >> 16) & 0xff; +uint16_t g = (mov->palette[i] >> 8) & 0xff; +uint16_t b = mov->palette[i] & 0xff; +avio_wb16(pb, 0); +avio_wb16(pb, (r << 8) | r); +avio_wb16(pb, (g << 8) | g); +avio_wb16(pb, (b << 8) | b); +} +} else +avio_wb16(pb, 0x); /* Color table ID, -1 for no or default palette */ + if (track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if (track->enc->codec_id == AV_CODEC_ID_H263) @@ -4703,6 +4723,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } else { int i; MOVMuxContext *mov = s->priv_data; +MOVTrack *trk = &mov->tracks[pkt->stream_index]; if (!pkt->size) return mov_write_single_packet(s, pkt); /* Passthrough. */ @@ -4739,6 +4760,48 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } +if (trk->enc->codec_type == AVMEDIA_TYPE_VIDEO) { +mov->is_raw_rgb = trk->enc->pix_fmt == AV_PIX_FMT_RGB24 || +trk->enc->pix_fmt == AV_PIX_FMT_ARGB || +trk->enc->pix_fmt == AV_PIX_FMT_RGB555BE || +trk->enc->pix_fmt == AV_PIX_FMT_PAL8 || +trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || +trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE || +trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK; + +if (trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO && mov->is_raw_rgb) { +const uint8_t *data = pkt->data; +int size = pkt->size; +int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16; +int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2; +int ret = ff_reshuffle_raw_rgb(s, &pkt, trk->enc, expected_stride); +if (ret < 0) +return ret; +if (!mov->pal_done) { +if (ret == CONTAINS_PAL) { +int pal_size = 1 << trk->enc->bits_per_coded_sample; +memcpy(mov->palette, data + size - 4*pal_size, 4*pal_size); +} else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8) { +/* Calculate 8 bpp grayscale palette */ +for (i = 0; i < 256; i++) +mov->palette[i] = (0xFFU << 24) | (i << 16) | (i << 8) | i; +} else if (trk->enc->bits_per_coded_sample == 1) { +/* Initialize 1 bpp palette to black & white */ +if (trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK) +mov->palette[1] = 0x; +else +mov->palette[0] = 0x; +} +mov->pal_done++; +} +if (ret) { +ret = mov_write_single_packet(s, pkt); +av_packet_free(&pkt); +return ret; +} +} +} + return mov_write_single_packet(s, pkt); } } diff --git a/libavformat/movenc.h b/libavformat/movenc.h index deb90fe..9170ade 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -209,6 +209,11 @@ typedef struct MOVMuxContext { uint8_t *encryption_kid; int encryption_kid_len; +uint32_t pale
[FFmpeg-devel] Match per stream option macro
Hello, Is there anyone help me to explain what does the Macro below do? This macro is in ffmpeg_opt.c #define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\ {\ int i, ret;\ for (i = 0; i < o->nb_ ## name; i++) {\ char *spec = o->name[i].specifier;\ if ((ret = check_stream_specifier(fmtctx, st, spec)) > 0)\ outvar = o->name[i].u.type;\ else if (ret < 0)\ exit_program(1);\ }\ } below is my explanation but it can't cover all its functionality MATCH_PER_STREAM_OPT(OptionsContext *o, char *outvar, AVFormatContext *fmtctx, AVStream *st){ int i, ret; for (i = 0; i < o->nb_stream_maps; i++) { char *spec = o->codec_names[i].specifier; if ((ret = check_stream_specifier(fmtctx, st, spec)) > 0) outvar = (char*)o->codec_names[i].u.str; else if (ret < 0) exit_program(1); } } Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] GSoC Backup mentors needed
Am 22.02.16 um 05:41 schrieb Michael Niedermayer: > On Mon, Feb 22, 2016 at 04:31:56AM +0100, Michael Niedermayer wrote: >> Hi all >> >> we are still missing 3 backup mentors for the 10 "mentored" projects >> listed at https://trac.ffmpeg.org/wiki/SponsoringPrograms/GSoC/2016 >> I know its no problem to find qualified developers for it but google is >> reviewing ideas pages currently so we need these spots filled ASAP >> as it could very easily affect if FFmpeg gets accepted or rejected. >> (assuming the ideas page hasnt been reviewed yet) > > That is we need qualified developers for these 3 spots preferably > yesterday ... > finding volunteers in a week will be too late for googles idea page > reviews ... Added myself as backup mentor for the tasks I feel qualified for. -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] GSoC Backup mentors needed
On Mon, Feb 22, 2016 at 11:08:29AM +0100, Thilo Borgmann wrote: > Am 22.02.16 um 05:41 schrieb Michael Niedermayer: > > On Mon, Feb 22, 2016 at 04:31:56AM +0100, Michael Niedermayer wrote: > >> Hi all > >> > >> we are still missing 3 backup mentors for the 10 "mentored" projects > >> listed at https://trac.ffmpeg.org/wiki/SponsoringPrograms/GSoC/2016 > >> I know its no problem to find qualified developers for it but google is > >> reviewing ideas pages currently so we need these spots filled ASAP > >> as it could very easily affect if FFmpeg gets accepted or rejected. > >> (assuming the ideas page hasnt been reviewed yet) > > > > That is we need qualified developers for these 3 spots preferably > > yesterday ... > > finding volunteers in a week will be too late for googles idea page > > reviews ... > > Added myself as backup mentor for the tasks I feel qualified for. perfect, thanks alot [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB During times of universal deceit, telling the truth becomes a revolutionary act. -- George Orwell signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v6] Added VideoToolbox H.264 encoder.
On Wed, 17 Feb 2016 18:30:04 +0800 Rick Kern wrote: > Autodetected by default. Encode using -codec:v vtenc. > > Signed-off-by: Rick Kern > --- The configure check doesn't work. It tries to enable it on non-OSX, which breaks building ffmpeg out of the box on anything but OSX. Also, I noticed that the existing code for the videotoolbox hwaccel adds a bunch of frameworks, while yours adds only VideoToolbox. If the existing code wrong, or your code? While we're at it, avoid past tense in commit messages for things the commit changes. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [FFmpeg-cvslog] avutil/imgutils: remove special case for aligning the palette
On Sat, 20 Feb 2016 21:38:30 + Derek Buitenhuis wrote: > On 2/20/2016 9:24 PM, Michael Niedermayer wrote: > >> This is a silent API break. You changed behavior of a function in such a > >> way > >> that functioning code no longer works. > > > > yes, i posted a patch that would have maintained API more but people > > did not like it > > Yes, I must have missed it. Perhaps it got drowned in a sea of Mats > self-replies. > Sorry about that. > > > peer review said: > > "> I'd totally expect each line _and_ the start of the palette to be > > > aligned to the requested slignment. > > > > It's what I would expect as well." > > I would argue, also, that I would not expect a "GRAY8" plane to: > > 1. Have a palette. > 2. Require alignment. I would agree. GRAY8 "needs" a palette for in-memory AVFrames and such, because PSEUDOPAL guarantees it and libswscale relies on it. But it mustn't require a palette for anything else, which includes fixed frame layouts for interoperation with other code or storage, like the av_image functions are intended for. Can we please deprecate and remove this PSEUDOPAL nonsense? Other than that, I'd argue a function which includes the palette in the layout should probably be separate, because there are many different methods of storing the palette, and appending it to the image data is just one of them. And who says the palette should be aligned? The current code/semantics don't even make sense. > > Grey is grey. Not colored with a palette. > > But I digress, that matter is beyond the scope here, I suppose. > > > so i did that and i added the check above to catch the case where > > this results in unaligned AVFrame. > > dependig on how the AVFrame is used that can be a problem or can also > > be no problem. > > [...] > > > should i remove this check ? (this would be undefined behavior if > > someone accesses the palette with int*, i belive there is some code in > > our codebase which does this ...) > > Aside: An alignment of 4 is not going to help if someone accesses it as int* > on a platform with 64 bit ints. > > > should i replace it by a warning ? > > > > should i revert the whole patchset (that will result in generated raw > > rgb files to be invalid for nut, avi and mov) > > [...] > > > should i revert this and apply the other patchset that maintains API > > more but that was rejected by people ? > > I didn't see this one either; I'll try and go back and look. > > > do you suggest something else ? > > also iam very happy to leave this to others, if someone else wants to > > take over, its rather difficult to implement this in a way that makes > > everyone happy. > > I'm truly not sure. In my view, the technically correct thing to do > is to introduce a new API function (according to Semantic Versioning). > This introduces yet another some_function2, which is more API churn... > > I am not sure how many people outside of FFMS2 this has/will bite, or > what is the "least bad" fix. I only noticed since FFMS2 apparently ceased > to function entirely after that commit; I doubt anyone else hardcodes > GRAY8. > > I am hoping the two people named in the commit (Stefano and wm4) can > offer some insight. IMO, this behavior should definitely be removed for PSEUDOPAL. The "real" paletted case doesn't make too much sense either, but might be required for compatibility? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] MediaCodec support patchset v2
Differences from the latest patches: * Android application context support has been removed * Android content uris support has been removed * The jni util functions has been moved from lavu to lavc, and they are now prefixed by ff_ instead of avpriv_ and no more public interfaces are exposed thus, the Java VM is now retreived using the private c++ JniInvocation wrapper from Google. The new patchset has been pushed to a new development branch: https://github.com/mbouron/FFmpeg/tree/feature/mediacodec-support-v2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] lavc: add JNI support
From: Matthieu Bouron --- configure | 5 + libavcodec/Makefile | 2 + libavcodec/ffjni.c | 480 libavcodec/ffjni.h | 147 4 files changed, 634 insertions(+) create mode 100644 libavcodec/ffjni.c create mode 100644 libavcodec/ffjni.h diff --git a/configure b/configure index 2148f11..b107a38 100755 --- a/configure +++ b/configure @@ -206,6 +206,7 @@ External library support: --enable-gnutls enable gnutls, needed for https support if openssl is not used [no] --disable-iconv disable iconv [autodetect] + --enable-jni enable JNI support [no] --enable-ladspa enable LADSPA audio filtering [no] --enable-libass enable libass subtitles rendering, needed for subtitles and ass filter [no] @@ -1432,6 +1433,7 @@ EXTERNAL_LIBRARY_LIST=" gmp gnutls iconv +jni ladspa libass libbluray @@ -5455,6 +5457,8 @@ enabled decklink && { check_header DeckLinkAPI.h || die "ERROR: DeckLin enabled frei0r&& { check_header frei0r.h || die "ERROR: frei0r.h header not found"; } enabled gmp && require2 gmp gmp.h mpz_export -lgmp enabled gnutls&& require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init +enabled jni && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads && + check_lib2 "dlfcn.h" dlopen -ldl; } enabled ladspa&& { check_header ladspa.h || die "ERROR: ladspa.h header not found"; } enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883 enabled libass&& require_pkg_config libass ass/ass.h ass_library_init @@ -6222,6 +6226,7 @@ echo "threading support ${thread_type-no}" echo "safe bitstream reader ${safe_bitstream_reader-no}" echo "SDL support ${sdl-no}" echo "opencl enabled${opencl-no}" +echo "JNI support ${jni-no}" echo "texi2html enabled ${texi2html-no}" echo "perl enabled ${perl-no}" echo "pod2man enabled ${pod2man-no}" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index f6a4fbb..ced700a 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -78,6 +78,7 @@ OBJS-$(CONFIG_IIRFILTER) += iirfilter.o OBJS-$(CONFIG_IMDCT15) += imdct15.o OBJS-$(CONFIG_INTRAX8) += intrax8.o intrax8dsp.o OBJS-$(CONFIG_IVIDSP) += ivi_dsp.o +OBJS-$(CONFIG_JNI) += ffjni.o OBJS-$(CONFIG_JPEGTABLES) += jpegtables.o OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o OBJS-$(CONFIG_LLAUDDSP)+= lossless_audiodsp.o @@ -939,6 +940,7 @@ SKIPHEADERS+= %_tablegen.h \ SKIPHEADERS-$(CONFIG_D3D11VA) += d3d11va.h dxva2_internal.h SKIPHEADERS-$(CONFIG_DXVA2)+= dxva2.h dxva2_internal.h +SKIPHEADERS-$(CONFIG_JNI) += ffjni.h SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h SKIPHEADERS-$(CONFIG_LIBUTVIDEO) += libutvideo.h SKIPHEADERS-$(CONFIG_LIBVPX) += libvpx.h diff --git a/libavcodec/ffjni.c b/libavcodec/ffjni.c new file mode 100644 index 000..e73d6e0 --- /dev/null +++ b/libavcodec/ffjni.c @@ -0,0 +1,480 @@ +/* + * Copyright (c) 2015-2016 Matthieu Bouron + * + * 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 +#include + +#include "libavutil/bprint.h" +#include "libavutil/log.h" + +#include "config.h" +#include "ffjni.h" + +static JavaVM *java_vm = NULL; +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + +/** + * Check if JniInvocation has been initialized. + * + * @param log_ctx context used for logging, can be NULL + * @return 0 on success, < 0 otherwise + */ +static int check_jni_invocation(void *log_ctx) +{ +int ret = AVERROR_EXTERNAL; +void *handle = NULL; +void **jni_invocation = NULL; + +handle = dlopen(NULL, RTLD_LOCAL); +if (!handle) { +goto done; +} + +jni_invocation = (voi
[FFmpeg-devel] [PATCH 2/2] lavc: add h264 mediacodec decoder
From: Matthieu Bouron --- configure |5 + libavcodec/Makefile |3 + libavcodec/allcodecs.c |1 + libavcodec/mediacodec_wrapper.c | 1521 +++ libavcodec/mediacodec_wrapper.h | 123 libavcodec/mediacodecdec.c | 862 ++ libavcodec/mediacodecdec.h | 82 +++ libavcodec/mediacodecdec_h264.c | 356 + 8 files changed, 2953 insertions(+) create mode 100644 libavcodec/mediacodec_wrapper.c create mode 100644 libavcodec/mediacodec_wrapper.h create mode 100644 libavcodec/mediacodecdec.c create mode 100644 libavcodec/mediacodecdec.h create mode 100644 libavcodec/mediacodecdec_h264.c diff --git a/configure b/configure index b107a38..4fadaea 100755 --- a/configure +++ b/configure @@ -275,6 +275,7 @@ External library support: --enable-libzvbi enable teletext support via libzvbi [no] --disable-lzma disable lzma [autodetect] --enable-decklinkenable Blackmagic DeckLink I/O support [no] + --enable-mediacodec enable Android MediaCodec support [no] --enable-mmalenable decoding via MMAL [no] --enable-netcdf enable NetCDF, needed for sofalizer filter [no] --enable-nvenc enable NVIDIA NVENC support [no] @@ -1497,6 +1498,7 @@ EXTERNAL_LIBRARY_LIST=" libzmq libzvbi lzma +mediacodec mmal netcdf nvenc @@ -2491,6 +2493,8 @@ h264_d3d11va_hwaccel_deps="d3d11va" h264_d3d11va_hwaccel_select="h264_decoder" h264_dxva2_hwaccel_deps="dxva2" h264_dxva2_hwaccel_select="h264_decoder" +h264_mediacodec_decoder_deps="mediacodec" +h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser" h264_mmal_decoder_deps="mmal" h264_mmal_decoder_select="mmal" h264_mmal_hwaccel_deps="mmal" @@ -5570,6 +5574,7 @@ enabled libzmq&& require_pkg_config libzmq zmq.h zmq_ctx_new enabled libzvbi && require libzvbi libzvbi.h vbi_decoder_new -lzvbi && { check_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" || enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; } +enabled mediacodec&& { enabled jni || die "ERROR: mediacodec requires --enable-jni"; } enabled mmal && { check_lib interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host || { ! enabled cross_compile && { add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline ; diff --git a/libavcodec/Makefile b/libavcodec/Makefile index ced700a..e14a55b 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -88,6 +88,7 @@ OBJS-$(CONFIG_LSP) += lsp.o OBJS-$(CONFIG_LZF) += lzf.o OBJS-$(CONFIG_MDCT)+= mdct_fixed.o mdct_float.o mdct_fixed_32.o OBJS-$(CONFIG_ME_CMP) += me_cmp.o +OBJS-$(CONFIG_MEDIACODEC) += mediacodecdec.o mediacodec_wrapper.o OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodata.o \ mpegaudiodecheader.o @@ -302,6 +303,7 @@ OBJS-$(CONFIG_H264_DECODER)+= h264.o h264_cabac.o h264_cavlc.o \ h264_direct.o h264_loopfilter.o \ h264_mb.o h264_picture.o h264_ps.o \ h264_refs.o h264_sei.o h264_slice.o +OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec_h264.o OBJS-$(CONFIG_H264_MMAL_DECODER) += mmaldec.o OBJS-$(CONFIG_H264_VDA_DECODER)+= vda_h264_dec.o OBJS-$(CONFIG_H264_QSV_DECODER)+= qsvdec_h2645.o @@ -945,6 +947,7 @@ SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h SKIPHEADERS-$(CONFIG_LIBUTVIDEO) += libutvideo.h SKIPHEADERS-$(CONFIG_LIBVPX) += libvpx.h SKIPHEADERS-$(CONFIG_LIBWEBP_ENCODER) += libwebpenc_common.h +SKIPHEADERS-$(CONFIG_MEDIACODEC) += mediacodecdec.h mediacodec_wrapper.h SKIPHEADERS-$(CONFIG_QSV) += qsv.h qsv_internal.h SKIPHEADERS-$(CONFIG_QSVDEC) += qsvdec.h SKIPHEADERS-$(CONFIG_QSVENC) += qsvenc.h diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 2097db0..58bcb24 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -196,6 +196,7 @@ void avcodec_register_all(void) REGISTER_ENCDEC (H263P, h263p); REGISTER_DECODER(H264, h264); REGISTER_DECODER(H264_CRYSTALHD,h264_crystalhd); +REGISTER_DECODER(H264_MEDIACODEC, h264_mediacodec); REGISTER_DECODER(H264_MMAL, h264_mmal); REGISTER_DE
[FFmpeg-devel] [PATCH] swscale/arm: re-enable neon rgbx to nv12 routines
Commit '842b8f4ba2e79b9c004a67f6fdb3d5c5d05805d3' fixed clang/iphone build but failed on some versions of cygwin. It has now been verified to work on both platforms. --- libswscale/arm/Makefile | 4 ++-- libswscale/arm/swscale_unscaled.c | 4 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/libswscale/arm/Makefile b/libswscale/arm/Makefile index 97b3561..9ccec3b 100644 --- a/libswscale/arm/Makefile +++ b/libswscale/arm/Makefile @@ -1,5 +1,5 @@ OBJS+= arm/swscale_unscaled.o -# NEON-OBJS += arm/rgb2yuv_neon_32.o -# NEON-OBJS += arm/rgb2yuv_neon_16.o +NEON-OBJS += arm/rgb2yuv_neon_32.o +NEON-OBJS += arm/rgb2yuv_neon_16.o NEON-OBJS += arm/yuv2rgb_neon.o diff --git a/libswscale/arm/swscale_unscaled.c b/libswscale/arm/swscale_unscaled.c index ac1e4a9..8aa933c 100644 --- a/libswscale/arm/swscale_unscaled.c +++ b/libswscale/arm/swscale_unscaled.c @@ -23,7 +23,6 @@ #include "libswscale/swscale_internal.h" #include "libavutil/arm/cpu.h" -#if 0 extern void rgbx_to_nv12_neon_32(const uint8_t *src, uint8_t *y, uint8_t *chroma, int width, int height, int y_stride, int c_stride, int src_stride, @@ -61,7 +60,6 @@ static int rgbx_to_nv12_neon_16_wrapper(SwsContext *context, const uint8_t *src[ return 0; } -#endif #define YUV_TO_RGB_TABLE(precision) \ c->yuv2rgb_v2r_coeff / ((precision) == 16 ? 1 << 7 : 1), \ @@ -167,14 +165,12 @@ DECLARE_FF_NVX_TO_ALL_RGBX_ALL_PRECISION_FUNCS(nv21) static void get_unscaled_swscale_neon(SwsContext *c) { int accurate_rnd = c->flags & SWS_ACCURATE_RND; -#if 0 if (c->srcFormat == AV_PIX_FMT_RGBA && c->dstFormat == AV_PIX_FMT_NV12 && (c->srcW >= 16)) { c->swscale = accurate_rnd ? rgbx_to_nv12_neon_32_wrapper : rgbx_to_nv12_neon_16_wrapper; } -#endif SET_FF_NVX_TO_ALL_RGBX_FUNC(nv12, NV12, accurate_rnd); SET_FF_NVX_TO_ALL_RGBX_FUNC(nv21, NV21, accurate_rnd); -- 2.7.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] Using 16 bits per component in the internal palette
QuickTime uses 16 bits per component for its palette. Would it be sensible to do the same for the internal palette in FFmpeg as well, in order to avoid "precision loss"? With the result that AVPALETTE_SIZE will be 2048 rather than 1024. Mats -- Mats Peterson http://matsp888.no-ip.org/~mats/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Using 16 bits per component in the internal palette
On 02/22/2016 12:57 PM, Mats Peterson wrote: QuickTime uses 16 bits per component for its palette. Would it be sensible to do the same for the internal palette in FFmpeg as well, in order to avoid "precision loss"? With the result that AVPALETTE_SIZE will be 2048 rather than 1024. Mats That will take a lot of modifications for anything that uses a palette I guess, changing from uint32_t to uint64_t, etc. Mats ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] lavc: add h264 mediacodec decoder
On Mon, Feb 22, 2016 at 12:20:36PM +0100, Matthieu Bouron wrote: > From: Matthieu Bouron [...] > +codec = (*env)->NewObject(env, jfields.mediacodec_list_class, > jfields.init_id, 0); > +if (!codec) { > +av_log(NULL, AV_LOG_ERROR, "Could not create media codec > list\n"); > +goto done; > +} > + > +tmp = (*env)->CallObjectMethod(env, codec, > jfields.find_decoder_for_format_id, format); > +if (!tmp) { > +av_log(NULL, AV_LOG_ERROR, "Could not find decoder in media > codec list\n"); > +goto done; > +} > + > +name = ff_jni_jstring_to_utf_chars(env, tmp, NULL); > +if (!name) { > +av_log(NULL, AV_LOG_ERROR, "Could not convert jstring to utf > chars\n"); some non NULL context would be better, if possible, so the user knows where an error came from [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB During times of universal deceit, telling the truth becomes a revolutionary act. -- George Orwell signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [RFC] configure: test inter-procedural constant propagation for armv6 inline asm
There are two routines in avutil/arm/intmath that fail to compile without IPCP. This patch tries to detect if such optimizations are present. I am unable to find a way to test it without using inline asm, so the check flag is bound to each arch extension. I also want optflags checks to be performed earlier but am unsure about the side-effect. This patch just performs ipcp checks after optflags ones. --- configure | 22 ++ 1 file changed, 22 insertions(+) diff --git a/configure b/configure index a78e228..3b35551 100755 --- a/configure +++ b/configure @@ -916,9 +916,25 @@ EOF check_insn(){ log check_insn "$@" check_inline_asm ${1}_inline "\"$2\"" +enabled ${1}_inline && enable ${1}_ipcp echo "$2" | check_as && enable ${1}_external || disable ${1}_external } +check_inline_asm_ipcp(){ +log check_inline_asm_ipcp "$@" +name="${1}_ipcp" +code="$2" +param_decl="$3" +param_val="$4" +shift 4 +disable ${name} +check_cc "$@" $optflags << EOF && enable $name +static +void foo($param_decl){ __asm__ volatile($code); } +void bar() { foo($param_val); } +EOF +} + check_yasm(){ log check_yasm "$@" echo "$1" > $TMPS @@ -1937,6 +1953,7 @@ HAVE_LIST=" $ARCH_EXT_LIST $(add_suffix _external $ARCH_EXT_LIST) $(add_suffix _inline $ARCH_EXT_LIST) +$(add_suffix _ipcp $ARCH_EXT_LIST) $ARCH_FEATURES $ATOMICS_LIST $BUILTIN_LIST @@ -2145,6 +2162,7 @@ vfpv3_deps="vfp" setend_deps="arm" map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM +map 'eval ${v}_ipcp_deps=${v}_inline' $ARCH_EXT_LIST_ARM mipsfpu_deps="mips" mipsdsp_deps="mips" @@ -5889,6 +5907,10 @@ check_optflags $optflags check_optflags -fno-math-errno check_optflags -fno-signed-zeros +enabled armv6 && check_inline_asm_ipcp armv6 \ +'"ssat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p)' 'int x, int a, int p' '1, 1, 1' \ +$optflags + enabled ftrapv && check_cflags -ftrapv check_cc -mno-red-zone
Re: [FFmpeg-devel] Using 16 bits per component in the internal palette
On 02/22/2016 01:07 PM, Mats Peterson wrote: On 02/22/2016 12:57 PM, Mats Peterson wrote: QuickTime uses 16 bits per component for its palette. Would it be sensible to do the same for the internal palette in FFmpeg as well, in order to avoid "precision loss"? With the result that AVPALETTE_SIZE will be 2048 rather than 1024. Mats That will take a lot of modifications for anything that uses a palette I guess, changing from uint32_t to uint64_t, etc. It's probably not worth it. Sorry, wm4, for my self-replying. This was the last one. Mats ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v11] lavf/movenc: Add palette to video sample description
Zero out palette. -- Mats Peterson http://matsp888.no-ip.org/~mats/ >From 974a68c673a451fb985a22071b7e5edad4a73fd4 Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Mon, 22 Feb 2016 13:56:31 +0100 Subject: [PATCH v11] lavf/movenc: Add palette to video sample description --- libavformat/movenc.c | 66 +- libavformat/movenc.h |5 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9c0f7a..a4cb0f2 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1714,7 +1714,27 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_wb16(pb, track->enc->bits_per_coded_sample); else avio_wb16(pb, 0x18); /* Reserved */ -avio_wb16(pb, 0x); /* Reserved */ + +if (track->enc->codec_id == AV_CODEC_ID_RAWVIDEO && mov->is_raw_rgb && +track->enc->bits_per_coded_sample >= 1 && track->enc->bits_per_coded_sample <= 8) { +int i; +int pal_size = 1 << track->enc->bits_per_coded_sample; +avio_wb16(pb, 0); /* Color table ID */ +avio_wb32(pb, 0); /* Color table seed */ +avio_wb16(pb, 0x8000);/* Color table flags */ +avio_wb16(pb, pal_size - 1); /* Color table size (zero-relative) */ +for (i = 0; i < pal_size; i++) { +uint16_t r = (mov->palette[i] >> 16) & 0xff; +uint16_t g = (mov->palette[i] >> 8) & 0xff; +uint16_t b = mov->palette[i] & 0xff; +avio_wb16(pb, 0); +avio_wb16(pb, (r << 8) | r); +avio_wb16(pb, (g << 8) | g); +avio_wb16(pb, (b << 8) | b); +} +} else +avio_wb16(pb, 0x); /* Color table ID, -1 for no or default palette */ + if (track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if (track->enc->codec_id == AV_CODEC_ID_H263) @@ -4703,6 +4723,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } else { int i; MOVMuxContext *mov = s->priv_data; +MOVTrack *trk = &mov->tracks[pkt->stream_index]; if (!pkt->size) return mov_write_single_packet(s, pkt); /* Passthrough. */ @@ -4739,6 +4760,49 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } +if (trk->enc->codec_type == AVMEDIA_TYPE_VIDEO) { +mov->is_raw_rgb = trk->enc->pix_fmt == AV_PIX_FMT_RGB24 || +trk->enc->pix_fmt == AV_PIX_FMT_ARGB || +trk->enc->pix_fmt == AV_PIX_FMT_RGB555BE || +trk->enc->pix_fmt == AV_PIX_FMT_PAL8 || +trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || +trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE || +trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK; + +if (trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO && mov->is_raw_rgb) { +const uint8_t *data = pkt->data; +int size = pkt->size; +int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16; +int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2; +int ret = ff_reshuffle_raw_rgb(s, &pkt, trk->enc, expected_stride); +if (ret < 0) +return ret; +if (!mov->pal_done) { +memset(mov->palette, 0, AVPALETTE_SIZE); +if (ret == CONTAINS_PAL) { +int pal_size = 1 << trk->enc->bits_per_coded_sample; +memcpy(mov->palette, data + size - 4*pal_size, 4*pal_size); +} else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8) { +/* Calculate 8 bpp grayscale palette */ +for (i = 0; i < 256; i++) +mov->palette[i] = (0xFFU << 24) | (i << 16) | (i << 8) | i; +} else if (trk->enc->bits_per_coded_sample == 1) { +/* Initialize 1 bpp palette to black & white */ +if (trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK) +mov->palette[1] = 0x; +else +mov->palette[0] = 0x; +} +mov->pal_done++; +} +if (ret) { +ret = mov_write_single_packet(s, pkt); +av_packet_free(&pkt); +return ret; +} +} +} + return mov_write_single_packet(s, pkt); } } diff --git a/libavformat/movenc.h b/libavformat/movenc.h index deb90fe..9170ade 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -209,6 +209,11 @@ typedef struct MOVMuxContext { uint8_t *encryption_kid; int encryption_kid_len; +ui
[FFmpeg-devel] [PATCH v12] lavf/movenc: Add palette to video sample description
Add some non-standard pixel formats to the "is_raw_rgb" category. -- Mats Peterson http://matsp888.no-ip.org/~mats/ >From 79719b77d42e0f508cc6b8ddbe97e731752d576c Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Mon, 22 Feb 2016 14:30:14 +0100 Subject: [PATCH v12] lavf/movenc: Add palette to video sample description --- libavformat/movenc.c | 74 +- libavformat/movenc.h |5 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9c0f7a..787892c 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1714,7 +1714,27 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_wb16(pb, track->enc->bits_per_coded_sample); else avio_wb16(pb, 0x18); /* Reserved */ -avio_wb16(pb, 0x); /* Reserved */ + +if (track->enc->codec_id == AV_CODEC_ID_RAWVIDEO && mov->is_raw_rgb && +track->enc->bits_per_coded_sample >= 1 && track->enc->bits_per_coded_sample <= 8) { +int i; +int pal_size = 1 << track->enc->bits_per_coded_sample; +avio_wb16(pb, 0); /* Color table ID */ +avio_wb32(pb, 0); /* Color table seed */ +avio_wb16(pb, 0x8000);/* Color table flags */ +avio_wb16(pb, pal_size - 1); /* Color table size (zero-relative) */ +for (i = 0; i < pal_size; i++) { +uint16_t r = (mov->palette[i] >> 16) & 0xff; +uint16_t g = (mov->palette[i] >> 8) & 0xff; +uint16_t b = mov->palette[i] & 0xff; +avio_wb16(pb, 0); +avio_wb16(pb, (r << 8) | r); +avio_wb16(pb, (g << 8) | g); +avio_wb16(pb, (b << 8) | b); +} +} else +avio_wb16(pb, 0x); /* Color table ID, -1 for no or default palette */ + if (track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if (track->enc->codec_id == AV_CODEC_ID_H263) @@ -1777,6 +1797,8 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr if (avid) avio_wb32(pb, 0); +mov->pal_done = 0; + return update_size(pb, pos); } @@ -4703,6 +4725,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } else { int i; MOVMuxContext *mov = s->priv_data; +MOVTrack *trk = &mov->tracks[pkt->stream_index]; if (!pkt->size) return mov_write_single_packet(s, pkt); /* Passthrough. */ @@ -4739,6 +4762,55 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } +if (trk->enc->codec_type == AVMEDIA_TYPE_VIDEO) { +mov->is_raw_rgb = trk->enc->pix_fmt == AV_PIX_FMT_RGB24 || +trk->enc->pix_fmt == AV_PIX_FMT_BGR24 || +trk->enc->pix_fmt == AV_PIX_FMT_ARGB || +trk->enc->pix_fmt == AV_PIX_FMT_ABGR || +trk->enc->pix_fmt == AV_PIX_FMT_RGBA || +trk->enc->pix_fmt == AV_PIX_FMT_BGRA || +trk->enc->pix_fmt == AV_PIX_FMT_RGB555BE || +trk->enc->pix_fmt == AV_PIX_FMT_RGB555LE || +trk->enc->pix_fmt == AV_PIX_FMT_PAL8 || +trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || +trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE || +trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK; + +if (trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO && mov->is_raw_rgb) { +const uint8_t *data = pkt->data; +int size = pkt->size; +int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16; +int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2; +int ret = ff_reshuffle_raw_rgb(s, &pkt, trk->enc, expected_stride); +if (ret < 0) +return ret; +if (!mov->pal_done) { +fprintf(stderr, "PAL NOT DONE\n"); +memset(mov->palette, 0, AVPALETTE_SIZE); +if (ret == CONTAINS_PAL) { +int pal_size = 1 << trk->enc->bits_per_coded_sample; +memcpy(mov->palette, data + size - 4*pal_size, 4*pal_size); +} else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8) { +/* Calculate 8 bpp grayscale palette */ +for (i = 0; i < 256; i++) +mov->palette[i] = (0xFFU << 24) | (i << 16) | (i << 8) | i; +} else if (trk->enc->bits_per_coded_sample == 1) { +/* Initialize 1 bpp palette to black & white */ +if (trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK) +mov->palette[1] = 0x; +else +mov->palette[0]
Re: [FFmpeg-devel] [PATCH] IFF ANIM support
Hi, > What software correctly plays BoingThrows? It is 74/J compression. This datatype/library decodes 74/J: http://aminet.net/package/util/dtype/animdtc0112 Regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v13] lavf/movenc: Add palette to video sample description
Forgot to remove one of my nasty fprintf() lines. -- Mats Peterson http://matsp888.no-ip.org/~mats/ >From 24c252a00b1cfa0ad6bdf6beb1414678fa4cd3b5 Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Mon, 22 Feb 2016 14:35:21 +0100 Subject: [PATCH v13] lavf/movenc: Add palette to video sample description --- libavformat/movenc.c | 73 +- libavformat/movenc.h |5 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9c0f7a..0543a4c 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1714,7 +1714,27 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_wb16(pb, track->enc->bits_per_coded_sample); else avio_wb16(pb, 0x18); /* Reserved */ -avio_wb16(pb, 0x); /* Reserved */ + +if (track->enc->codec_id == AV_CODEC_ID_RAWVIDEO && mov->is_raw_rgb && +track->enc->bits_per_coded_sample >= 1 && track->enc->bits_per_coded_sample <= 8) { +int i; +int pal_size = 1 << track->enc->bits_per_coded_sample; +avio_wb16(pb, 0); /* Color table ID */ +avio_wb32(pb, 0); /* Color table seed */ +avio_wb16(pb, 0x8000);/* Color table flags */ +avio_wb16(pb, pal_size - 1); /* Color table size (zero-relative) */ +for (i = 0; i < pal_size; i++) { +uint16_t r = (mov->palette[i] >> 16) & 0xff; +uint16_t g = (mov->palette[i] >> 8) & 0xff; +uint16_t b = mov->palette[i] & 0xff; +avio_wb16(pb, 0); +avio_wb16(pb, (r << 8) | r); +avio_wb16(pb, (g << 8) | g); +avio_wb16(pb, (b << 8) | b); +} +} else +avio_wb16(pb, 0x); /* Color table ID, -1 for no or default palette */ + if (track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if (track->enc->codec_id == AV_CODEC_ID_H263) @@ -1777,6 +1797,8 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr if (avid) avio_wb32(pb, 0); +mov->pal_done = 0; + return update_size(pb, pos); } @@ -4703,6 +4725,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } else { int i; MOVMuxContext *mov = s->priv_data; +MOVTrack *trk = &mov->tracks[pkt->stream_index]; if (!pkt->size) return mov_write_single_packet(s, pkt); /* Passthrough. */ @@ -4739,6 +4762,54 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } +if (trk->enc->codec_type == AVMEDIA_TYPE_VIDEO) { +mov->is_raw_rgb = trk->enc->pix_fmt == AV_PIX_FMT_RGB24 || +trk->enc->pix_fmt == AV_PIX_FMT_BGR24 || +trk->enc->pix_fmt == AV_PIX_FMT_ARGB || +trk->enc->pix_fmt == AV_PIX_FMT_ABGR || +trk->enc->pix_fmt == AV_PIX_FMT_RGBA || +trk->enc->pix_fmt == AV_PIX_FMT_BGRA || +trk->enc->pix_fmt == AV_PIX_FMT_RGB555BE || +trk->enc->pix_fmt == AV_PIX_FMT_RGB555LE || +trk->enc->pix_fmt == AV_PIX_FMT_PAL8 || +trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || +trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE || +trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK; + +if (trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO && mov->is_raw_rgb) { +const uint8_t *data = pkt->data; +int size = pkt->size; +int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16; +int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2; +int ret = ff_reshuffle_raw_rgb(s, &pkt, trk->enc, expected_stride); +if (ret < 0) +return ret; +if (!mov->pal_done) { +memset(mov->palette, 0, AVPALETTE_SIZE); +if (ret == CONTAINS_PAL) { +int pal_size = 1 << trk->enc->bits_per_coded_sample; +memcpy(mov->palette, data + size - 4*pal_size, 4*pal_size); +} else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8) { +/* Calculate 8 bpp grayscale palette */ +for (i = 0; i < 256; i++) +mov->palette[i] = (0xFFU << 24) | (i << 16) | (i << 8) | i; +} else if (trk->enc->bits_per_coded_sample == 1) { +/* Initialize 1 bpp palette to black & white */ +if (trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK) +mov->palette[1] = 0x; +else +mov->palette[0] = 0x; +} +mov->pal_done
Re: [FFmpeg-devel] [PATCH] IFF ANIM support
Hi, > This datatype/library decodes 74/J: > > http://aminet.net/package/util/dtype/animdtc0112 Also there is "movie" player here (+ some 74/J samples), but without source code: http://aminet.net/package/misc/fish/fish-0116 It plays BingThrows file correctly. Regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] lavc: add h264 mediacodec decoder
On Mon, 22 Feb 2016 12:20:36 +0100 Matthieu Bouron wrote: > From: Matthieu Bouron > > --- > ... Some remarks: - The qcom stuff should probably be moved into its own source file, because it's a lot of code, but self-contained. - Do you really need h264_extradata_to_annexb_sps_pps? The BSF already creates mp4-style extradata, which MediaCodec apparently can take directly. - There are several timeouts to avoid deadlocks in the dataflow, apparently. Is this inherently needed, or only because of the libavcodec API, which requires returning 0 or 1 output frames per input packet? - The JNI code uses braces in case labels: "case (FF_JNI_FIELD): {" (Seems unusual coding style.) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v14] lavf/movenc: Add palette to video sample description
Include trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO in mov->is_raw_rgb; -- Mats Peterson http://matsp888.no-ip.org/~mats/ >From eb647df677a085a7d8afa8c73612dbfa49aa9c9d Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Mon, 22 Feb 2016 14:52:17 +0100 Subject: [PATCH v14] lavf/movenc: Add palette to video sample description --- libavformat/movenc.c | 74 +- libavformat/movenc.h |5 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9c0f7a..84a4380 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1714,7 +1714,27 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_wb16(pb, track->enc->bits_per_coded_sample); else avio_wb16(pb, 0x18); /* Reserved */ -avio_wb16(pb, 0x); /* Reserved */ + +if (mov->is_raw_rgb && +track->enc->bits_per_coded_sample >= 1 && track->enc->bits_per_coded_sample <= 8) { +int i; +int pal_size = 1 << track->enc->bits_per_coded_sample; +avio_wb16(pb, 0); /* Color table ID */ +avio_wb32(pb, 0); /* Color table seed */ +avio_wb16(pb, 0x8000);/* Color table flags */ +avio_wb16(pb, pal_size - 1); /* Color table size (zero-relative) */ +for (i = 0; i < pal_size; i++) { +uint16_t r = (mov->palette[i] >> 16) & 0xff; +uint16_t g = (mov->palette[i] >> 8) & 0xff; +uint16_t b = mov->palette[i] & 0xff; +avio_wb16(pb, 0); +avio_wb16(pb, (r << 8) | r); +avio_wb16(pb, (g << 8) | g); +avio_wb16(pb, (b << 8) | b); +} +} else +avio_wb16(pb, 0x); /* Color table ID, -1 for no or default palette */ + if (track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if (track->enc->codec_id == AV_CODEC_ID_H263) @@ -1777,6 +1797,8 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr if (avid) avio_wb32(pb, 0); +mov->pal_done = 0; + return update_size(pb, pos); } @@ -4703,6 +4725,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } else { int i; MOVMuxContext *mov = s->priv_data; +MOVTrack *trk = &mov->tracks[pkt->stream_index]; if (!pkt->size) return mov_write_single_packet(s, pkt); /* Passthrough. */ @@ -4739,6 +4762,55 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } +if (trk->enc->codec_type == AVMEDIA_TYPE_VIDEO) { +mov->is_raw_rgb = trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO && +(trk->enc->pix_fmt == AV_PIX_FMT_RGB24 || + trk->enc->pix_fmt == AV_PIX_FMT_BGR24 || + trk->enc->pix_fmt == AV_PIX_FMT_ARGB || + trk->enc->pix_fmt == AV_PIX_FMT_ABGR || + trk->enc->pix_fmt == AV_PIX_FMT_RGBA || + trk->enc->pix_fmt == AV_PIX_FMT_BGRA || + trk->enc->pix_fmt == AV_PIX_FMT_RGB555BE || + trk->enc->pix_fmt == AV_PIX_FMT_RGB555LE || + trk->enc->pix_fmt == AV_PIX_FMT_PAL8 || + trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || + trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE || + trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK); + +if (mov->is_raw_rgb) { +const uint8_t *data = pkt->data; +int size = pkt->size; +int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16; +int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2; +int ret = ff_reshuffle_raw_rgb(s, &pkt, trk->enc, expected_stride); +if (ret < 0) +return ret; +if (!mov->pal_done) { +memset(mov->palette, 0, AVPALETTE_SIZE); +if (ret == CONTAINS_PAL) { +int pal_size = 1 << trk->enc->bits_per_coded_sample; +memcpy(mov->palette, data + size - 4*pal_size, 4*pal_size); +} else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8) { +/* Calculate 8 bpp grayscale palette */ +for (i = 0; i < 256; i++) +mov->palette[i] = (0xFFU << 24) | (i << 16) | (i << 8) | i; +} else if (trk->enc->bits_per_coded_sample == 1) { +/* Initialize 1 bpp palette to black & white */ +if (trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK) +mov->palette[1] = 0x; +else +mov->palette[0] = 0x; +} +mov->p
Re: [FFmpeg-devel] [RFC] gitlog merges
On Thu, Feb 18, 2016 at 03:06:33AM +0100, Michael Niedermayer wrote: > Hi > > currently merges on the ML do not contain any diff > should this be changed ? > > what diff command makes most sense ? > git log -p --first-parent -1 -m -M -C --patience > > jb, (in CC), would it be possible for us to edit the script which > creates the git log mails for ffmpeg so the changes due to merges can > be reviewed by anyone interrested on the ML ? > (that is obtain the current script and provide a patch or something > like that) > in case people want to change this Heres a suggested patch, note! iam not a perl developer comments, review and testing welcome Iam not sure iam supposed to share the original script from vlc as i was sent a link privately, but various versions of the script can be found by searching for '"Tool to send git commit notifications"' @@ -242,14 +242,23 @@ sub send_commit_notice($$) "---", ""; -open STAT, "-|" or exec "git", "diff-tree", "--stat", "-M", "--no-commit-id", $obj or die "cannot exec git-diff-tree"; +open STAT, "-|" or exec "git", "diff-tree", "--stat", "-M", "-m", "--first-parent", "--no-commit-id", $obj or die "cannot exec git-diff-tree"; push @notice, join("", ); close STAT; -open DIFF, "-|" or exec "git", "diff-tree", "-p", "-M", "--no-commit-id", $obj or die "cannot exec git-diff-tree"; +open DIFF, "-|" or exec "git", "diff-tree", "-p", "-M", "-m", "--first-parent", "--no-commit-id", $obj or die "cannot exec git-diff-tree"; my $diff = join( "", ); close DIFF; +open DIFF, "-|" or exec "git", "diff-tree", "-p", "-M", "-m", "--cc", "--no-commit-id", $obj or die "cannot exec git-diff-tree"; +my $diffcc = join( "", ); +close DIFF; + +if ($diff ne $diffcc) +{ +$diff = join "\n\n==\n\n", $diff, $diffcc +} + if (($max_diff_size == -1) || (length($diff) < $max_diff_size)) { push @notice, $diff; [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In a rich man's house there is no place to spit but his face. -- Diogenes of Sinope signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v15] lavf/movenc: Add palette to video sample description
Added AV_PIX_FMT_RGB565BE and AV_PIX_FMT_RGB565LE to the "is_raw_rgb" category. Sorry for my patch spamming. This was the last one for some time. Mats -- Mats Peterson http://matsp888.no-ip.org/~mats/ >From 10345567b608425120565ce331c427b2c66e2ae2 Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Mon, 22 Feb 2016 15:17:14 +0100 Subject: [PATCH v15] lavf/movenc: Add palette to video sample description --- libavformat/movenc.c | 76 +- libavformat/movenc.h |5 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9c0f7a..773f0aa 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1714,7 +1714,27 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_wb16(pb, track->enc->bits_per_coded_sample); else avio_wb16(pb, 0x18); /* Reserved */ -avio_wb16(pb, 0x); /* Reserved */ + +if (mov->is_raw_rgb && +track->enc->bits_per_coded_sample >= 1 && track->enc->bits_per_coded_sample <= 8) { +int i; +int pal_size = 1 << track->enc->bits_per_coded_sample; +avio_wb16(pb, 0); /* Color table ID */ +avio_wb32(pb, 0); /* Color table seed */ +avio_wb16(pb, 0x8000);/* Color table flags */ +avio_wb16(pb, pal_size - 1); /* Color table size (zero-relative) */ +for (i = 0; i < pal_size; i++) { +uint16_t r = (mov->palette[i] >> 16) & 0xff; +uint16_t g = (mov->palette[i] >> 8) & 0xff; +uint16_t b = mov->palette[i] & 0xff; +avio_wb16(pb, 0); +avio_wb16(pb, (r << 8) | r); +avio_wb16(pb, (g << 8) | g); +avio_wb16(pb, (b << 8) | b); +} +} else +avio_wb16(pb, 0x); /* Color table ID, -1 for no or default palette */ + if (track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if (track->enc->codec_id == AV_CODEC_ID_H263) @@ -1777,6 +1797,8 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr if (avid) avio_wb32(pb, 0); +mov->pal_done = 0; + return update_size(pb, pos); } @@ -4703,6 +4725,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } else { int i; MOVMuxContext *mov = s->priv_data; +MOVTrack *trk = &mov->tracks[pkt->stream_index]; if (!pkt->size) return mov_write_single_packet(s, pkt); /* Passthrough. */ @@ -4739,6 +4762,57 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } +if (trk->enc->codec_type == AVMEDIA_TYPE_VIDEO) { +mov->is_raw_rgb = trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO && +(trk->enc->pix_fmt == AV_PIX_FMT_RGB24 || + trk->enc->pix_fmt == AV_PIX_FMT_BGR24 || + trk->enc->pix_fmt == AV_PIX_FMT_ARGB || + trk->enc->pix_fmt == AV_PIX_FMT_ABGR || + trk->enc->pix_fmt == AV_PIX_FMT_RGBA || + trk->enc->pix_fmt == AV_PIX_FMT_BGRA || + trk->enc->pix_fmt == AV_PIX_FMT_RGB555BE || + trk->enc->pix_fmt == AV_PIX_FMT_RGB555LE || + trk->enc->pix_fmt == AV_PIX_FMT_RGB565BE || + trk->enc->pix_fmt == AV_PIX_FMT_RGB565LE || + trk->enc->pix_fmt == AV_PIX_FMT_PAL8 || + trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || + trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE || + trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK); + +if (mov->is_raw_rgb) { +const uint8_t *data = pkt->data; +int size = pkt->size; +int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16; +int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2; +int ret = ff_reshuffle_raw_rgb(s, &pkt, trk->enc, expected_stride); +if (ret < 0) +return ret; +if (!mov->pal_done) { +memset(mov->palette, 0, AVPALETTE_SIZE); +if (ret == CONTAINS_PAL) { +int pal_size = 1 << trk->enc->bits_per_coded_sample; +memcpy(mov->palette, data + size - 4*pal_size, 4*pal_size); +} else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8) { +/* Calculate 8 bpp grayscale palette */ +for (i = 0; i < 256; i++) +mov->palette[i] = (0xFFU << 24) | (i << 16) | (i << 8) | i; +} else if (trk->enc->bits_per_coded_sample == 1) { +/* Initialize 1 bpp palette to black & white */ +if (trk->enc->pix_fmt == AV_PIX
[FFmpeg-devel] Support seek in encrypted MP4
Hi all, Found out today that my patch for supporting encrypted MP4's does not support seek... Patch attached Thanks, Eran 0001-mov-support-seek-in-encrypted-mp4.patch Description: 0001-mov-support-seek-in-encrypted-mp4.patch ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] checkasm: bench each vf_blend mode once
On Sat, Feb 20, 2016 at 04:16:52PM -0300, James Almer wrote: > Also test a smaller buffer. This drastically reduces --bench runtime > and reports smaller, more readable numbers. > > Signed-off-by: James Almer > --- > tests/checkasm/vf_blend.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) should be ok [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many that live deserve death. And some that die deserve life. Can you give it to them? Then do not be too eager to deal out death in judgement. For even the very wise cannot see all ends. -- Gandalf signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v15] lavf/movenc: Add palette to video sample description
On 02/22/2016 03:19 PM, Mats Peterson wrote: Added AV_PIX_FMT_RGB565BE and AV_PIX_FMT_RGB565LE to the "is_raw_rgb" category. Sorry for my patch spamming. This was the last one for some time. Mats Wait with this one. Simplification on the way. Mats ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v16] lavf/movenc: Add palette to video sample description
Use mov->is_unaligned_raw_rgb instead of including every possible RGB pixel format. -- Mats Peterson http://matsp888.no-ip.org/~mats/ >From 4cb1b16e26751a0f33ed1d86ed38b0f505eb66f0 Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Mon, 22 Feb 2016 17:06:37 +0100 Subject: [PATCH v16] lavf/movenc: Add palette to video sample description --- libavformat/movenc.c | 29 +++-- libavformat/movenc.h |2 +- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 773f0aa..60a9318 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1715,7 +1715,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr else avio_wb16(pb, 0x18); /* Reserved */ -if (mov->is_raw_rgb && +if (mov->is_unaligned_raw_rgb && track->enc->bits_per_coded_sample >= 1 && track->enc->bits_per_coded_sample <= 8) { int i; int pal_size = 1 << track->enc->bits_per_coded_sample; @@ -4763,23 +4763,16 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } if (trk->enc->codec_type == AVMEDIA_TYPE_VIDEO) { -mov->is_raw_rgb = trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO && -(trk->enc->pix_fmt == AV_PIX_FMT_RGB24 || - trk->enc->pix_fmt == AV_PIX_FMT_BGR24 || - trk->enc->pix_fmt == AV_PIX_FMT_ARGB || - trk->enc->pix_fmt == AV_PIX_FMT_ABGR || - trk->enc->pix_fmt == AV_PIX_FMT_RGBA || - trk->enc->pix_fmt == AV_PIX_FMT_BGRA || - trk->enc->pix_fmt == AV_PIX_FMT_RGB555BE || - trk->enc->pix_fmt == AV_PIX_FMT_RGB555LE || - trk->enc->pix_fmt == AV_PIX_FMT_RGB565BE || - trk->enc->pix_fmt == AV_PIX_FMT_RGB565LE || - trk->enc->pix_fmt == AV_PIX_FMT_PAL8 || - trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || - trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE || - trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK); - -if (mov->is_raw_rgb) { +mov->is_unaligned_raw_rgb = +trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO && + (trk->enc->pix_fmt == AV_PIX_FMT_RGB24 || +trk->enc->pix_fmt == AV_PIX_FMT_BGR24 || +trk->enc->pix_fmt == AV_PIX_FMT_PAL8 || +trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || +trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE || +trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK); + +if (mov->is_unaligned_raw_rgb) { const uint8_t *data = pkt->data; int size = pkt->size; int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16; diff --git a/libavformat/movenc.h b/libavformat/movenc.h index 9170ade..daaef53 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -212,7 +212,7 @@ typedef struct MOVMuxContext { uint32_t palette[AVPALETTE_COUNT]; int pal_done; -int is_raw_rgb; +int is_unaligned_raw_rgb; } MOVMuxContext; -- 1.7.10.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v16] lavf/movenc: Add palette to video sample description
On 02/22/2016 05:08 PM, Mats Peterson wrote: Use mov->is_unaligned_raw_rgb instead of including every possible RGB pixel format. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel This one is broken. -- Mats Peterson http://matsp888.no-ip.org/~mats/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v17] lavf/movenc: Add palette to video sample description
Use mov->is_unaligned_raw_rgb instead of including every possible RGB pixel format. -- Mats Peterson http://matsp888.no-ip.org/~mats/ >From b946055a9e371bd3b23a674b0283738cd3de7a94 Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Mon, 22 Feb 2016 17:18:31 +0100 Subject: [PATCH v17] lavf/movenc: Add palette to video sample description --- libavformat/movenc.c | 69 +- libavformat/movenc.h |5 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9c0f7a..60a9318 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1714,7 +1714,27 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_wb16(pb, track->enc->bits_per_coded_sample); else avio_wb16(pb, 0x18); /* Reserved */ -avio_wb16(pb, 0x); /* Reserved */ + +if (mov->is_unaligned_raw_rgb && +track->enc->bits_per_coded_sample >= 1 && track->enc->bits_per_coded_sample <= 8) { +int i; +int pal_size = 1 << track->enc->bits_per_coded_sample; +avio_wb16(pb, 0); /* Color table ID */ +avio_wb32(pb, 0); /* Color table seed */ +avio_wb16(pb, 0x8000);/* Color table flags */ +avio_wb16(pb, pal_size - 1); /* Color table size (zero-relative) */ +for (i = 0; i < pal_size; i++) { +uint16_t r = (mov->palette[i] >> 16) & 0xff; +uint16_t g = (mov->palette[i] >> 8) & 0xff; +uint16_t b = mov->palette[i] & 0xff; +avio_wb16(pb, 0); +avio_wb16(pb, (r << 8) | r); +avio_wb16(pb, (g << 8) | g); +avio_wb16(pb, (b << 8) | b); +} +} else +avio_wb16(pb, 0x); /* Color table ID, -1 for no or default palette */ + if (track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if (track->enc->codec_id == AV_CODEC_ID_H263) @@ -1777,6 +1797,8 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr if (avid) avio_wb32(pb, 0); +mov->pal_done = 0; + return update_size(pb, pos); } @@ -4703,6 +4725,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } else { int i; MOVMuxContext *mov = s->priv_data; +MOVTrack *trk = &mov->tracks[pkt->stream_index]; if (!pkt->size) return mov_write_single_packet(s, pkt); /* Passthrough. */ @@ -4739,6 +4762,50 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } +if (trk->enc->codec_type == AVMEDIA_TYPE_VIDEO) { +mov->is_unaligned_raw_rgb = +trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO && + (trk->enc->pix_fmt == AV_PIX_FMT_RGB24 || +trk->enc->pix_fmt == AV_PIX_FMT_BGR24 || +trk->enc->pix_fmt == AV_PIX_FMT_PAL8 || +trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || +trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE || +trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK); + +if (mov->is_unaligned_raw_rgb) { +const uint8_t *data = pkt->data; +int size = pkt->size; +int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16; +int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2; +int ret = ff_reshuffle_raw_rgb(s, &pkt, trk->enc, expected_stride); +if (ret < 0) +return ret; +if (!mov->pal_done) { +memset(mov->palette, 0, AVPALETTE_SIZE); +if (ret == CONTAINS_PAL) { +int pal_size = 1 << trk->enc->bits_per_coded_sample; +memcpy(mov->palette, data + size - 4*pal_size, 4*pal_size); +} else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8) { +/* Calculate 8 bpp grayscale palette */ +for (i = 0; i < 256; i++) +mov->palette[i] = (0xFFU << 24) | (i << 16) | (i << 8) | i; +} else if (trk->enc->bits_per_coded_sample == 1) { +/* Initialize 1 bpp palette to black & white */ +if (trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK) +mov->palette[1] = 0x; +else +mov->palette[0] = 0x; +} +mov->pal_done++; +} +if (ret) { +ret = mov_write_single_packet(s, pkt); +av_packet_free(&pkt); +return ret; +} +} +} + return mov_write_single_packet(s, pkt); } } diff --git a/libavfor
Re: [FFmpeg-devel] [PATCH] swscale/arm: re-enable neon rgbx to nv12 routines
On Mon, Feb 22, 2016 at 07:50:13PM +0800, Xiaolei Yu wrote: > Commit '842b8f4ba2e79b9c004a67f6fdb3d5c5d05805d3' fixed clang/iphone > build but failed on some versions of cygwin. It has now been verified > to work on both platforms. > --- > libswscale/arm/Makefile | 4 ++-- > libswscale/arm/swscale_unscaled.c | 4 > 2 files changed, 2 insertions(+), 6 deletions(-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [Bounty] Impl. check if input h264 P/B frame ref's frame prior to last I
As it was discussed today on #ffmpeg and #ffmpeg-devel, only IDR frames are considered safe seek points by design of H.264. H.264 has two kinds of pictures which are mapped to AV_PICTURE_TYPE_I: NAL_IDR_SLICE and some other NAL_SLICE. H.264 referencing is arbitrary and GOP concept is not strict, as jkqxz and Mavrik have explained. I my usecase, I need to be sure about slicing the file and not breaking any references. So some introspection of references would be nice, but for now just a programmatic test, or at last a warning from inside libavcodec's H.264 parser, about cross-GOP refs is fine, because in practice, per-GOP handling seems to be fine so far. This is not available at ffmpeg API level. The form of this work is a patch for upstream FFmpeg (upstreamable or not), or separate tool (but additional dependencies or high time/CPU overhead to run it are strongly undesired). Also, I am interested in any knowledge about applications which generate such files (with cross-GOP refs) in practice, because this request is about working around such case. Sharing sample media files is also appreciated. I am happy to fund this work. Feel free to reply on-list or off-list as you prefer. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] checkasm: bench each vf_blend mode once
On 2/22/2016 12:56 PM, Michael Niedermayer wrote: > On Sat, Feb 20, 2016 at 04:16:52PM -0300, James Almer wrote: >> Also test a smaller buffer. This drastically reduces --bench runtime >> and reports smaller, more readable numbers. >> >> Signed-off-by: James Almer >> --- >> tests/checkasm/vf_blend.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) > > should be ok Pushed, thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [Bounty] Impl. check if input h264 P/B frame ref's frame prior to last I
Andrey Utkin fastmail.com> writes: > As it was discussed today on #ffmpeg and #ffmpeg-devel, > only IDR frames are considered safe seek points by design > of H.264. Since valid H264 streams without IDR (and without I) frames exist, this cannot be true. Do I understand correctly that your issue is that FFmpeg doesn't tell you if an I-frame in an H264 stream is an IDR frame or not? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add firequalizer filter
On Fri, Feb 19, 2016 at 11:52 PM, Muhammad Faiz wrote: > On Fri, Feb 19, 2016 at 3:52 AM, Paul B Mahol wrote: >>> +center = s->fir_len / 2; >>> + >>> +for (k = 0; k <= center; k++) { >>> +double u = k * (M_PI/center); >>> +double win; >>> +switch (s->wfunc) { >>> +case WFUNC_RECTANGULAR: >>> +win = 1.0; >>> +break; >>> +case WFUNC_HANN: >>> +win = 0.5 + 0.5 * cos(u); >>> +break; >>> +case WFUNC_HAMMING: >>> +win = 0.53836 + 0.46164 * cos(u); >>> +break; >>> +case WFUNC_BLACKMAN: >>> +win = 0.48 + 0.5 * cos(u) + 0.02 * cos(2*u); >>> +break; >>> +case WFUNC_NUTTALL3: >>> +win = 0.40897 + 0.5 * cos(u) + 0.09103 * cos(2*u); >>> +break; >>> +case WFUNC_MNUTTALL3: >>> +win = 0.4243801 + 0.4973406 * cos(u) + 0.0782793 * >>> cos(2*u); >>> +break; >>> +case WFUNC_NUTTALL: >>> +win = 0.355768 + 0.487396 * cos(u) + 0.144232 * cos(2*u) + >>> 0.012604 * cos(3*u); >>> +break; >>> +case WFUNC_BNUTTALL: >>> +win = 0.3635819 + 0.4891775 * cos(u) + 0.1365995 * >>> cos(2*u) + 0.0106411 * cos(3*u); >>> +break; >>> +case WFUNC_BHARRIS: >>> +win = 0.35875 + 0.48829 * cos(u) + 0.14128 * cos(2*u) + >>> 0.01168 * cos(3*u); >>> +break; >> >> What about using libavfilter/window_func.c ? > > My version calculate half-length zero centered window. Incompatible > with ff_generate_window_func() > >> >> Still LGTM. Pushed Thank's ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [Bounty] Impl. check if input h264 P/B frame ref's frame prior to last I
On Mon, 22 Feb 2016 17:23:06 + (UTC) Carl Eugen Hoyos wrote: > Andrey Utkin fastmail.com> writes: > > > As it was discussed today on #ffmpeg and #ffmpeg-devel, > > only IDR frames are considered safe seek points by design > > of H.264. > > Since valid H264 streams without IDR (and without I) frames > exist, this cannot be true. Haven't heard of such streams, but let's take it granted. Why does it mean that above statement is false? If there's no IDR frames, then it is safe to assume that this stream has no seek points guaranteed to be valid (unless we introspect the references between frames). I don't see anything wrong with such statement. > Do I understand correctly that your issue is that FFmpeg > doesn't tell you if an I-frame in an H264 stream is an > IDR frame or not? Yes. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter/avf_showcqt: use lrint
Signed-off-by: Muhammad Faiz --- libavfilter/avf_showcqt.c | 90 +++ 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c index d4c6a74..023924f 100644 --- a/libavfilter/avf_showcqt.c +++ b/libavfilter/avf_showcqt.c @@ -441,19 +441,19 @@ static double midi(void *p, double f) static double r_func(void *p, double x) { x = av_clipd(x, 0.0, 1.0); -return (int)(x*255.0+0.5) << 16; +return lrint(x*255.0) << 16; } static double g_func(void *p, double x) { x = av_clipd(x, 0.0, 1.0); -return (int)(x*255.0+0.5) << 8; +return lrint(x*255.0) << 8; } static double b_func(void *p, double x) { x = av_clipd(x, 0.0, 1.0); -return (int)(x*255.0+0.5); +return lrint(x*255.0); } static int init_axis_color(ShowCQTContext *s, AVFrame *tmp) @@ -702,9 +702,9 @@ static void draw_bar_rgb(AVFrame *out, const float *h, const float *rcp_h, *lp++ = 0; } else { mul = (h[x] - ht) * rcp_h[x]; -*lp++ = mul * c[x].rgb.r + 0.5f; -*lp++ = mul * c[x].rgb.g + 0.5f; -*lp++ = mul * c[x].rgb.b + 0.5f; +*lp++ = lrintf(mul * c[x].rgb.r); +*lp++ = lrintf(mul * c[x].rgb.g); +*lp++ = lrintf(mul * c[x].rgb.b); } } } @@ -733,9 +733,9 @@ static void draw_bar_yuv(AVFrame *out, const float *h, const float *rcp_h, *lpv++ = 128; } else { mul = (h[x] - ht) * rcp_h[x]; -*lpy++ = mul * c[x].yuv.y + 16.5f; -*lpu++ = mul * c[x].yuv.u + 128.5f; -*lpv++ = mul * c[x].yuv.v + 128.5f; +*lpy++ = lrintf(mul * c[x].yuv.y + 16.0f); +*lpu++ = lrintf(mul * c[x].yuv.u + 128.0f); +*lpv++ = lrintf(mul * c[x].yuv.v + 128.0f); } /* u and v are skipped on yuv422p and yuv420p */ if (fmt == AV_PIX_FMT_YUV444P) { @@ -745,16 +745,16 @@ static void draw_bar_yuv(AVFrame *out, const float *h, const float *rcp_h, *lpv++ = 128; } else { mul = (h[x+1] - ht) * rcp_h[x+1]; -*lpy++ = mul * c[x+1].yuv.y + 16.5f; -*lpu++ = mul * c[x+1].yuv.u + 128.5f; -*lpv++ = mul * c[x+1].yuv.v + 128.5f; +*lpy++ = lrintf(mul * c[x+1].yuv.y + 16.0f); +*lpu++ = lrintf(mul * c[x+1].yuv.u + 128.0f); +*lpv++ = lrintf(mul * c[x+1].yuv.v + 128.0f); } } else { if (h[x+1] <= ht) { *lpy++ = 16; } else { mul = (h[x+1] - ht) * rcp_h[x+1]; -*lpy++ = mul * c[x+1].yuv.y + 16.5f; +*lpy++ = lrintf(mul * c[x+1].yuv.y + 16.0f); } } } @@ -772,16 +772,16 @@ static void draw_bar_yuv(AVFrame *out, const float *h, const float *rcp_h, *lpv++ = 128; } else { mul = (h[x] - ht) * rcp_h[x]; -*lpy++ = mul * c[x].yuv.y + 16.5f; -*lpu++ = mul * c[x].yuv.u + 128.5f; -*lpv++ = mul * c[x].yuv.v + 128.5f; +*lpy++ = lrintf(mul * c[x].yuv.y + 16.0f); +*lpu++ = lrintf(mul * c[x].yuv.u + 128.0f); +*lpv++ = lrintf(mul * c[x].yuv.v + 128.0f); } } else { if (h[x] <= ht) { *lpy++ = 16; } else { mul = (h[x] - ht) * rcp_h[x]; -*lpy++ = mul * c[x].yuv.y + 16.5f; +*lpy++ = lrintf(mul * c[x].yuv.y + 16.0f); } } /* u and v are skipped on yuv422p and yuv420p */ @@ -792,16 +792,16 @@ static void draw_bar_yuv(AVFrame *out, const float *h, const float *rcp_h, *lpv++ = 128; } else { mul = (h[x+1] - ht) * rcp_h[x+1]; -*lpy++ = mul * c[x+1].yuv.y + 16.5f; -*lpu++ = mul * c[x+1].yuv.u + 128.5f; -*lpv++ = mul * c[x+1].yuv.v + 128.5f; +*lpy++ = lrintf(mul * c[x+1].yuv.y + 16.0f); +*lpu++ = lrintf(mul * c[x+1].yuv.u + 128.0f); +*lpv++ = lrintf(mul * c[x+1].yuv.v + 128.0f); } } else { if (h[x+1] <= ht) { *lpy++ = 16; } else { mul = (h[x+1] - ht) * rcp_h[x+1]; -*lpy++ = mul * c[x+1].yuv.y + 16.5f; +*lpy++ = lrintf(mul * c[x+1].yuv.y + 16.0f); } } } @@ -819,9 +819,9 @@ static void draw_
Re: [FFmpeg-devel] [PATCH] IFF ANIM support
Hi, And check also this: http://www.randelshofer.ch/animapplet/ public class ANIMDeltaFrame extends ANIMFrame { private int leftBound, topBound, rightBound, bottomBound; private final static int // ENCODING_BYTE_VERTICAL = 5, ENCODING_VERTICAL_7_SHORT = 6, ENCODING_VERTICAL_7_LONG = 7, ENCODING_VERTICAL_8_SHORT = 8, ENCODING_VERTICAL_8_LONG = 9, ENCODING_J = 74; public final static int // OP_Direct = 0, OP_XOR = 1, OP_LongDelta = 2, OP_ShortDelta = 3, OP_GeneralDelta = 4, OP_ByteVertical = 5, OP_StereoDelta = 6, OP_Vertical7 = 7, OP_Vertical8 = 8, OP_J = 74; Regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [Bounty] Impl. check if input h264 P/B frame ref's frame prior to last I
On Mon, 22 Feb 2016 20:04:31 +0200 Andrey Utkin wrote: > On Mon, 22 Feb 2016 17:23:06 + (UTC) > Carl Eugen Hoyos wrote: > > Do I understand correctly that your issue is that FFmpeg > > doesn't tell you if an I-frame in an H264 stream is an > > IDR frame or not? > > Yes. However, considering the case of files with just one IDR in the very beginning of file, and short I-frame intervals, it would be convenient to be able slice the file on I-frames, just staying sure that there's no references across I-frames intervals. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [Bounty] Impl. check if input h264 P/B frame ref's frame prior to last I
Andrey Utkin fastmail.com> writes: > > On Mon, 22 Feb 2016 17:23:06 + (UTC) > Carl Eugen Hoyos ag.or.at> wrote: > > > Andrey Utkin fastmail.com> writes: > > > > > As it was discussed today on #ffmpeg and #ffmpeg-devel, > > > only IDR frames are considered safe seek points by design > > > of H.264. > > > > Since valid H264 streams without IDR (and without I) frames > > exist, this cannot be true. > > Haven't heard of such streams, but let's take it granted. Why does it > mean that above statement is false? If there's no IDR frames, then > it is safe to assume that this stream has no seek points guaranteed to > be valid (unless we introspect the references between frames). I don't > see anything wrong with such statement. Sorry for being unclear: Since valid, useful H264 streams with many ("safe") seek points but without I or IDR frames exist, the statement "only IDR frames are safe seek points" can't be true. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [Bounty] Impl. check if input h264 P/B frame ref's frame prior to last I
On Mon, 22 Feb 2016 20:22:30 + (UTC) Carl Eugen Hoyos wrote: > Andrey Utkin fastmail.com> writes: > > > > > On Mon, 22 Feb 2016 17:23:06 + (UTC) > > Carl Eugen Hoyos ag.or.at> wrote: > > > > > Andrey Utkin fastmail.com> writes: > > > > > > > As it was discussed today on #ffmpeg and #ffmpeg-devel, > > > > only IDR frames are considered safe seek points by design > > > > of H.264. > > > > > > Since valid H264 streams without IDR (and without I) frames > > > exist, this cannot be true. > > > > Haven't heard of such streams, but let's take it granted. Why does > > it mean that above statement is false? If there's no IDR frames, > > then it is safe to assume that this stream has no seek points > > guaranteed to be valid (unless we introspect the references between > > frames). I don't see anything wrong with such statement. > > Sorry for being unclear: > Since valid, useful H264 streams with many ("safe") seek points > but without I or IDR frames exist, the statement "only IDR frames > are safe seek points" can't be true. What it takes on libavformat API application level to figure out which non-I/non-IDR frame is safe to seek onto? See quoted above my phrase about introspection of references. Is it involved in what you are talking about? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [Bounty] Impl. check if input h264 P/B frame ref's frame prior to last I
2016-02-22 18:23 GMT+01:00 Carl Eugen Hoyos : > Do I understand correctly that your issue is that FFmpeg > doesn't tell you if an I-frame in an H264 stream is an > IDR frame or not? > Is this related to the fact that sometimes cutting streams on I-frames (or using the segment option) gives some pieces where the first few frames cannot be decoded? Best regards -- Andrea Lazzarotto http://andrealazzarotto.com http://lazza.dk ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [Bounty] Impl. check if input h264 P/B frame ref's frame prior to last I
On Mon, 22 Feb 2016 21:56:05 +0100 Andrea Lazzarotto wrote: > 2016-02-22 18:23 GMT+01:00 Carl Eugen Hoyos : > > > Do I understand correctly that your issue is that FFmpeg > > doesn't tell you if an I-frame in an H264 stream is an > > IDR frame or not? > > > > Is this related to the fact that sometimes cutting streams on > I-frames (or using the segment option) gives some pieces where the > first few frames cannot be decoded? > > Best regards > Not sure whom you are asking, but yes, this is related. In yet other words, it is about defining bounds on which the temporal piece of H.264 video can be cut out and correctly decoded/played without any additional data. With ultimate correctness. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [Bounty] Impl. check if input h264 P/B frame ref's frame prior to last I
2016-02-22 22:02 GMT+01:00 Andrey Utkin : > In yet other words, it is about defining bounds on which the temporal > piece of H.264 video can be cut out and correctly decoded/played without > any additional data. With ultimate correctness. > Ah, I see. Coincidentally, during these days I made a Python script for smart rendering (using ffmpeg, and re-rendering only GOPs that I was splitting) and I was wondering why it was working sometimes ok and sometimes completely wrong. I am not an expert, but I deduce this might be the reason. I read somewhere that ffmpeg can use the "select" filter (if it is called like that) that can distinguish between I frames and "SI" frames and that only I frames shall be considered "safe". Is that the problem or is it a different one? Best regards -- Andrea Lazzarotto http://andrealazzarotto.com http://lazza.dk ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/avf_showcqt: use lrint
On Tue, Feb 23, 2016 at 01:25:56AM +0700, Muhammad Faiz wrote: > Signed-off-by: Muhammad Faiz > --- > libavfilter/avf_showcqt.c | 90 > +++ > 1 file changed, 45 insertions(+), 45 deletions(-) LGTM thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] x86/dcadec: add ff_lfe_fir1_float_{sse3, avx}
Signed-off-by: James Almer --- libavcodec/x86/dcadsp.asm| 86 libavcodec/x86/dcadsp_init.c | 9 - 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/libavcodec/x86/dcadsp.asm b/libavcodec/x86/dcadsp.asm index fb13957..bea834f 100644 --- a/libavcodec/x86/dcadsp.asm +++ b/libavcodec/x86/dcadsp.asm @@ -201,3 +201,89 @@ LFE_FIR0_FLOAT INIT_XMM fma3 LFE_FIR0_FLOAT %endif + +%macro LFE_FIR1_FLOAT 0 +cglobal lfe_fir1_float, 4, 6, 10, samples, lfe, coeff, nblocks, cnt1, cnt2 +shr nblocksd, 2 +sub lfeq, 3*sizeof_float +movcnt1d, 64*sizeof_float +movcnt2d, 64*sizeof_float-16 +lea coeffq, [coeffq+cnt1q*4] +add samplesq, cnt1q +negcnt1q + +.loop: +%if cpuflag(avx) +cvtdq2ps m4, [lfeq] +shufpsm5, m4, m4, q0123 +%elif cpuflag(sse2) +movu m4, [lfeq] +cvtdq2ps m4, m4 +pshufdm5, m4, q0123 +%endif + +.inner_loop: +%if ARCH_X86_64 +movapsm6, [coeffq+cnt1q*4 ] +movapsm7, [coeffq+cnt1q*4+16] +movapsm8, [coeffq+cnt1q*4+32] +movapsm9, [coeffq+cnt1q*4+48] +mulps m0, m5, m6 +mulps m1, m5, m7 +mulps m2, m5, m8 +mulps m3, m5, m9 +%else +movapsm6, [coeffq+cnt1q*4 ] +movapsm7, [coeffq+cnt1q*4+16] +mulps m0, m5, m6 +mulps m1, m5, m7 +mulps m2, m5, [coeffq+cnt1q*4+32] +mulps m3, m5, [coeffq+cnt1q*4+48] +%endif + +haddpsm0, m1 +haddpsm2, m3 +haddpsm0, m2 +movaps [samplesq+cnt1q], m0 + +%if ARCH_X86_64 +mulps m6, m4 +mulps m7, m4 +mulps m8, m4 +mulps m9, m4 + +haddpsm6, m7 +haddpsm8, m9 +haddpsm6, m8 +movaps [samplesq+cnt2q], m6 +%else +mulps m6, m4 +mulps m7, m4 +mulps m2, m4, [coeffq+cnt1q*4+32] +mulps m3, m4, [coeffq+cnt1q*4+48] + +haddpsm6, m7 +haddpsm2, m3 +haddpsm6, m2 +movaps [samplesq+cnt2q], m6 +%endif + +subcnt2d, 16 +addcnt1q, 16 +jl .inner_loop + +add lfeq, sizeof_float +add samplesq, 128*sizeof_float +movcnt1q, -64*sizeof_float +movcnt2d, 64*sizeof_float-16 +sub nblocksd, 1 +jg .loop +RET +%endmacro + +INIT_XMM sse3 +LFE_FIR1_FLOAT +%if HAVE_AVX_EXTERNAL +INIT_XMM avx +LFE_FIR1_FLOAT +%endif diff --git a/libavcodec/x86/dcadsp_init.c b/libavcodec/x86/dcadsp_init.c index bfe13e5..fc10fb8 100644 --- a/libavcodec/x86/dcadsp_init.c +++ b/libavcodec/x86/dcadsp_init.c @@ -23,10 +23,13 @@ #define LFE_FIR_FLOAT_FUNC(opt) \ void ff_lfe_fir0_float_##opt(float *pcm_samples, int32_t *lfe_samples, \ + const float *filter_coeff, ptrdiff_t npcmblocks); \ +void ff_lfe_fir1_float_##opt(float *pcm_samples, int32_t *lfe_samples, \ const float *filter_coeff, ptrdiff_t npcmblocks); LFE_FIR_FLOAT_FUNC(sse) LFE_FIR_FLOAT_FUNC(sse2) +LFE_FIR_FLOAT_FUNC(sse3) LFE_FIR_FLOAT_FUNC(avx) LFE_FIR_FLOAT_FUNC(fma3) @@ -38,8 +41,12 @@ av_cold void ff_dcadsp_init_x86(DCADSPContext *s) s->lfe_fir_float[0] = ff_lfe_fir0_float_sse; if (EXTERNAL_SSE2(cpu_flags)) s->lfe_fir_float[0] = ff_lfe_fir0_float_sse2; -if (EXTERNAL_AVX(cpu_flags)) +if (EXTERNAL_SSE3(cpu_flags)) +s->lfe_fir_float[1] = ff_lfe_fir1_float_sse3; +if (EXTERNAL_AVX(cpu_flags)) { s->lfe_fir_float[0] = ff_lfe_fir0_float_avx; +s->lfe_fir_float[1] = ff_lfe_fir1_float_avx; +} if (EXTERNAL_FMA3(cpu_flags)) s->lfe_fir_float[0] = ff_lfe_fir0_float_fma3; } -- 2.7.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [Bounty] Impl. check if input h264 P/B frame ref's frame prior to last I
On Mon, 22 Feb 2016 22:11:37 +0100 Andrea Lazzarotto wrote: > 2016-02-22 22:02 GMT+01:00 Andrey Utkin : > > > In yet other words, it is about defining bounds on which the > > temporal piece of H.264 video can be cut out and correctly > > decoded/played without any additional data. With ultimate > > correctness. > > Ah, I see. Coincidentally, during these days I made a Python script > for smart rendering (using ffmpeg, and re-rendering only GOPs that I > was splitting) and I was wondering why it was working sometimes ok and > sometimes completely wrong. > > I am not an expert, but I deduce this might be the reason. > > I read somewhere that ffmpeg can use the "select" filter (if it is > called like that) that can distinguish between I frames and "SI" > frames and that only I frames shall be considered "safe". Is that the > problem or is it a different one? > > Best regards > "select" filter is needed if what you really want to do is to filter and process the filtered frames. What both me an probably also you are trying to do is to handle frames conveniently without resorting to reencoding. So only demuxing, parsing and decoding is what we would want to use. I cannot describe the problem better than the helpful #ffmpeg-devel inhabitants. I hope the following quote of our IRC conversations helps. [13:25:55] andrey_utkin: so is it safe to assume that GOPs (I-frame + all following non-I-frames sequence) are self-contained and can be replaced? Or this is true only in terms of "IDR-frame + all following non-IDR-frames sequence"? [13:26:50] Mavrik: Only true in terms of IDR frames. [13:27:05] Mavrik: Frames that follow an IDR frame may not reference frame before an IDR frame. [13:27:31] jkqxz: No. There still might be something after another I frame which references something in the section you've removed. [13:27:56] jkqxz: (Unless the end of the section is also at an IDR frame.) [13:29:06] jkqxz: That is, you can have exactly the same problem as you initially described at the end as well as at the beginning. [13:29:14] Mavrik: Indeed. [13:29:24] Mavrik: So essentially you slice on IDR boundaries. [13:30:00] jkqxz: (And you aren't saved by decode order, because the problematic frame is after the next I frame in decode order but before in display order.) [13:34:08] andrey_utkin: ok so the problem is actually about P/B frames which may reference previous GOPs? [13:34:56] Mavrik: "GOP" is a useless distinction when dealing with H.264 streams. [13:35:12] jkqxz: If you have a well-defined GOP structure, yes. (The problem is really that H.264 allows arbitrary referencing and there isn't any external information to work out what's going on.) [13:35:17] Mavrik: All the references care about is frame count and existence of IDR frames. [13:35:44] Mavrik: Usually a GOP is bounded by a pair of IDR frames, but static GOPs aren't really a thing. Another helpful person shared another bit of knowledge on #x264: [22:51:25] Gramner: being able to seek to a frame doesn't imply you can cut on it. there's stuff like SEI recovery points as well, not just IDR-frames [22:54:33] Gramner: see https://ffmpeg.org/pipermail/ffmpeg-devel/2009-December/062957.html and https://git.videolan.org/?p=x264.git;a=commit;h=cde39046222b112261179144033e7a51430783d0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [Bounty] Impl. check if input h264 P/B frame ref's frame prior to last I
> > "select" filter is needed if what you really want to do is to filter > and process the filtered frames. > What both me an probably also you are trying to do is to handle frames > conveniently without resorting to reencoding. So only demuxing, parsing > and decoding is what we would want to use. Yes, sorry. What I was trying to say is: if ffmpeg has some filter that distinguishes between I frames and SI frames or other kinds of frames, I believe it should also be able to distinguish IDR frames, therefore *probably* it wouldn't be that hard to implement. Best regards -- Andrea Lazzarotto http://andrealazzarotto.com http://lazza.dk ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH]lavfi/nnedi: Fix a memleak
Hi! Attached patch fixes a small memleak for me when using the nnedi filter. Please comment, Carl Eugen diff --git a/libavfilter/vf_nnedi.c b/libavfilter/vf_nnedi.c index 330d3d6..b14aa64 100644 --- a/libavfilter/vf_nnedi.c +++ b/libavfilter/vf_nnedi.c @@ -1173,6 +1173,7 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&s->frame_data.input); av_freep(&s->frame_data.temp); +av_freep(&s->fdsp); av_frame_free(&s->second); } ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH]lavfi/nnedi: Fix a compilation warning
Hi! Attached patch fixes the following warning for me when compiling nnedi: libavfilter/vf_nnedi.c:611:15: warning: assignment discards ‘const’ qualifier from pointer target type Please comment, Carl Eugen diff --git a/libavfilter/vf_nnedi.c b/libavfilter/vf_nnedi.c index 330d3d6..b14aa64 100644 --- a/libavfilter/vf_nnedi.c +++ b/libavfilter/vf_nnedi.c @@ -601,7 +601,7 @@ static void evalfunc_1(NNEDIContext *s, FrameData *frame_data) const int ystart = frame_data->field[plane]; const int ystop = height - 12; -uint8_t *srcpp; +const uint8_t *srcpp; if (!(s->process_plane & (1 << plane))) continue; ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [Bounty] Impl. check if input h264 P/B frame ref's frame prior to last I
Andrey Utkin fastmail.com> writes: > > Since valid, useful H264 streams with many ("safe") seek > > points but without I or IDR frames exist, the statement > > "only IDR frames are safe seek points" can't be true. > > What it takes on libavformat API application level > to figure out which non-I/non-IDR frame is safe to > seek onto? I may miss something but by default, seeking in H264 streams (no matter if they contain IDR frames or not) with libavformat guarantees to provide a complete frame as first frame after seeking. There is an option to also show the corrupted frames. > See quoted above my phrase about introspection of > references. Is it involved in what you are talking > about? I have never heard the term "introspection of references", sorry. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] x86/dcadec: add ff_lfe_fir1_float_{sse3, avx}
Hi, 2016-02-22 22:43 GMT+01:00 James Almer : > +.loop: > +%if cpuflag(avx) > +cvtdq2ps m4, [lfeq] > +shufpsm5, m4, m4, q0123 > +%elif cpuflag(sse2) > +movu m4, [lfeq] > +cvtdq2ps m4, m4 > +pshufdm5, m4, q0123 > +%endif > + > +.inner_loop: > +%if ARCH_X86_64 > +movapsm6, [coeffq+cnt1q*4 ] > +movapsm7, [coeffq+cnt1q*4+16] > +movapsm8, [coeffq+cnt1q*4+32] > +movapsm9, [coeffq+cnt1q*4+48] > +mulps m0, m5, m6 > +mulps m1, m5, m7 > +mulps m2, m5, m8 > +mulps m3, m5, m9 > +%else > +movapsm6, [coeffq+cnt1q*4 ] > +movapsm7, [coeffq+cnt1q*4+16] > +mulps m0, m5, m6 > +mulps m1, m5, m7 > +mulps m2, m5, [coeffq+cnt1q*4+32] > +mulps m3, m5, [coeffq+cnt1q*4+48] > +%endif Is OOE the reason why you don't move the common code out of those conditional blocks? Otherwise, it looks cleaner to me to do: movapsm6, [coeffq+cnt1q*4 ] movapsm7, [coeffq+cnt1q*4+16] mulps m0, m3, m6 mulps m1, m3, m7 %if ARCH_X86_64 movapsm8, [coeffq+cnt1q*4+32] movapsm9, [coeffq+cnt1q*4+48] mulps m2, m5, m8 mulps m3, m5, m9 %else mulps m2, m5, [coeffq+cnt1q*4+32] mulps m3, m5, [coeffq+cnt1q*4+48] %endif and let OOE do its job. Secondly, m5 is not reused afterwards, so maybe replace m5 by m3 for all code up to this, and load something into m5 instead? > +haddpsm0, m1 > +haddpsm2, m3 > +haddpsm0, m2 > +movaps [samplesq+cnt1q], m0 I suppose you've already looked at most arrangements that would help doing fewer shuffles. And I don't see any obvious one either. -- Christophe ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] web: "news" about FFmpeg 3.0
Found-by: Ganesh Ajjanagadde --- src/index |9 + 1 file changed, 9 insertions(+) diff --git a/src/index b/src/index index 827d803..840ed10 100644 --- a/src/index +++ b/src/index @@ -37,6 +37,15 @@ News + February 15th, 2016, FFmpeg 3.0 + +We have made a new major releases (3.0). + + +We recommend users, distributors and system integrators to upgrade unless they use +current git master. + + January 30, 2016, Removing support for two external AAC encoders We have just removed support for VisualOn AAC encoder (libvo-aacenc) and -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] web: "news" about FFmpeg 3.0
On Mon, Feb 22, 2016 at 11:45:43PM +0100, Michael Niedermayer wrote: > Found-by: Ganesh Ajjanagadde > --- > src/index |9 + > 1 file changed, 9 insertions(+) > > diff --git a/src/index b/src/index > index 827d803..840ed10 100644 > --- a/src/index > +++ b/src/index > @@ -37,6 +37,15 @@ > News > > > + February 15th, 2016, FFmpeg 3.0 > + > +We have made a new major releases ( href="download.html#release_3.0">3.0). > + > + > +We recommend users, distributors and system integrators to upgrade > unless they use > +current git master. > + > + Please, can we had slightly more information about that release? I think the main highlights are: - The API/ABI break (implied by the major bump) - The many improvements in the native AAC encoder making it the recommended one (libaacplus and libvo-aacenc are removed) - A ton of filters were added - Many ASM optimizations that weren't mentioned in the Changelog (I don't remember them) ... other developers will probably want to point out a few more things. -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] IFF ANIM support
On 2/22/16, Piotr Bandurski wrote: > Hi, > > And check also this: > > http://www.randelshofer.ch/animapplet/ > > public class ANIMDeltaFrame > extends ANIMFrame { > > private int leftBound, topBound, rightBound, bottomBound; > private final static int // > ENCODING_BYTE_VERTICAL = 5, > ENCODING_VERTICAL_7_SHORT = 6, > ENCODING_VERTICAL_7_LONG = 7, > ENCODING_VERTICAL_8_SHORT = 8, > ENCODING_VERTICAL_8_LONG = 9, > ENCODING_J = 74; > public final static int // > OP_Direct = 0, > OP_XOR = 1, > OP_LongDelta = 2, > OP_ShortDelta = 3, > OP_GeneralDelta = 4, > OP_ByteVertical = 5, > OP_StereoDelta = 6, > OP_Vertical7 = 7, > OP_Vertical8 = 8, > OP_J = 74; Not sure this one decodes OP_J for BoingThrows correctly. The only one which correctly decodes is xanim. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavfi/nnedi: Fix a memleak
On 2/22/16, Carl Eugen Hoyos wrote: > Hi! > > Attached patch fixes a small memleak for me when using the nnedi filter. > > Please comment, Carl Eugen > ok ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libavcodec:add packet level support for mastering metadata
Some containers, like webm/mkv, will contain this mastering metadata. This is analogous to the way 3D fpa data is handled (in frame and packet side data). Signed-off-by: Neil Birkbeck --- libavcodec/avcodec.h | 7 +++ libavcodec/avpacket.c | 33 + libavcodec/utils.c| 9 + libavcodec/version.h | 2 +- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index d849765..313f660 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1403,6 +1403,13 @@ enum AVPacketSideDataType { * side data includes updated metadata which appeared in the stream. */ AV_PKT_DATA_METADATA_UPDATE, + +/** + * Mastering display metadata (based on SMPTE-2086:2014). This metadata + * should be associated with a video stream and containts data in the form + * of the AVMasteringDisplayMetadata struct. + */ +AV_PKT_DATA_MASTERING_DISPLAY_METADATA }; #define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 4901d36..a2e077a 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -335,22 +335,23 @@ uint8_t *av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, const char *av_packet_side_data_name(enum AVPacketSideDataType type) { switch(type) { -case AV_PKT_DATA_PALETTE: return "Palette"; -case AV_PKT_DATA_NEW_EXTRADATA: return "New Extradata"; -case AV_PKT_DATA_PARAM_CHANGE: return "Param Change"; -case AV_PKT_DATA_H263_MB_INFO: return "H263 MB Info"; -case AV_PKT_DATA_REPLAYGAIN:return "Replay Gain"; -case AV_PKT_DATA_DISPLAYMATRIX: return "Display Matrix"; -case AV_PKT_DATA_STEREO3D: return "Stereo 3D"; -case AV_PKT_DATA_AUDIO_SERVICE_TYPE:return "Audio Service Type"; -case AV_PKT_DATA_SKIP_SAMPLES: return "Skip Samples"; -case AV_PKT_DATA_JP_DUALMONO: return "JP Dual Mono"; -case AV_PKT_DATA_STRINGS_METADATA: return "Strings Metadata"; -case AV_PKT_DATA_SUBTITLE_POSITION: return "Subtitle Position"; -case AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL: return "Matroska BlockAdditional"; -case AV_PKT_DATA_WEBVTT_IDENTIFIER: return "WebVTT ID"; -case AV_PKT_DATA_WEBVTT_SETTINGS: return "WebVTT Settings"; -case AV_PKT_DATA_METADATA_UPDATE: return "Metadata Update"; +case AV_PKT_DATA_PALETTE:return "Palette"; +case AV_PKT_DATA_NEW_EXTRADATA: return "New Extradata"; +case AV_PKT_DATA_PARAM_CHANGE: return "Param Change"; +case AV_PKT_DATA_H263_MB_INFO: return "H263 MB Info"; +case AV_PKT_DATA_REPLAYGAIN: return "Replay Gain"; +case AV_PKT_DATA_DISPLAYMATRIX: return "Display Matrix"; +case AV_PKT_DATA_STEREO3D: return "Stereo 3D"; +case AV_PKT_DATA_AUDIO_SERVICE_TYPE: return "Audio Service Type"; +case AV_PKT_DATA_SKIP_SAMPLES: return "Skip Samples"; +case AV_PKT_DATA_JP_DUALMONO:return "JP Dual Mono"; +case AV_PKT_DATA_STRINGS_METADATA: return "Strings Metadata"; +case AV_PKT_DATA_SUBTITLE_POSITION: return "Subtitle Position"; +case AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL: return "Matroska BlockAdditional"; +case AV_PKT_DATA_WEBVTT_IDENTIFIER: return "WebVTT ID"; +case AV_PKT_DATA_WEBVTT_SETTINGS:return "WebVTT Settings"; +case AV_PKT_DATA_METADATA_UPDATE:return "Metadata Update"; +case AV_PKT_DATA_MASTERING_DISPLAY_METADATA: return "Mastering display metadata"; } return NULL; } diff --git a/libavcodec/utils.c b/libavcodec/utils.c index f532824..c538ecb 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -754,10 +754,11 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame) enum AVPacketSideDataType packet; enum AVFrameSideDataType frame; } sd[] = { -{ AV_PKT_DATA_REPLAYGAIN , AV_FRAME_DATA_REPLAYGAIN }, -{ AV_PKT_DATA_DISPLAYMATRIX, AV_FRAME_DATA_DISPLAYMATRIX }, -{ AV_PKT_DATA_STEREO3D, AV_FRAME_DATA_STEREO3D }, -{ AV_PKT_DATA_AUDIO_SERVICE_TYPE, AV_FRAME_DATA_AUDIO_SERVICE_TYPE }, +{ AV_PKT_DATA_REPLAYGAIN ,AV_FRAME_DATA_REPLAYGAIN }, +{ AV_PKT_DATA_DISPLAYMATRIX, AV_FRAME_DATA_DISPLAYMATRIX }, +{ AV_PKT_DATA_STEREO3D, AV_FRAME_DATA_STEREO3D }, +{ AV_PKT_DATA_AUDIO_SERVICE_TYPE, AV_FRAME_DATA_AUDIO_SERVICE_TYPE }, +{ AV_PKT_DATA_MASTERING_DISPLAY_METADATA, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA }, }; if (pkt) { diff --git a/libavcodec/version.h b/libavcodec/version.
Re: [FFmpeg-devel] [PATCH] web: "news" about FFmpeg 3.0
On Mon, Feb 22, 2016 at 11:48:28PM +0100, Clément Bœsch wrote: > On Mon, Feb 22, 2016 at 11:45:43PM +0100, Michael Niedermayer wrote: > > Found-by: Ganesh Ajjanagadde > > --- > > src/index |9 + > > 1 file changed, 9 insertions(+) > > > > diff --git a/src/index b/src/index > > index 827d803..840ed10 100644 > > --- a/src/index > > +++ b/src/index > > @@ -37,6 +37,15 @@ > > News > > > > > > + February 15th, 2016, FFmpeg 3.0 > > + > > +We have made a new major releases ( > href="download.html#release_3.0">3.0). > > + > > + > > +We recommend users, distributors and system integrators to upgrade > > unless they use > > +current git master. > > + > > + > > Please, can we had slightly more information about that release? > > I think the main highlights are: > > - The API/ABI break (implied by the major bump) > - The many improvements in the native AAC encoder making it the > recommended one (libaacplus and libvo-aacenc are removed) > - A ton of filters were added > - Many ASM optimizations that weren't mentioned in the Changelog (I don't > remember them) > > ... other developers will probably want to point out a few more things. sure as long as someone who can speak english well writes it [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have never wished to cater to the crowd; for what I know they do not approve, and what they approve I do not know. -- Epicurus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavfi/nnedi: Fix a compilation warning
On 2/22/16, Carl Eugen Hoyos wrote: > Hi! > > Attached patch fixes the following warning for me when compiling nnedi: > libavfilter/vf_nnedi.c:611:15: warning: assignment discards `const' > qualifier > from pointer target type > > Please comment, Carl Eugen > ok ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] x86/dcadec: add ff_lfe_fir1_float_{sse3, avx}
On 2/22/2016 7:44 PM, Christophe Gisquet wrote: > Hi, > > 2016-02-22 22:43 GMT+01:00 James Almer : >> +.loop: >> +%if cpuflag(avx) >> +cvtdq2ps m4, [lfeq] >> +shufpsm5, m4, m4, q0123 >> +%elif cpuflag(sse2) >> +movu m4, [lfeq] >> +cvtdq2ps m4, m4 >> +pshufdm5, m4, q0123 >> +%endif >> + >> +.inner_loop: >> +%if ARCH_X86_64 >> +movapsm6, [coeffq+cnt1q*4 ] >> +movapsm7, [coeffq+cnt1q*4+16] >> +movapsm8, [coeffq+cnt1q*4+32] >> +movapsm9, [coeffq+cnt1q*4+48] >> +mulps m0, m5, m6 >> +mulps m1, m5, m7 >> +mulps m2, m5, m8 >> +mulps m3, m5, m9 >> +%else >> +movapsm6, [coeffq+cnt1q*4 ] >> +movapsm7, [coeffq+cnt1q*4+16] >> +mulps m0, m5, m6 >> +mulps m1, m5, m7 >> +mulps m2, m5, [coeffq+cnt1q*4+32] >> +mulps m3, m5, [coeffq+cnt1q*4+48] >> +%endif > > Is OOE the reason why you don't move the common code out of those > conditional blocks? Otherwise, it looks cleaner to me to do: Not really. I just thought having x86_64 and X86_32 clearly separated was easier to read. > movapsm6, [coeffq+cnt1q*4 ] > movapsm7, [coeffq+cnt1q*4+16] > mulps m0, m3, m6 > mulps m1, m3, m7 > %if ARCH_X86_64 > movapsm8, [coeffq+cnt1q*4+32] > movapsm9, [coeffq+cnt1q*4+48] > mulps m2, m5, m8 > mulps m3, m5, m9 > %else > mulps m2, m5, [coeffq+cnt1q*4+32] > mulps m3, m5, [coeffq+cnt1q*4+48] > %endif > and let OOE do its job. > > Secondly, m5 is not reused afterwards, so maybe replace m5 by m3 for > all code up to this, and load something into m5 instead? m5 and m4 contain the lfe samples. I can't reuse them inside the inner loop. > >> +haddpsm0, m1 >> +haddpsm2, m3 >> +haddpsm0, m2 >> +movaps [samplesq+cnt1q], m0 > > I suppose you've already looked at most arrangements that would help > doing fewer shuffles. And I don't see any obvious one either. > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [Bounty] Impl. check if input h264 P/B frame ref's frame prior to last I
On Mon, Feb 22, 2016 at 11:40 PM, Carl Eugen Hoyos wrote: > Andrey Utkin fastmail.com> writes: > >> > Since valid, useful H264 streams with many ("safe") seek >> > points but without I or IDR frames exist, the statement >> > "only IDR frames are safe seek points" can't be true. >> >> What it takes on libavformat API application level >> to figure out which non-I/non-IDR frame is safe to >> seek onto? > > I may miss something but by default, seeking in H264 > streams (no matter if they contain IDR frames or not) > with libavformat guarantees to provide a complete > frame as first frame after seeking. > There is an option to also show the corrupted frames. avformat makes no such guarantees, avformat depends on the container having appropriate keyframe hints. avcodec will suppress any corrupted frames after decoding until bitstream "recovery", which could be an IDR, intra refresh, or what have you. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] x86/dcadec: add ff_lfe_fir1_float_{sse3, avx}
Signed-off-by: James Almer --- libavcodec/x86/dcadsp.asm| 79 libavcodec/x86/dcadsp_init.c | 9 - 2 files changed, 87 insertions(+), 1 deletion(-) diff --git a/libavcodec/x86/dcadsp.asm b/libavcodec/x86/dcadsp.asm index fb13957..c5bf21a 100644 --- a/libavcodec/x86/dcadsp.asm +++ b/libavcodec/x86/dcadsp.asm @@ -201,3 +201,82 @@ LFE_FIR0_FLOAT INIT_XMM fma3 LFE_FIR0_FLOAT %endif + +%macro LFE_FIR1_FLOAT 0 +cglobal lfe_fir1_float, 4, 6, 10, samples, lfe, coeff, nblocks, cnt1, cnt2 +shr nblocksd, 2 +sub lfeq, 3*sizeof_float +movcnt1d, 64*sizeof_float +movcnt2d, 64*sizeof_float-16 +lea coeffq, [coeffq+cnt1q*4] +add samplesq, cnt1q +negcnt1q + +.loop: +%if cpuflag(avx) +cvtdq2ps m4, [lfeq] +shufpsm5, m4, m4, q0123 +%elif cpuflag(sse2) +movu m4, [lfeq] +cvtdq2ps m4, m4 +pshufdm5, m4, q0123 +%endif + +.inner_loop: +movapsm6, [coeffq+cnt1q*4 ] +movapsm7, [coeffq+cnt1q*4+16] +mulps m0, m5, m6 +mulps m1, m5, m7 +%if ARCH_X86_64 +movapsm8, [coeffq+cnt1q*4+32] +movapsm9, [coeffq+cnt1q*4+48] +mulps m2, m5, m8 +mulps m3, m5, m9 +%else +mulps m2, m5, [coeffq+cnt1q*4+32] +mulps m3, m5, [coeffq+cnt1q*4+48] +%endif + +haddpsm0, m1 +haddpsm2, m3 +haddpsm0, m2 +movaps [samplesq+cnt1q], m0 + +mulps m6, m4 +mulps m7, m4 +%if ARCH_X86_64 +mulps m8, m4 +mulps m9, m4 + +haddpsm6, m7 +haddpsm8, m9 +haddpsm6, m8 +%else +mulps m2, m4, [coeffq+cnt1q*4+32] +mulps m3, m4, [coeffq+cnt1q*4+48] + +haddpsm6, m7 +haddpsm2, m3 +haddpsm6, m2 +%endif +movaps [samplesq+cnt2q], m6 + +subcnt2d, 16 +addcnt1q, 16 +jl .inner_loop + +add lfeq, sizeof_float +add samplesq, 128*sizeof_float +movcnt1q, -64*sizeof_float +movcnt2d, 64*sizeof_float-16 +sub nblocksd, 1 +jg .loop +RET +%endmacro + +INIT_XMM sse3 +LFE_FIR1_FLOAT +%if HAVE_AVX_EXTERNAL +INIT_XMM avx +LFE_FIR1_FLOAT +%endif diff --git a/libavcodec/x86/dcadsp_init.c b/libavcodec/x86/dcadsp_init.c index bfe13e5..fc10fb8 100644 --- a/libavcodec/x86/dcadsp_init.c +++ b/libavcodec/x86/dcadsp_init.c @@ -23,10 +23,13 @@ #define LFE_FIR_FLOAT_FUNC(opt) \ void ff_lfe_fir0_float_##opt(float *pcm_samples, int32_t *lfe_samples, \ + const float *filter_coeff, ptrdiff_t npcmblocks); \ +void ff_lfe_fir1_float_##opt(float *pcm_samples, int32_t *lfe_samples, \ const float *filter_coeff, ptrdiff_t npcmblocks); LFE_FIR_FLOAT_FUNC(sse) LFE_FIR_FLOAT_FUNC(sse2) +LFE_FIR_FLOAT_FUNC(sse3) LFE_FIR_FLOAT_FUNC(avx) LFE_FIR_FLOAT_FUNC(fma3) @@ -38,8 +41,12 @@ av_cold void ff_dcadsp_init_x86(DCADSPContext *s) s->lfe_fir_float[0] = ff_lfe_fir0_float_sse; if (EXTERNAL_SSE2(cpu_flags)) s->lfe_fir_float[0] = ff_lfe_fir0_float_sse2; -if (EXTERNAL_AVX(cpu_flags)) +if (EXTERNAL_SSE3(cpu_flags)) +s->lfe_fir_float[1] = ff_lfe_fir1_float_sse3; +if (EXTERNAL_AVX(cpu_flags)) { s->lfe_fir_float[0] = ff_lfe_fir0_float_avx; +s->lfe_fir_float[1] = ff_lfe_fir1_float_avx; +} if (EXTERNAL_FMA3(cpu_flags)) s->lfe_fir_float[0] = ff_lfe_fir0_float_fma3; } -- 2.7.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] x86/dcadec: add ff_lfe_fir1_float_{sse3, avx}
On 2/22/2016 8:02 PM, James Almer wrote: > Signed-off-by: James Almer > --- > libavcodec/x86/dcadsp.asm| 79 > > libavcodec/x86/dcadsp_init.c | 9 - > 2 files changed, 87 insertions(+), 1 deletion(-) The FATE suit doesn't cover this function. The only sample i've found so far is https://trac.ffmpeg.org/raw-attachment/ticket/3550/WorstCase.wav ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] x86/dcadec: add ff_lfe_fir1_float_{sse3, avx}
Hi, > +.inner_loop: Given this precludes reusing m5, then I don't have anything more to comment, and seems ok. -- Christophe ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] web: "news" about FFmpeg 3.0
On Mon, Feb 22, 2016 at 5:48 PM, Clément Bœsch wrote: > > On Mon, Feb 22, 2016 at 11:45:43PM +0100, Michael Niedermayer wrote: > > Found-by: Ganesh Ajjanagadde > > --- > > src/index |9 + > > 1 file changed, 9 insertions(+) > > > > diff --git a/src/index b/src/index > > index 827d803..840ed10 100644 > > --- a/src/index > > +++ b/src/index > > @@ -37,6 +37,15 @@ > > News > > > > > > + February 15th, 2016, FFmpeg 3.0 > > + > > +We have made a new major releases ( > href="download.html#release_3.0">3.0). > > + > > + > > +We recommend users, distributors and system integrators to upgrade > > unless they use > > +current git master. > > + > > + > > Please, can we had slightly more information about that release? > > I think the main highlights are: > > - The API/ABI break (implied by the major bump) > - The many improvements in the native AAC encoder making it the > recommended one (libaacplus and libvo-aacenc are removed) > - A ton of filters were added > - Many ASM optimizations that weren't mentioned in the Changelog (I don't > remember them) vf_blend had some significant work from Timothy Gu that I believe made it into the release. > > ... other developers will probably want to point out a few more things. I again don't know if it is worthwhile, but dynaudnorm is now available on MSVC 2012 and earlier due to an erf fallback I introduced. > > -- > Clément B. > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] web: "news" about FFmpeg 3.0
On Tue, Feb 23, 2016 at 12:16 AM, Ganesh Ajjanagadde wrote: > On Mon, Feb 22, 2016 at 5:48 PM, Clément Bœsch wrote: >> >> On Mon, Feb 22, 2016 at 11:45:43PM +0100, Michael Niedermayer wrote: >> > Found-by: Ganesh Ajjanagadde >> > --- >> > src/index |9 + >> > 1 file changed, 9 insertions(+) >> > >> > diff --git a/src/index b/src/index >> > index 827d803..840ed10 100644 >> > --- a/src/index >> > +++ b/src/index >> > @@ -37,6 +37,15 @@ >> > News >> > >> > >> > + February 15th, 2016, FFmpeg 3.0 >> > + >> > +We have made a new major releases (> > href="download.html#release_3.0">3.0). >> > + >> > + >> > +We recommend users, distributors and system integrators to upgrade >> > unless they use >> > +current git master. >> > + >> > + >> >> Please, can we had slightly more information about that release? >> >> I think the main highlights are: >> >> - The API/ABI break (implied by the major bump) >> - The many improvements in the native AAC encoder making it the >> recommended one (libaacplus and libvo-aacenc are removed) >> - A ton of filters were added > >> - Many ASM optimizations that weren't mentioned in the Changelog (I don't >> remember them) > > vf_blend had some significant work from Timothy Gu that I believe made > it into the release. > >> >> ... other developers will probably want to point out a few more things. > > I again don't know if it is worthwhile, but dynaudnorm is now > available on MSVC 2012 and earlier due to an erf fallback I > introduced. > Those are points for the ChangeLog if anything, not the key points for the release announcement. One that the media has already cited: - VP9 Hardware Acceleration (DXVA2 and VA-API) - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] vf_blend: Use integers for divide mode
On Fri, Feb 19, 2016 at 1:06 PM, Martin Vignali wrote: > Hello, > > Is it necessary to clip value, if B == 0 ? Well, integer division by 0 is undefined... > > > Martin > > 2016-02-19 18:47 GMT+01:00 Timothy Gu : > [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavfi/nnedi: Fix a compilation warning
Paul B Mahol gmail.com> writes: > > Attached patch fixes the following warning for me when compiling nnedi: > > libavfilter/vf_nnedi.c:611:15: warning: assignment discards `const' > > qualifier > > from pointer target type > > > > Please comment, Carl Eugen > > ok Patch applied. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavfi/nnedi: Fix a memleak
Paul B Mahol gmail.com> writes: > > Attached patch fixes a small memleak for me when > > using the nnedi filter. > > > > Please comment, Carl Eugen > > ok Patch applied. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] x86/dcadec: add ff_lfe_fir1_float_{sse3, avx}
On 2/22/2016 8:14 PM, Christophe Gisquet wrote: > Hi, >> +.inner_loop: > > Given this precludes reusing m5, then I don't have anything more to > comment, and seems ok. Pushed then, thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] lavf/mov: downgrade sidx errors to non-fatal warnings; fixes trac #5216
--- libavformat/mov.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index c5e0a1e..0408ad1 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3666,7 +3666,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom) version = avio_r8(pb); if (version > 1) { avpriv_request_sample(c->fc, "sidx version %u", version); -return AVERROR_PATCHWELCOME; +return 0; } avio_rb24(pb); // flags @@ -3679,8 +3679,8 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom) } } if (!st) { -av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %d\n", track_id); -return AVERROR_INVALIDDATA; +av_log(c->fc, AV_LOG_WARNING, "could not find corresponding track id %d\n", track_id); +return 0; } sc = st->priv_data; -- 2.7.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] lavf/mov: fix sidx with edit lists
--- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 149e3b4..c5e0a1e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3609,7 +3609,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) } av_log(c->fc, AV_LOG_DEBUG, "calculated into dts %"PRId64"\n", dts); } else { -dts = frag->time; +dts = frag->time - sc->time_offset; av_log(c->fc, AV_LOG_DEBUG, "found frag time %"PRId64 ", using it for dts\n", dts); } -- 2.7.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v18] lavf/movenc: Add palette to video sample description
Check for the track mode being MODE_MOV. -- Mats Peterson http://matsp888.no-ip.org/~mats/ >From d966ca6c1a665d261381a8bec34faf6cf1c59cf7 Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Tue, 23 Feb 2016 01:55:22 +0100 Subject: [PATCH v18] lavf/movenc: Add palette to video sample description --- libavformat/movenc.c | 70 +- libavformat/movenc.h |5 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9c0f7a..d57ca8c 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1714,7 +1714,27 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_wb16(pb, track->enc->bits_per_coded_sample); else avio_wb16(pb, 0x18); /* Reserved */ -avio_wb16(pb, 0x); /* Reserved */ + +if (mov->is_unaligned_qt_rgb && +track->enc->bits_per_coded_sample >= 1 && track->enc->bits_per_coded_sample <= 8) { +int i; +int pal_size = 1 << track->enc->bits_per_coded_sample; +avio_wb16(pb, 0); /* Color table ID */ +avio_wb32(pb, 0); /* Color table seed */ +avio_wb16(pb, 0x8000);/* Color table flags */ +avio_wb16(pb, pal_size - 1); /* Color table size (zero-relative) */ +for (i = 0; i < pal_size; i++) { +uint16_t r = (mov->palette[i] >> 16) & 0xff; +uint16_t g = (mov->palette[i] >> 8) & 0xff; +uint16_t b = mov->palette[i] & 0xff; +avio_wb16(pb, 0); +avio_wb16(pb, (r << 8) | r); +avio_wb16(pb, (g << 8) | g); +avio_wb16(pb, (b << 8) | b); +} +} else +avio_wb16(pb, 0x); /* Color table ID, -1 for no or default palette */ + if (track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if (track->enc->codec_id == AV_CODEC_ID_H263) @@ -1777,6 +1797,8 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr if (avid) avio_wb32(pb, 0); +mov->pal_done = 0; + return update_size(pb, pos); } @@ -4703,6 +4725,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } else { int i; MOVMuxContext *mov = s->priv_data; +MOVTrack *trk = &mov->tracks[pkt->stream_index]; if (!pkt->size) return mov_write_single_packet(s, pkt); /* Passthrough. */ @@ -4739,6 +4762,51 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } +if (trk->enc->codec_type == AVMEDIA_TYPE_VIDEO) { +mov->is_unaligned_qt_rgb = +trk->mode == MODE_MOV && +trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO && + (trk->enc->pix_fmt == AV_PIX_FMT_RGB24 || +trk->enc->pix_fmt == AV_PIX_FMT_BGR24 || +trk->enc->pix_fmt == AV_PIX_FMT_PAL8 || +trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || +trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE || +trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK); + +if (mov->is_unaligned_qt_rgb) { +const uint8_t *data = pkt->data; +int size = pkt->size; +int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16; +int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2; +int ret = ff_reshuffle_raw_rgb(s, &pkt, trk->enc, expected_stride); +if (ret < 0) +return ret; +if (!mov->pal_done) { +memset(mov->palette, 0, AVPALETTE_SIZE); +if (ret == CONTAINS_PAL) { +int pal_size = 1 << trk->enc->bits_per_coded_sample; +memcpy(mov->palette, data + size - 4*pal_size, 4*pal_size); +} else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8) { +/* Calculate 8 bpp grayscale palette */ +for (i = 0; i < 256; i++) +mov->palette[i] = (0xFFU << 24) | (i << 16) | (i << 8) | i; +} else if (trk->enc->bits_per_coded_sample == 1) { +/* Initialize 1 bpp palette to black & white */ +if (trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK) +mov->palette[1] = 0x; +else +mov->palette[0] = 0x; +} +mov->pal_done++; +} +if (ret) { +ret = mov_write_single_packet(s, pkt); +av_packet_free(&pkt); +return ret; +} +} +} + return mov_write_single_packet(s, pkt); } } diff --git a/libavform
[FFmpeg-devel] [PATCH v19] lavf/movenc: Add palette to video sample description
For MP4, use the word "Reserved" instead of "Color table ID". -- Mats Peterson http://matsp888.no-ip.org/~mats/ >From 7330d11fe3764aaee29ec36637aaa8206b5f346f Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Tue, 23 Feb 2016 02:24:49 +0100 Subject: [PATCH v19] lavf/movenc: Add palette to video sample description --- libavformat/movenc.c | 70 +- libavformat/movenc.h |5 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9c0f7a..9faaefa 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1714,7 +1714,27 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_wb16(pb, track->enc->bits_per_coded_sample); else avio_wb16(pb, 0x18); /* Reserved */ -avio_wb16(pb, 0x); /* Reserved */ + +if (mov->is_unaligned_qt_rgb && +track->enc->bits_per_coded_sample >= 1 && track->enc->bits_per_coded_sample <= 8) { +int i; +int pal_size = 1 << track->enc->bits_per_coded_sample; +avio_wb16(pb, 0); /* Color table ID */ +avio_wb32(pb, 0); /* Color table seed */ +avio_wb16(pb, 0x8000);/* Color table flags */ +avio_wb16(pb, pal_size - 1); /* Color table size (zero-relative) */ +for (i = 0; i < pal_size; i++) { +uint16_t r = (mov->palette[i] >> 16) & 0xff; +uint16_t g = (mov->palette[i] >> 8) & 0xff; +uint16_t b = mov->palette[i] & 0xff; +avio_wb16(pb, 0); +avio_wb16(pb, (r << 8) | r); +avio_wb16(pb, (g << 8) | g); +avio_wb16(pb, (b << 8) | b); +} +} else +avio_wb16(pb, 0x); /* Reserved */ + if (track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if (track->enc->codec_id == AV_CODEC_ID_H263) @@ -1777,6 +1797,8 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr if (avid) avio_wb32(pb, 0); +mov->pal_done = 0; + return update_size(pb, pos); } @@ -4703,6 +4725,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } else { int i; MOVMuxContext *mov = s->priv_data; +MOVTrack *trk = &mov->tracks[pkt->stream_index]; if (!pkt->size) return mov_write_single_packet(s, pkt); /* Passthrough. */ @@ -4739,6 +4762,51 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } +if (trk->enc->codec_type == AVMEDIA_TYPE_VIDEO) { +mov->is_unaligned_qt_rgb = +trk->mode == MODE_MOV && +trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO && + (trk->enc->pix_fmt == AV_PIX_FMT_RGB24 || +trk->enc->pix_fmt == AV_PIX_FMT_BGR24 || +trk->enc->pix_fmt == AV_PIX_FMT_PAL8 || +trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || +trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE || +trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK); + +if (mov->is_unaligned_qt_rgb) { +const uint8_t *data = pkt->data; +int size = pkt->size; +int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16; +int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2; +int ret = ff_reshuffle_raw_rgb(s, &pkt, trk->enc, expected_stride); +if (ret < 0) +return ret; +if (!mov->pal_done) { +memset(mov->palette, 0, AVPALETTE_SIZE); +if (ret == CONTAINS_PAL) { +int pal_size = 1 << trk->enc->bits_per_coded_sample; +memcpy(mov->palette, data + size - 4*pal_size, 4*pal_size); +} else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8) { +/* Calculate 8 bpp grayscale palette */ +for (i = 0; i < 256; i++) +mov->palette[i] = (0xFFU << 24) | (i << 16) | (i << 8) | i; +} else if (trk->enc->bits_per_coded_sample == 1) { +/* Initialize 1 bpp palette to black & white */ +if (trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK) +mov->palette[1] = 0x; +else +mov->palette[0] = 0x; +} +mov->pal_done++; +} +if (ret) { +ret = mov_write_single_packet(s, pkt); +av_packet_free(&pkt); +return ret; +} +} +} + return mov_write_single_packet(s, pkt); } } diff --git a/libavformat/movenc.h b/l
Re: [FFmpeg-devel] [PATCH v19] lavf/movenc: Add palette to video sample description
On 02/23/2016 02:27 AM, Mats Peterson wrote: For MP4, use the word "Reserved" instead of "Color table ID". Passes FATE, for the record. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] web: "news" about FFmpeg 3.0
On Mon, 22 Feb 2016 23:55:19 +0100, Michael Niedermayer wrote: > sure as long as someone who can speak english well writes it Me pushd. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libvpxenc: quiet unused-variable warning
On Sat, Feb 20, 2016 at 11:39 AM, James Almer wrote: > On 2/20/2016 4:26 PM, James Zern wrote: >> with older versions of libvpx >> since: >> 432be63 lavc/libvpx: Fix support for RGB colorspace. >> >> Signed-off-by: James Zern >> --- >> libavcodec/libvpxenc.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c >> index 1239103..b1114bc 100644 >> --- a/libavcodec/libvpxenc.c >> +++ b/libavcodec/libvpxenc.c >> @@ -278,7 +278,9 @@ static int set_pix_fmt(AVCodecContext *avctx, >> vpx_codec_caps_t codec_caps, >> struct vpx_codec_enc_cfg *enccfg, vpx_codec_flags_t >> *flags, >> vpx_img_fmt_t *img_fmt) >> { >> +#if VPX_IMAGE_ABI_VERSION >= 3 >> VP8Context *ctx = avctx->priv_data; >> +#endif > > Can't you just use the av_unused attribute? > Good point, that's simpler. Applied with that change. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/utvideodec: prevent possible signed overflow
Doing slice_end - slice_start is unsafe and can lead to undefined behavior until slice_end has been properly sanitized. Signed-off-by: Ganesh Ajjanagadde --- libavcodec/utvideodec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c index 760d9e5..c31416b 100644 --- a/libavcodec/utvideodec.c +++ b/libavcodec/utvideodec.c @@ -356,12 +356,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, slice_end = 0; for (j = 0; j < c->slices; j++) { slice_end = bytestream2_get_le32u(&gb); -slice_size = slice_end - slice_start; -if (slice_end < 0 || slice_size < 0 || +if (slice_end < 0 || slice_end < slice_start || bytestream2_get_bytes_left(&gb) < slice_end) { av_log(avctx, AV_LOG_ERROR, "Incorrect slice size\n"); return AVERROR_INVALIDDATA; } +slice_size = slice_end - slice_start; slice_start = slice_end; max_slice_size = FFMAX(max_slice_size, slice_size); } -- 2.7.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] AAC encoder 3x performance drop in 3.0 since Oct 2014
Hi! I am aware of news that AAC encoder got stable status recently. But you could find this interesting. We've got an ffmpeg build from October 2014, and it performs three times faster on AAC encoding than recent 3.0 release. There is no complaints about audio quality on old version, and I can honestly say the audio quality is really satisfiable on old version. The performance is paramount in our particular usecase, so it is silly to deploy a new version which performs so noticeably worse. Still deploying new release is needed due to other particular bugfixes. Obvious things like lowering bitrace, setting "-aac_coder fast" don't help. You can check this yourself with this script (it is also inlined below): https://gist.github.com/andrey-utkin/c60cd4070eb962d58075 On my workstation, the old version finishes the transcoding in 2.5s, the new one in 6.6s. Is there any workaround? Or is the old times speed is buried by correctness and stability? #!/bin/bash set -e ffmpeg -f lavfi -i aevalsrc="sin(440*2*PI*t):s=48000" -t 300 -y sin.flac git clone git://source.ffmpeg.org/ffmpeg.git || true pushd ffmpeg for REV in 16f9f7b n3.0 do if [[ -e ../ffmpeg_$REV ]] then continue fi git checkout $REV git clean -dxf ./configure make cp ffmpeg ../ffmpeg_$REV done popd for REV in 16f9f7b n3.0 do time ./ffmpeg_$REV -i sin.flac -acodec aac -strict -2 -y \ sin_${REV}.aac done ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v20] lavf/movenc: Add palette to video description
Use default Macintosh palette for AV_PIX_FMT_GRAY8 and AV_PIX_FMT_MONO[WB]. -- Mats Peterson http://matsp888.no-ip.org/~mats/ >From 6a6c6fab1881971e9382f8ddcba3e64dc15c37c8 Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Tue, 23 Feb 2016 05:34:21 +0100 Subject: [PATCH v20] lavf/movenc: Add palette to video description --- libavformat/movenc.c | 68 -- libavformat/movenc.h |5 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9c0f7a..14bd6a2 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1711,10 +1711,34 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_write(pb, compressor_name, 31); if (track->mode == MODE_MOV && track->enc->bits_per_coded_sample) -avio_wb16(pb, track->enc->bits_per_coded_sample); +avio_wb16(pb, track->enc->bits_per_coded_sample | + (track->enc->pix_fmt == AV_PIX_FMT_GRAY8 ? 0x20 : 0)); else avio_wb16(pb, 0x18); /* Reserved */ -avio_wb16(pb, 0x); /* Reserved */ + +if (mov->is_unaligned_qt_rgb && +track->enc->pix_fmt != AV_PIX_FMT_GRAY8 && +track->enc->pix_fmt != AV_PIX_FMT_MONOWHITE && +track->enc->pix_fmt != AV_PIX_FMT_MONOBLACK && +track->enc->bits_per_coded_sample >= 1 && track->enc->bits_per_coded_sample <= 8) { +int i; +int pal_size = 1 << track->enc->bits_per_coded_sample; +avio_wb16(pb, 0); /* Color table ID */ +avio_wb32(pb, 0); /* Color table seed */ +avio_wb16(pb, 0x8000);/* Color table flags */ +avio_wb16(pb, pal_size - 1); /* Color table size (zero-relative) */ +for (i = 0; i < pal_size; i++) { +uint16_t r = (mov->palette[i] >> 16) & 0xff; +uint16_t g = (mov->palette[i] >> 8) & 0xff; +uint16_t b = mov->palette[i] & 0xff; +avio_wb16(pb, 0); +avio_wb16(pb, (r << 8) | r); +avio_wb16(pb, (g << 8) | g); +avio_wb16(pb, (b << 8) | b); +} +} else +avio_wb16(pb, 0x); /* Reserved */ + if (track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if (track->enc->codec_id == AV_CODEC_ID_H263) @@ -1777,6 +1801,8 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr if (avid) avio_wb32(pb, 0); +mov->pal_done = 0; + return update_size(pb, pos); } @@ -4703,6 +4729,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } else { int i; MOVMuxContext *mov = s->priv_data; +MOVTrack *trk = &mov->tracks[pkt->stream_index]; if (!pkt->size) return mov_write_single_packet(s, pkt); /* Passthrough. */ @@ -4739,6 +4766,43 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } +if (trk->enc->codec_type == AVMEDIA_TYPE_VIDEO) { +mov->is_unaligned_qt_rgb = +trk->mode == MODE_MOV && +trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO && + (trk->enc->pix_fmt == AV_PIX_FMT_RGB24 || +trk->enc->pix_fmt == AV_PIX_FMT_BGR24 || +trk->enc->pix_fmt == AV_PIX_FMT_PAL8 || +trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || +trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE || +trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK); + +if (mov->is_unaligned_qt_rgb) { +const uint8_t *data = pkt->data; +int size = pkt->size; +int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16; +int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2; +int ret = ff_reshuffle_raw_rgb(s, &pkt, trk->enc, expected_stride); +if (ret < 0) +return ret; +if (ret == CONTAINS_PAL && !mov->pal_done) { +memset(mov->palette, 0, AVPALETTE_SIZE); +int pal_size = 1 << trk->enc->bits_per_coded_sample; +memcpy(mov->palette, data + size - 4*pal_size, 4*pal_size); +mov->pal_done++; +} else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || + trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK) { +for (i = 0; i < pkt->size; i++) +pkt->data[i] = ~pkt->data[i]; +} +if (ret) { +ret = mov_write_single_packet(s, pkt); +av_packet_free(&pkt); +return ret; +} +} +} + return mov_write_single_packet(s, pkt); } } diff --git a/libavformat/movenc.h b/libavformat/movenc.h index de
[FFmpeg-devel] [PATCH v21] lavf/movenc: Add palette to video sample description
Small fix. -- Mats Peterson http://matsp888.no-ip.org/~mats/ >From 55a5919053d6c4447a76235ba26e977a7871ec7a Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Tue, 23 Feb 2016 05:56:07 +0100 Subject: [PATCH v21] lavf/movenc: Add palette to video sample description --- libavformat/movenc.c | 68 -- libavformat/movenc.h |5 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9c0f7a..fdfacf9 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1711,10 +1711,34 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr avio_write(pb, compressor_name, 31); if (track->mode == MODE_MOV && track->enc->bits_per_coded_sample) -avio_wb16(pb, track->enc->bits_per_coded_sample); +avio_wb16(pb, track->enc->bits_per_coded_sample | + (track->enc->pix_fmt == AV_PIX_FMT_GRAY8 ? 0x20 : 0)); else avio_wb16(pb, 0x18); /* Reserved */ -avio_wb16(pb, 0x); /* Reserved */ + +if (mov->is_unaligned_qt_rgb && +track->enc->pix_fmt != AV_PIX_FMT_GRAY8 && +track->enc->pix_fmt != AV_PIX_FMT_MONOWHITE && +track->enc->pix_fmt != AV_PIX_FMT_MONOBLACK && +track->enc->bits_per_coded_sample >= 1 && track->enc->bits_per_coded_sample <= 8) { +int i; +int pal_size = 1 << track->enc->bits_per_coded_sample; +avio_wb16(pb, 0); /* Color table ID */ +avio_wb32(pb, 0); /* Color table seed */ +avio_wb16(pb, 0x8000);/* Color table flags */ +avio_wb16(pb, pal_size - 1); /* Color table size (zero-relative) */ +for (i = 0; i < pal_size; i++) { +uint16_t r = (mov->palette[i] >> 16) & 0xff; +uint16_t g = (mov->palette[i] >> 8) & 0xff; +uint16_t b = mov->palette[i] & 0xff; +avio_wb16(pb, 0); +avio_wb16(pb, (r << 8) | r); +avio_wb16(pb, (g << 8) | g); +avio_wb16(pb, (b << 8) | b); +} +} else +avio_wb16(pb, 0x); /* Reserved */ + if (track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if (track->enc->codec_id == AV_CODEC_ID_H263) @@ -1777,6 +1801,8 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr if (avid) avio_wb32(pb, 0); +mov->pal_done = 0; + return update_size(pb, pos); } @@ -4703,6 +4729,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } else { int i; MOVMuxContext *mov = s->priv_data; +MOVTrack *trk = &mov->tracks[pkt->stream_index]; if (!pkt->size) return mov_write_single_packet(s, pkt); /* Passthrough. */ @@ -4739,6 +4766,43 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } +if (trk->enc->codec_type == AVMEDIA_TYPE_VIDEO) { +mov->is_unaligned_qt_rgb = +trk->mode == MODE_MOV && +trk->enc->codec_id == AV_CODEC_ID_RAWVIDEO && + (trk->enc->pix_fmt == AV_PIX_FMT_RGB24 || +trk->enc->pix_fmt == AV_PIX_FMT_BGR24 || +trk->enc->pix_fmt == AV_PIX_FMT_PAL8 || +trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || +trk->enc->pix_fmt == AV_PIX_FMT_MONOWHITE || +trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK); + +if (mov->is_unaligned_qt_rgb) { +const uint8_t *data = pkt->data; +int size = pkt->size; +int64_t bpc = trk->enc->bits_per_coded_sample != 15 ? trk->enc->bits_per_coded_sample : 16; +int expected_stride = ((trk->enc->width * bpc + 15) >> 4)*2; +int ret = ff_reshuffle_raw_rgb(s, &pkt, trk->enc, expected_stride); +if (ret < 0) +return ret; +if (ret == CONTAINS_PAL && !mov->pal_done) { +int pal_size = 1 << trk->enc->bits_per_coded_sample; +memset(mov->palette, 0, AVPALETTE_SIZE); +memcpy(mov->palette, data + size - 4*pal_size, 4*pal_size); +mov->pal_done++; +} else if (trk->enc->pix_fmt == AV_PIX_FMT_GRAY8 || + trk->enc->pix_fmt == AV_PIX_FMT_MONOBLACK) { +for (i = 0; i < pkt->size; i++) +pkt->data[i] = ~pkt->data[i]; +} +if (ret) { +ret = mov_write_single_packet(s, pkt); +av_packet_free(&pkt); +return ret; +} +} +} + return mov_write_single_packet(s, pkt); } } diff --git a/libavformat/movenc.h b/libavformat/movenc.h index deb90fe..6452172 100644 --- a/libavformat/movenc.h +++ b/lib
[FFmpeg-devel] [PATCH]libpostproc: Fix an aliasing violation
Hi! Attached patch fixes ticket #5259 for me. Please review (including the subject), Carl Eugen diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c index 3b86f93..1dc719c 100644 --- a/libpostproc/postprocess.c +++ b/libpostproc/postprocess.c @@ -973,7 +973,7 @@ void pp_postprocess(const uint8_t * src[3], const int srcStride[3], int i; const int count= FFMAX(mbHeight * absQPStride, mbWidth); for(i=0; i<(count>>2); i++){ -((uint32_t*)c->stdQPTable)[i] = (((const uint32_t*)QP_store)[i]>>1) & 0x7F7F7F7F; +AV_WN32(c->stdQPTable + (i<<2), AV_RN32(QP_store + (i<<2)) >> 1 & 0x7F7F7F7F); } for(i<<=2; istdQPTable[i] = QP_store[i]>>1; ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] vf_blend: Use integers for divide mode
2016-02-23 0:22 GMT+01:00 Ganesh Ajjanagadde : > On Fri, Feb 19, 2016 at 1:06 PM, Martin Vignali > wrote: > > Hello, > > > > Is it necessary to clip value, if B == 0 ? > > Well, integer division by 0 is undefined... > > > > > > > Martin > > > > 2016-02-19 18:47 GMT+01:00 Timothy Gu : > > > [...] > Yes, but in that case, zero division can't happen, because B == 0 is tested. For now, this is the line av_clip_uint8(B == 0 ? 255 : 255 * A / B)) I think something like this can be enough : B == 0 ? 255 : av_clip_uint8(255 * A / B)) Martin ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel