[libav-devel] [PATCH 5/5] libdav1d: unref the frame on failure
--- libavcodec/libdav1d.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index 83d5c97bc..5177b884c 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -230,7 +230,7 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) if (c->width != p->p.w || c->height != p->p.h) { res = ff_set_dimensions(c, p->p.w, p->p.h); if (res < 0) -return res; +goto fail; } switch (p->seq_hdr->chr) { @@ -268,10 +268,15 @@ FF_ENABLE_DEPRECATION_WARNINGS frame->pict_type = AV_PICTURE_TYPE_SP; break; default: -return AVERROR_INVALIDDATA; +res = AVERROR_INVALIDDATA; +goto fail; } -return 0; +res = 0; +fail: +if (res < 0) +av_frame_unref(frame); +return res; } static av_cold int libdav1d_close(AVCodecContext *c) -- 2.21.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/5] libdav1d: move the pix_fmt enum array up in the file
This is in preparation for the following commit. --- libavcodec/libdav1d.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index 22fcb0df5..bb7d404e7 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -39,6 +39,13 @@ typedef struct Libdav1dContext { int apply_grain; } Libdav1dContext; +static const enum AVPixelFormat pix_fmt[][3] = { +[DAV1D_PIXEL_LAYOUT_I400] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12 }, +[DAV1D_PIXEL_LAYOUT_I420] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV420P12 }, +[DAV1D_PIXEL_LAYOUT_I422] = { AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV422P12 }, +[DAV1D_PIXEL_LAYOUT_I444] = { AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12 }, +}; + static void libdav1d_log_callback(void *opaque, const char *fmt, va_list vl) { AVCodecContext *c = opaque; @@ -89,13 +96,6 @@ static void libdav1d_frame_free(void *opaque, uint8_t *data) { av_free(p); } -static const enum AVPixelFormat pix_fmt[][3] = { -[DAV1D_PIXEL_LAYOUT_I400] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12 }, -[DAV1D_PIXEL_LAYOUT_I420] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV420P12 }, -[DAV1D_PIXEL_LAYOUT_I422] = { AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV422P12 }, -[DAV1D_PIXEL_LAYOUT_I444] = { AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12 }, -}; - static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) { Libdav1dContext *dav1d = c->priv_data; -- 2.21.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 4/5] libdav1d: consistently use AVERROR return values
--- libavcodec/libdav1d.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index 4c93e4b7c..83d5c97bc 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -185,9 +185,9 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) res = dav1d_send_data(dav1d->c, data); if (res < 0) { -if (res == -EINVAL) +if (res == AVERROR(EINVAL)) res = AVERROR_INVALIDDATA; -if (res != -EAGAIN) +if (res != AVERROR(EAGAIN)) return res; } @@ -197,9 +197,9 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) res = dav1d_get_picture(dav1d->c, p); if (res < 0) { -if (res == -EINVAL) +if (res == AVERROR(EINVAL)) res = AVERROR_INVALIDDATA; -else if (res == -EAGAIN && c->internal->draining) +else if (res == AVERROR(EAGAIN) && c->internal->draining) res = AVERROR_EOF; av_free(p); -- 2.21.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/5] libdav1d: route dav1d internal logs through av_log()
Bump the minimum required version to the first one with the logger API callback. --- configure | 2 +- libavcodec/libdav1d.c | 9 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 26455054b..a83990e7f 100755 --- a/configure +++ b/configure @@ -4676,7 +4676,7 @@ enabled libaom&& { } enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new -enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.1.0" dav1d/dav1d.h dav1d_version +enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.2.1" dav1d/dav1d.h dav1d_version enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec enabled libfaac && require libfaac "stdint.h faac.h" faacEncGetVersion -lfaac enabled libfdk_aac&& require_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index c6ccc3827..22fcb0df5 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -39,6 +39,13 @@ typedef struct Libdav1dContext { int apply_grain; } Libdav1dContext; +static void libdav1d_log_callback(void *opaque, const char *fmt, va_list vl) +{ +AVCodecContext *c = opaque; + +av_vlog(c, AV_LOG_ERROR, fmt, vl); +} + static av_cold int libdav1d_init(AVCodecContext *c) { Libdav1dContext *dav1d = c->priv_data; @@ -48,6 +55,8 @@ static av_cold int libdav1d_init(AVCodecContext *c) av_log(c, AV_LOG_INFO, "libdav1d %s\n", dav1d_version()); dav1d_default_settings(); +s.logger.cookie = c; +s.logger.callback = libdav1d_log_callback; s.n_tile_threads = dav1d->tile_threads; s.apply_grain = dav1d->apply_grain; s.n_frame_threads = FFMIN(c->thread_count ? c->thread_count : av_cpu_count(), DAV1D_MAX_FRAME_THREADS); -- 2.21.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 3/5] libdav1d: use a custom picture allocator
Replaces the libdav1d internal allocator. It uses an AVBufferPool to reduce the amount of allocated buffers. About 5% speed up when decoding 720p or higher streams. --- libavcodec/libdav1d.c | 60 +++ 1 file changed, 60 insertions(+) diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index bb7d404e7..4c93e4b7c 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -24,6 +24,7 @@ #include "libavutil/avassert.h" #include "libavutil/common.h" #include "libavutil/internal.h" +#include "libavutil/imgutils.h" #include "libavutil/opt.h" #include "avcodec.h" @@ -33,6 +34,8 @@ typedef struct Libdav1dContext { AVClass *class; Dav1dContext *c; +AVBufferPool *pool; +int pool_size; Dav1dData data; int tile_threads; @@ -53,6 +56,59 @@ static void libdav1d_log_callback(void *opaque, const char *fmt, va_list vl) av_vlog(c, AV_LOG_ERROR, fmt, vl); } +static int libdav1d_picture_allocator(Dav1dPicture *p, void *cookie) +{ +Libdav1dContext *dav1d = cookie; +enum AVPixelFormat format = pix_fmt[p->p.layout][p->seq_hdr->hbd]; +int ret, linesize[4], h = FFALIGN(p->p.h, 128); +uint8_t *aligned_ptr, *data[4]; +AVBufferRef *buf; + +ret = av_image_fill_arrays(data, linesize, NULL, format, FFALIGN(p->p.w, 128), + h, DAV1D_PICTURE_ALIGNMENT); +if (ret < 0) +return ret; + +if (ret != dav1d->pool_size) { +av_buffer_pool_uninit(>pool); +// Use twice the amount of required padding bytes for aligned_ptr below. +dav1d->pool = av_buffer_pool_init(ret + DAV1D_PICTURE_ALIGNMENT * 2, NULL); +if (!dav1d->pool) +return AVERROR(ENOMEM); +dav1d->pool_size = ret; +} +buf = av_buffer_pool_get(dav1d->pool); +if (!buf) +return AVERROR(ENOMEM); + +// libdav1d requires DAV1D_PICTURE_ALIGNMENT aligned buffers, which av_malloc() +// doesn't guarantee for example when AVX is disabled at configure time. +// Use the extra DAV1D_PICTURE_ALIGNMENT padding bytes in the buffer to align it +// if required. +aligned_ptr = (uint8_t *)FFALIGN((uintptr_t)buf->data, DAV1D_PICTURE_ALIGNMENT); +ret = av_image_fill_pointers(data, format, h, aligned_ptr, linesize); +if (ret < 0) { +av_buffer_unref(); +return ret; +} + +p->data[0] = data[0]; +p->data[1] = data[1]; +p->data[2] = data[2]; +p->stride[0] = linesize[0]; +p->stride[1] = linesize[1]; +p->allocator_data = buf; + +return 0; +} + +static void libdav1d_picture_release(Dav1dPicture *p, void *cookie) +{ +AVBufferRef *buf = p->allocator_data; + +av_buffer_unref(); +} + static av_cold int libdav1d_init(AVCodecContext *c) { Libdav1dContext *dav1d = c->priv_data; @@ -64,6 +120,9 @@ static av_cold int libdav1d_init(AVCodecContext *c) dav1d_default_settings(); s.logger.cookie = c; s.logger.callback = libdav1d_log_callback; +s.allocator.cookie = dav1d; +s.allocator.alloc_picture_callback = libdav1d_picture_allocator; +s.allocator.release_picture_callback = libdav1d_picture_release; s.n_tile_threads = dav1d->tile_threads; s.apply_grain = dav1d->apply_grain; s.n_frame_threads = FFMIN(c->thread_count ? c->thread_count : av_cpu_count(), DAV1D_MAX_FRAME_THREADS); @@ -219,6 +278,7 @@ static av_cold int libdav1d_close(AVCodecContext *c) { Libdav1dContext *dav1d = c->priv_data; +av_buffer_pool_uninit(>pool); dav1d_data_unref(>data); dav1d_close(>c); -- 2.21.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] avcodec/libdav1d: properly free all output picture references
Dav1dPictures contain more than one buffer reference, so we're forced to use the API properly to free them all. Signed-off-by: James Almer --- libavcodec/libdav1d.c | 69 +++ 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index 99390d527..c6ccc3827 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -74,11 +74,10 @@ static void libdav1d_data_free(const uint8_t *data, void *opaque) { } static void libdav1d_frame_free(void *opaque, uint8_t *data) { -Dav1dPicture p = { 0 }; +Dav1dPicture *p = opaque; -p.ref = opaque; -p.data[0] = (void *) 0x1; // this has to be non-NULL -dav1d_picture_unref(); +dav1d_picture_unref(p); +av_free(p); } static const enum AVPixelFormat pix_fmt[][3] = { @@ -92,7 +91,7 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) { Libdav1dContext *dav1d = c->priv_data; Dav1dData *data = >data; -Dav1dPicture p = { 0 }; +Dav1dPicture *p; int res; if (!data->sz) { @@ -124,43 +123,49 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) return res; } -res = dav1d_get_picture(dav1d->c, ); +p = av_mallocz(sizeof(*p)); +if (!p) +return AVERROR(ENOMEM); + +res = dav1d_get_picture(dav1d->c, p); if (res < 0) { if (res == -EINVAL) res = AVERROR_INVALIDDATA; else if (res == -EAGAIN && c->internal->draining) res = AVERROR_EOF; +av_free(p); return res; } -av_assert0(p.data[0] != NULL); +av_assert0(p->data[0] != NULL); frame->buf[0] = av_buffer_create(NULL, 0, libdav1d_frame_free, - p.ref, AV_BUFFER_FLAG_READONLY); + p, AV_BUFFER_FLAG_READONLY); if (!frame->buf[0]) { -dav1d_picture_unref(); +dav1d_picture_unref(p); +av_free(p); return AVERROR(ENOMEM); } -frame->data[0] = p.data[0]; -frame->data[1] = p.data[1]; -frame->data[2] = p.data[2]; -frame->linesize[0] = p.stride[0]; -frame->linesize[1] = p.stride[1]; -frame->linesize[2] = p.stride[1]; - -c->profile = p.seq_hdr->profile; -frame->format = c->pix_fmt = pix_fmt[p.p.layout][p.seq_hdr->hbd]; -frame->width = p.p.w; -frame->height = p.p.h; -if (c->width != p.p.w || c->height != p.p.h) { -res = ff_set_dimensions(c, p.p.w, p.p.h); +frame->data[0] = p->data[0]; +frame->data[1] = p->data[1]; +frame->data[2] = p->data[2]; +frame->linesize[0] = p->stride[0]; +frame->linesize[1] = p->stride[1]; +frame->linesize[2] = p->stride[1]; + +c->profile = p->seq_hdr->profile; +frame->format = c->pix_fmt = pix_fmt[p->p.layout][p->seq_hdr->hbd]; +frame->width = p->p.w; +frame->height = p->p.h; +if (c->width != p->p.w || c->height != p->p.h) { +res = ff_set_dimensions(c, p->p.w, p->p.h); if (res < 0) return res; } -switch (p.seq_hdr->chr) { +switch (p->seq_hdr->chr) { case DAV1D_CHR_VERTICAL: frame->chroma_location = c->chroma_sample_location = AVCHROMA_LOC_LEFT; break; @@ -168,22 +173,22 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) frame->chroma_location = c->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; break; } -frame->colorspace = c->colorspace = (enum AVColorSpace) p.seq_hdr->mtrx; -frame->color_primaries = c->color_primaries = (enum AVColorPrimaries) p.seq_hdr->pri; -frame->color_trc = c->color_trc = (enum AVColorTransferCharacteristic) p.seq_hdr->trc; -frame->color_range = c->color_range = p.seq_hdr->color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; +frame->colorspace = c->colorspace = (enum AVColorSpace) p->seq_hdr->mtrx; +frame->color_primaries = c->color_primaries = (enum AVColorPrimaries) p->seq_hdr->pri; +frame->color_trc = c->color_trc = (enum AVColorTransferCharacteristic) p->seq_hdr->trc; +frame->color_range = c->color_range = p->seq_hdr->color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; // match timestamps and packet size -frame->pts = p.m.timestamp; +frame->pts = p->m.timestamp; #if FF_API_PKT_PTS FF_DISABLE_DEPRECATION_WARNINGS -frame->pkt_pts = p.m.timestamp; +frame->pkt_pts = p->m.timestamp; FF_ENABLE_DEPRECATION_WARNINGS #endif -frame->pkt_dts = p.m.timestamp; -frame->key_frame = p.frame_hdr->frame_type == DAV1D_FRAME_TYPE_KEY; +frame->pkt_dts = p->m.timestamp; +frame->key
[libav-devel] [PATCH] libdav1d: update API usage to the first stable release
The color fields were moved to another struct, and a way to propagate timestamps and other input metadata was introduced, so the packet fifo can be removed. Add an option to disable film grain, and read the profile from the sequence header referenced by the ouput picture instead of guessing based on output pix_fmt. Signed-off-by: James Almer --- configure | 2 +- libavcodec/libdav1d.c | 78 +-- 2 files changed, 24 insertions(+), 56 deletions(-) diff --git a/configure b/configure index c5bafc382..26455054b 100755 --- a/configure +++ b/configure @@ -4676,7 +4676,7 @@ enabled libaom&& { } enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new -enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.0.1" dav1d/dav1d.h dav1d_version +enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.1.0" dav1d/dav1d.h dav1d_version enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec enabled libfaac && require libfaac "stdint.h faac.h" faacEncGetVersion -lfaac enabled libfdk_aac&& require_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index 3501c15e2..28c1fdf4d 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -22,7 +22,6 @@ #include #include "libavutil/avassert.h" -#include "libavutil/fifo.h" #include "libavutil/common.h" #include "libavutil/internal.h" #include "libavutil/opt.h" @@ -35,9 +34,9 @@ typedef struct Libdav1dContext { AVClass *class; Dav1dContext *c; -AVFifoBuffer *cache; Dav1dData data; int tile_threads; +int apply_grain; } Libdav1dContext; static av_cold int libdav1d_init(AVCodecContext *c) @@ -50,11 +49,8 @@ static av_cold int libdav1d_init(AVCodecContext *c) dav1d_default_settings(); s.n_tile_threads = dav1d->tile_threads; -s.n_frame_threads = FFMIN(c->thread_count ? c->thread_count : av_cpu_count(), 256); - -dav1d->cache = av_fifo_alloc(8 * sizeof(AVPacket)); -if (!dav1d->cache) -return AVERROR(ENOMEM); +s.apply_grain = dav1d->apply_grain; +s.n_frame_threads = FFMIN(c->thread_count ? c->thread_count : av_cpu_count(), DAV1D_MAX_FRAME_THREADS); res = dav1d_open(>c, ); if (res < 0) @@ -67,23 +63,10 @@ static void libdav1d_flush(AVCodecContext *c) { Libdav1dContext *dav1d = c->priv_data; -av_fifo_reset(dav1d->cache); dav1d_data_unref(>data); dav1d_flush(dav1d->c); } -static int libdav1d_fifo_write(void *src, void *dst, int dst_size) { -AVPacket *pkt_dst = dst, *pkt_src = src; - -av_assert2(dst_size >= sizeof(AVPacket)); - -pkt_src->buf = NULL; -av_packet_free_side_data(pkt_src); -*pkt_dst = *pkt_src; - -return sizeof(AVPacket); -} - static void libdav1d_data_free(const uint8_t *data, void *opaque) { AVBufferRef *buf = opaque; @@ -105,43 +88,31 @@ static const enum AVPixelFormat pix_fmt[][2] = { [DAV1D_PIXEL_LAYOUT_I444] = { AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P10 }, }; -// TODO: Update once 12bit support is added. -static const int profile[] = { -[DAV1D_PIXEL_LAYOUT_I400] = FF_PROFILE_AV1_MAIN, -[DAV1D_PIXEL_LAYOUT_I420] = FF_PROFILE_AV1_MAIN, -[DAV1D_PIXEL_LAYOUT_I422] = FF_PROFILE_AV1_PROFESSIONAL, -[DAV1D_PIXEL_LAYOUT_I444] = FF_PROFILE_AV1_HIGH, -}; - static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) { Libdav1dContext *dav1d = c->priv_data; Dav1dData *data = >data; -AVPacket pkt = { 0 }; Dav1dPicture p = { 0 }; int res; if (!data->sz) { +AVPacket pkt = { 0 }; + res = ff_decode_get_packet(c, ); if (res < 0 && res != AVERROR_EOF) return res; if (pkt.size) { -if (!av_fifo_space(dav1d->cache)) { -res = av_fifo_realloc2(dav1d->cache, av_fifo_size(dav1d->cache) + 8 * sizeof(pkt)); -if (res < 0) { -av_packet_unref(); -return res; -} -} - res = dav1d_data_wrap(data, pkt.data, pkt.size, libdav1d_data_free, pkt.buf); if (res < 0) { av_packet_unref(); return res; } -av_fifo_generic_write(dav1d->cache, , sizeof(pkt), libdav1d_fifo_write); +data->m.timestamp = pkt.pts; + +pkt.buf = NULL; +av_packet_unref(); } } @@ -165,8 +
[libav-devel] [PATCH] libdav1d: fix build after a recent API break
Signed-off-by: James Almer --- libavcodec/libdav1d.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index ad4611fb9..3501c15e2 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -142,12 +142,18 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) } av_fifo_generic_write(dav1d->cache, , sizeof(pkt), libdav1d_fifo_write); -} else { -data = NULL; } } -res = dav1d_decode(dav1d->c, data, ); +res = dav1d_send_data(dav1d->c, data); +if (res < 0) { +if (res == -EINVAL) +res = AVERROR_INVALIDDATA; +if (res != -EAGAIN) +return res; +} + +res = dav1d_get_picture(dav1d->c, ); if (res < 0) { if (res == -EINVAL) res = AVERROR_INVALIDDATA; -- 2.19.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 3/3] avcodec: libdav1d AV1 decoder wrapper.
Originally written by Ronald S. Bultje, with fixes, optimizations and improvements by James Almer. Signed-off-by: James Almer --- Changelog | 1 + configure | 4 + doc/general.texi | 12 +- libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/libdav1d.c | 269 + libavcodec/version.h | 2 +- 7 files changed, 285 insertions(+), 5 deletions(-) create mode 100644 libavcodec/libdav1d.c diff --git a/Changelog b/Changelog index 27a4d4eee..773f640e0 100644 --- a/Changelog +++ b/Changelog @@ -25,6 +25,7 @@ version : - Dropped support for building for Windows XP. The minimum supported Windows version is Windows Vista. - support mbedTLS-based TLS +- AV1 Support through libdav1d version 12: diff --git a/configure b/configure index 2aa7eb627..c5bafc382 100755 --- a/configure +++ b/configure @@ -190,6 +190,7 @@ External library support: --enable-libaomAV1 video encoding/decoding --enable-libbs2b Bauer stereophonic-to-binaural DSP --enable-libcdio audio CD input + --enable-libdav1d AV1 video decoding --enable-libdc1394 IEEE 1394/Firewire camera input --enable-libdcadec DCA audio decoding --enable-libfaac AAC audio encoding @@ -1357,6 +1358,7 @@ EXTERNAL_LIBRARY_LIST=" gnutls libaom libbs2b +libdav1d libdc1394 libdcadec libfontconfig @@ -2372,6 +2374,7 @@ avisynth_demuxer_deps_any="avisynth avxsynth" avisynth_demuxer_select="riffdec" libaom_av1_decoder_deps="libaom" libaom_av1_encoder_deps="libaom" +libdav1d_decoder_deps="libdav1d" libdcadec_decoder_deps="libdcadec" libfaac_encoder_deps="libfaac" libfaac_encoder_select="audio_frame_queue" @@ -4673,6 +4676,7 @@ enabled libaom&& { } enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new +enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.0.1" dav1d/dav1d.h dav1d_version enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec enabled libfaac && require libfaac "stdint.h faac.h" faacEncGetVersion -lfaac enabled libfdk_aac&& require_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen diff --git a/doc/general.texi b/doc/general.texi index e066b4218..6a21a8b79 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -18,12 +18,16 @@ explicitly requested by passing the appropriate flags to @section Alliance for Open Media libaom -Libav can make use of the libaom library for AV1 decoding. +Libav can make use of the libaom and libdav1d libraries for AV1 decoding. Go to @url{http://aomedia.org/} and follow the instructions for -installing the library. Then pass @code{--enable-libaom} to configure to +installing libaom. Then pass @code{--enable-libaom} to configure to enable it. +Go to @url{https://code.videolan.org/videolan/dav1d/} and follow the +instructions for installing libdav1d. Then pass @code{--enable-libdav1d} +to configure to enable it. + @section OpenCORE and VisualOn libraries Spun off Google Android sources, OpenCore, VisualOn and Fraunhofer @@ -625,8 +629,8 @@ following image formats are supported: @item Autodesk Animator Flic video @tab @tab X @item Autodesk RLE @tab @tab X @tab fourcc: AASC -@item AV1@tab @tab E -@tab Supported through external library libaom +@item AV1@tab E @tab E +@tab Supported through external libraries libaom and libdav1d @item AVS (Audio Video Standard) video @tab @tab X @tab Video encoding used by the Creature Shock game. @item Beam Software VB @tab @tab X diff --git a/libavcodec/Makefile b/libavcodec/Makefile index ea0c9dcea..ae3562884 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -689,6 +689,7 @@ OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o # external codec libraries OBJS-$(CONFIG_LIBAOM_AV1_DECODER) += libaomdec.o libaom.o OBJS-$(CONFIG_LIBAOM_AV1_ENCODER) += libaomenc.o libaom.o +OBJS-$(CONFIG_LIBDAV1D_DECODER) += libdav1d.o OBJS-$(CONFIG_LIBDCADEC_DECODER) += libdcadec.o dca.o OBJS-$(CONFIG_LIBFAAC_ENCODER)+= libfaac.o OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 4aee65762..f38ea19f4 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -422,6 +422,7 @@ void avcodec_register_all(void) /* external libraries */ REGISTER_ENCDEC (LIBAOM_AV1,libaom_av1); +REGISTE
[libav-devel] [PATCH 2/3] swscale: Add GRAY10
From: Carl Eugen Hoyos Based on ab839054 by Luca Barbato. Signed-off-by: James Almer --- libswscale/input.c | 2 ++ libswscale/swscale_internal.h | 2 ++ libswscale/swscale_unscaled.c | 1 + libswscale/utils.c | 2 ++ libswscale/version.h | 2 +- tests/ref/fate/filter-pixdesc-gray10be | 1 + tests/ref/fate/filter-pixdesc-gray10le | 1 + tests/ref/fate/filter-pixfmts-copy | 2 ++ tests/ref/fate/filter-pixfmts-null | 2 ++ tests/ref/fate/filter-pixfmts-scale| 2 ++ tests/ref/fate/filter-pixfmts-vflip| 2 ++ 11 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/ref/fate/filter-pixdesc-gray10be create mode 100644 tests/ref/fate/filter-pixdesc-gray10le diff --git a/libswscale/input.c b/libswscale/input.c index 761776c1c..3bc475dc6 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -1136,6 +1136,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUV420P16LE: case AV_PIX_FMT_YUV422P16LE: case AV_PIX_FMT_YUV444P16LE: +case AV_PIX_FMT_GRAY10LE: case AV_PIX_FMT_GRAY12LE: case AV_PIX_FMT_GRAY16LE: c->lumToYV12 = bswap16Y_c; @@ -1165,6 +1166,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUV420P16BE: case AV_PIX_FMT_YUV422P16BE: case AV_PIX_FMT_YUV444P16BE: +case AV_PIX_FMT_GRAY10BE: case AV_PIX_FMT_GRAY12BE: case AV_PIX_FMT_GRAY16BE: c->lumToYV12 = bswap16Y_c; diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index adfe1708e..7232921b9 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -600,6 +600,8 @@ static av_always_inline int isRGB(enum AVPixelFormat pix_fmt) #define isGray(x) \ ((x) == AV_PIX_FMT_GRAY8 || \ (x) == AV_PIX_FMT_YA8 || \ + (x) == AV_PIX_FMT_GRAY10BE|| \ + (x) == AV_PIX_FMT_GRAY10LE|| \ (x) == AV_PIX_FMT_GRAY12BE|| \ (x) == AV_PIX_FMT_GRAY12LE|| \ (x) == AV_PIX_FMT_GRAY16BE|| \ diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index f130ac58c..06ad3a6ca 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -1097,6 +1097,7 @@ void ff_get_unscaled_swscale(SwsContext *c) IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR555) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR565) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGRA64) || +IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY10) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY12) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY16) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YA16) || diff --git a/libswscale/utils.c b/libswscale/utils.c index d94be5a50..f391bdad1 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -108,6 +108,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_RGBA]= { 1, 1 }, [AV_PIX_FMT_ABGR]= { 1, 1 }, [AV_PIX_FMT_BGRA]= { 1, 1 }, +[AV_PIX_FMT_GRAY10BE]= { 1, 1 }, +[AV_PIX_FMT_GRAY10LE]= { 1, 1 }, [AV_PIX_FMT_GRAY12BE]= { 1, 1 }, [AV_PIX_FMT_GRAY12LE]= { 1, 1 }, [AV_PIX_FMT_GRAY16BE]= { 1, 1 }, diff --git a/libswscale/version.h b/libswscale/version.h index 5badd3d32..e21758eb4 100644 --- a/libswscale/version.h +++ b/libswscale/version.h @@ -28,7 +28,7 @@ #define LIBSWSCALE_VERSION_MAJOR 5 #define LIBSWSCALE_VERSION_MINOR 0 -#define LIBSWSCALE_VERSION_MICRO 0 +#define LIBSWSCALE_VERSION_MICRO 1 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ LIBSWSCALE_VERSION_MINOR, \ diff --git a/tests/ref/fate/filter-pixdesc-gray10be b/tests/ref/fate/filter-pixdesc-gray10be new file mode 100644 index 0..74bf8c69a --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-gray10be @@ -0,0 +1 @@ +pixdesc-gray10be64bfd85801ed894c86337d2c7a7efaff diff --git a/tests/ref/fate/filter-pixdesc-gray10le b/tests/ref/fate/filter-pixdesc-gray10le new file mode 100644 index 0..d32cf96f9 --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-gray10le @@ -0,0 +1 @@ +pixdesc-gray10lec1aa37491db157f32d589e66f020adee diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy index c23187c59..baaf86cc0 100644 --- a/tests/ref/fate/filter-pixfmts-copy +++ b/tests/ref/fate/filter-pixfmts-copy @@ -25,6 +25,8 @@ gbrp12le654861b1837d312569395f598da1a2a1 gbrp9be cbe1bf8ead497a92362a749bd4b0a57e gbrp9le f88c68df5d699a4a7f1b0152df9f25fe gray8c941e9bbf6da5336384c57f15a4a454 +gray10be69c8af356c3861792f9695fdff966629 +gray10lea97b97107bf03f27136abbaca0
[libav-devel] [PATCH 0/3] libdav1d AV1 decoder wrapper
$subject Carl Eugen Hoyos (2): pixfmt: Add GRAY10 swscale: Add GRAY10 James Almer (1): avcodec: libdav1d AV1 decoder wrapper. Changelog | 1 + configure | 4 + doc/APIchanges | 3 + doc/general.texi | 12 +- libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/libdav1d.c | 269 + libavcodec/version.h | 2 +- libavutil/pixdesc.c| 22 ++ libavutil/pixfmt.h | 4 + libavutil/version.h| 4 +- libswscale/input.c | 2 + libswscale/swscale_internal.h | 2 + libswscale/swscale_unscaled.c | 1 + libswscale/utils.c | 2 + libswscale/version.h | 2 +- tests/ref/fate/filter-pixdesc-gray10be | 1 + tests/ref/fate/filter-pixdesc-gray10le | 1 + tests/ref/fate/filter-pixfmts-copy | 2 + tests/ref/fate/filter-pixfmts-null | 2 + tests/ref/fate/filter-pixfmts-scale| 2 + tests/ref/fate/filter-pixfmts-vflip| 2 + 22 files changed, 334 insertions(+), 8 deletions(-) create mode 100644 libavcodec/libdav1d.c create mode 100644 tests/ref/fate/filter-pixdesc-gray10be create mode 100644 tests/ref/fate/filter-pixdesc-gray10le -- 2.19.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/3] pixfmt: Add GRAY10
From: Carl Eugen Hoyos Based on 7471352f by Luca Barbato. Signed-off-by: James Almer --- doc/APIchanges | 3 +++ libavutil/pixdesc.c | 22 ++ libavutil/pixfmt.h | 4 libavutil/version.h | 4 ++-- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 9ba03648c..c1bbae170 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2017-03-23 API changes, most recent first: +2018-xx-xx - xxx - lavu 56.8.0 - pixfmt.h + Add AV_PIX_FMT_GRAY10(LE/BE). + 2018-xx-xx - xxx - lavc 58.10.0 - avcodec.h Add av_bsf_flush(). diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 957f99fda..a09fe52c9 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -483,6 +483,27 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, }, +[AV_PIX_FMT_GRAY10BE] = { +.name = "gray10be", +.nb_components = 1, +.log2_chroma_w = 0, +.log2_chroma_h = 0, +.comp = { +{ 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */ +}, +.flags = AV_PIX_FMT_FLAG_BE, +.alias = "y10be", +}, +[AV_PIX_FMT_GRAY10LE] = { +.name = "gray10le", +.nb_components = 1, +.log2_chroma_w = 0, +.log2_chroma_h = 0, +.comp = { +{ 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */ +}, +.alias = "y10le", +}, [AV_PIX_FMT_GRAY12BE] = { .name = "gray12be", .nb_components = 1, @@ -1958,6 +1979,7 @@ enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt) case AV_PIX_FMT_ ## fmt ## LE: return AV_PIX_FMT_ ## fmt ## BE switch (pix_fmt) { +PIX_FMT_SWAP_ENDIANNESS(GRAY10); PIX_FMT_SWAP_ENDIANNESS(GRAY12); PIX_FMT_SWAP_ENDIANNESS(GRAY16); PIX_FMT_SWAP_ENDIANNESS(YA16); diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index bcbb37837..23331c333 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -249,6 +249,9 @@ enum AVPixelFormat { */ AV_PIX_FMT_D3D11, +AV_PIX_FMT_GRAY10BE, ///< Y, 10bpp, big-endian +AV_PIX_FMT_GRAY10LE, ///< Y, 10bpp, little-endian + AV_PIX_FMT_NB,///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions }; @@ -263,6 +266,7 @@ enum AVPixelFormat { #define AV_PIX_FMT_BGR32 AV_PIX_FMT_NE(ABGR, RGBA) #define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB) +#define AV_PIX_FMT_GRAY10 AV_PIX_FMT_NE(GRAY10BE, GRAY10LE) #define AV_PIX_FMT_GRAY12 AV_PIX_FMT_NE(GRAY12BE, GRAY12LE) #define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE) #define AV_PIX_FMT_YA16 AV_PIX_FMT_NE(YA16BE, YA16LE) diff --git a/libavutil/version.h b/libavutil/version.h index e5fbd4ca8..1e5ba98ca 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -54,8 +54,8 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 7 -#define LIBAVUTIL_VERSION_MICRO 1 +#define LIBAVUTIL_VERSION_MINOR 8 +#define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ -- 2.19.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] libaom: remove references to yuva444p pixfmt
Support for it was apparently never in the codebase, and the enum value was recently removed from the public headers [1] [1] https://aomedia.googlesource.com/aom/+/f1570f0c2f70832dd170285f8de60bd2379c8efa Signed-off-by: James Almer --- libavcodec/libaom.c | 4 1 file changed, 4 deletions(-) diff --git a/libavcodec/libaom.c b/libavcodec/libaom.c index 512095b33..bfc25ebe3 100644 --- a/libavcodec/libaom.c +++ b/libavcodec/libaom.c @@ -44,8 +44,6 @@ enum AVPixelFormat ff_aom_imgfmt_to_pixfmt(aom_img_fmt_t img, int depth) return AV_PIX_FMT_YUV422P; case AOM_IMG_FMT_I444: return AV_PIX_FMT_YUV444P; -case AOM_IMG_FMT_444A: -return AV_PIX_FMT_YUVA444P; HIGH_DEPTH(420) HIGH_DEPTH(422) HIGH_DEPTH(444) @@ -65,8 +63,6 @@ aom_img_fmt_t ff_aom_pixfmt_to_imgfmt(enum AVPixelFormat pix) return AOM_IMG_FMT_I422; case AV_PIX_FMT_YUV444P: return AOM_IMG_FMT_I444; -case AV_PIX_FMT_YUVA444P: -return AOM_IMG_FMT_444A; case AV_PIX_FMT_YUV420P10: return AOM_IMG_FMT_I42016; case AV_PIX_FMT_YUV422P10: -- 2.19.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 6/9] avcodec/extract_extradata: don't uninitialize the H2645Packet on every processed packet
On 10/11/2018 7:12 AM, Luca Barbato wrote: > On 03/10/2018 21:15, Luca Barbato wrote: >> From: James Almer >> >> Based on hevc_parser code. This prevents repeated unnecessary allocations >> and frees on every packet processed by the bsf. >> >> Reviewed-by: Jun Zhao >> Signed-off-by: James Almer >> Signed-off-by: Luca Barbato >> --- >> libavcodec/extract_extradata_bsf.c | 33 +++-- >> 1 file changed, 19 insertions(+), 14 deletions(-) > > I'd merge the extract_extradata improvements today, James do you see > anything I should fold in? > > lu No, patches 1 to 6 can go in as is. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] avcodec/libaomenc: export the Sequence Header OBU as extradata
Signed-off-by: James Almer --- configure | 8 +++- libavcodec/libaomenc.c | 34 +- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 48e8536b0..2aa7eb627 100755 --- a/configure +++ b/configure @@ -4664,7 +4664,13 @@ enabled cuvid && require cuvid cuviddec.h cuvidCreateDecoder -lnvcuv enabled frei0r&& require_headers frei0r.h enabled gnutls&& require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init && check_lib gmp gmp.h mpz_export -lgmp -enabled libaom&& require_pkg_config libaom "aom >= 0.1.0" aom/aom_codec.h aom_codec_version +enabled libaom&& { +enabled libaom_av1_decoder && require_pkg_config libaom_av1_decoder "aom >= 1.0.0" "aom/aom_decoder.h aom/aomdx.h" aom_codec_av1_dx +enabled libaom_av1_encoder && { +require_pkg_config libaom_av1_encoder "aom >= 1.0.0" "aom/aom_encoder.h aom/aomcx.h" aom_codec_av1_cx && +require_cpp_condition libaom_av1_encoder aom/aom_encoder.h "defined AOM_FRAME_IS_INTRAONLY"; +} +} enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index 9807bd5ad..69e4ea126 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -68,6 +68,8 @@ static const char *const ctlidstr[] = { [AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL", [AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF", [AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD", +[AV1E_SET_CHROMA_SUBSAMPLING_X] = "AV1E_SET_CHROMA_SUBSAMPLING_X", +[AV1E_SET_CHROMA_SUBSAMPLING_Y] = "AV1E_SET_CHROMA_SUBSAMPLING_Y", }; static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc) @@ -197,7 +199,7 @@ static av_cold int aom_init(AVCodecContext *avctx) AOMContext *ctx = avctx->priv_data; struct aom_codec_enc_cfg enccfg = { 0 }; AVCPBProperties *cpb_props; -int res; +int res, h_shift, v_shift; const struct aom_codec_iface *iface = _codec_av1_cx_algo; av_log(avctx, AV_LOG_INFO, "%s\n", aom_codec_version_str()); @@ -332,6 +334,13 @@ static av_cold int aom_init(AVCodecContext *avctx) codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh); codecctl_int(avctx, AOME_SET_CQ_LEVEL, ctx->crf); +res = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, _shift, _shift); +if (res < 0) +return res; + +codecctl_int(avctx, AV1E_SET_CHROMA_SUBSAMPLING_X, h_shift); +codecctl_int(avctx, AV1E_SET_CHROMA_SUBSAMPLING_Y, v_shift); + // provide dummy value to initialize wrapper, values will be updated each _encode() aom_img_wrap(>rawimg, ff_aom_pixfmt_to_imgfmt(avctx->pix_fmt), avctx->width, avctx->height, 1, (unsigned char *)1); @@ -340,6 +349,29 @@ static av_cold int aom_init(AVCodecContext *avctx) if (!cpb_props) return AVERROR(ENOMEM); +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { +aom_fixed_buf_t *seq = aom_codec_get_global_headers(>encoder); +if (!seq) +return AVERROR_UNKNOWN; + +avctx->extradata = av_malloc(seq->sz + AV_INPUT_BUFFER_PADDING_SIZE); +if (!avctx->extradata) { +free(seq->buf); +free(seq); +return AVERROR(ENOMEM); +} +avctx->extradata_size = seq->sz; +memcpy(avctx->extradata, seq->buf, seq->sz); +memset(avctx->extradata + seq->sz, 0, AV_INPUT_BUFFER_PADDING_SIZE); + +/* Doxy says: "The caller owns the memory associated with this buffer. + * Memory is allocated using malloc(), and should be freed + * via call to free()" + */ +free(seq->buf); +free(seq); +} + if (enccfg.rc_end_usage == AOM_CBR || enccfg.g_pass != AOM_RC_ONE_PASS) { cpb_props->max_bitrate = avctx->rc_max_rate; -- 2.19.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] avcodec/libaomenc: export Sequence Header and Metadata OBUs as extradata
On 10/6/2018 5:43 PM, Luca Barbato wrote: > From: James Almer > > aom_codec_get_global_headers() is not implemented as of libaom 1.0.0 for AV1, > so > we're forced to extract the relevant header OBUs from the first packet and > propagate > them as packet side data. It is now available in libaom git head, but who knows when they will tag a new release... If you'd rather avoid nonetheless the complexity, i can cook up a patch to use it and make the minimum required libaom version something recent enough. Unless the plan was to tag a libav release, in which case it would probably not be a good idea. > > Signed-off-by: James Almer > Signed-off-by: Luca Barbato > --- > configure | 1 + > libavcodec/libaomenc.c | 41 + > 2 files changed, 42 insertions(+) > > diff --git a/configure b/configure > index 48e8536b07..8ac3c1c7c3 100755 > --- a/configure > +++ b/configure > @@ -2372,6 +2372,7 @@ avisynth_demuxer_deps_any="avisynth avxsynth" > avisynth_demuxer_select="riffdec" > libaom_av1_decoder_deps="libaom" > libaom_av1_encoder_deps="libaom" > +libaom_av1_encoder_select="extract_extradata_bsf" > libdcadec_decoder_deps="libdcadec" > libfaac_encoder_deps="libfaac" > libfaac_encoder_select="audio_frame_queue" > diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c > index 9807bd5adb..9344909be4 100644 > --- a/libavcodec/libaomenc.c > +++ b/libavcodec/libaomenc.c > @@ -49,6 +49,7 @@ struct FrameListData { > > typedef struct AOMEncoderContext { > AVClass *class; > +AVBSFContext *bsf; > struct aom_codec_ctx encoder; > struct aom_image rawimg; > struct aom_fixed_buf twopass_stats; > @@ -189,6 +190,7 @@ static av_cold int aom_free(AVCodecContext *avctx) > av_freep(>twopass_stats.buf); > av_freep(>stats_out); > free_frame_list(ctx->coded_frame_list); > +av_bsf_free(>bsf); > return 0; > } > > @@ -340,6 +342,28 @@ static av_cold int aom_init(AVCodecContext *avctx) > if (!cpb_props) > return AVERROR(ENOMEM); > > +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { > +const AVBitStreamFilter *filter = > av_bsf_get_by_name("extract_extradata"); > +int ret; > + > +if (!filter) { > +av_log(avctx, AV_LOG_ERROR, "extract_extradata bitstream filter " > + "not found. This is a bug, please report it.\n"); > +return AVERROR_BUG; > +} > +ret = av_bsf_alloc(filter, >bsf); > +if (ret < 0) > +return ret; > + > +ret = avcodec_parameters_from_context(ctx->bsf->par_in, avctx); > +if (ret < 0) > + return ret; > + > +ret = av_bsf_init(ctx->bsf); > +if (ret < 0) > + return ret; > +} > + > if (enccfg.rc_end_usage == AOM_CBR || > enccfg.g_pass != AOM_RC_ONE_PASS) { > cpb_props->max_bitrate = avctx->rc_max_rate; > @@ -371,6 +395,7 @@ static inline void cx_pktcpy(struct FrameListData *dst, > static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, >AVPacket *pkt) > { > +AOMContext *ctx = avctx->priv_data; > int ret = ff_alloc_packet(pkt, cx_frame->sz); > if (ret < 0) { > av_log(avctx, AV_LOG_ERROR, > @@ -382,6 +407,22 @@ static int storeframe(AVCodecContext *avctx, struct > FrameListData *cx_frame, > > if (!!(cx_frame->flags & AOM_FRAME_IS_KEY)) > pkt->flags |= AV_PKT_FLAG_KEY; > + > +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { > +ret = av_bsf_send_packet(ctx->bsf, pkt); > +if (ret < 0) { > +av_log(avctx, AV_LOG_ERROR, "extract_extradata filter " > + "failed to send input packet\n"); > +return ret; > +} > +ret = av_bsf_receive_packet(ctx->bsf, pkt); > + > +if (ret < 0) { > +av_log(avctx, AV_LOG_ERROR, "extract_extradata filter " > + "failed to receive output packet\n"); > +return ret; > +} > +} > return pkt->size; > } > > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 9/9] avcodec/extract_extradata_bsf: make sure a Sequence Header was found for av1
On 10/3/2018 4:15 PM, Luca Barbato wrote: > From: James Almer > > A packet may have Metadata OBUs but no Sequence Header OBU, which is > useless as extradata. > > Signed-off-by: James Almer > Signed-off-by: Luca Barbato > --- > libavcodec/extract_extradata_bsf.c | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/extract_extradata_bsf.c > b/libavcodec/extract_extradata_bsf.c > index 2734a7b7d1..9ee2b28d01 100644 > --- a/libavcodec/extract_extradata_bsf.c > +++ b/libavcodec/extract_extradata_bsf.c > @@ -67,7 +67,7 @@ static int extract_extradata_av1(AVBSFContext *ctx, > AVPacket *pkt, > > int extradata_size = 0, filtered_size = 0; > int nb_extradata_obu_types = FF_ARRAY_ELEMS(extradata_obu_types); > -int i, ret = 0; > +int i, has_seq = 0, ret = 0; > > ret = ff_av1_packet_split(>av1_pkt, pkt->data, pkt->size, ctx); > if (ret < 0) > @@ -77,12 +77,14 @@ static int extract_extradata_av1(AVBSFContext *ctx, > AVPacket *pkt, > AV1OBU *obu = >av1_pkt.obus[i]; > if (val_in_array(extradata_obu_types, nb_extradata_obu_types, > obu->type)) { > extradata_size += obu->raw_size; > +if (obu->type == AV1_OBU_SEQUENCE_HEADER) > +has_seq = 1; > } else if (s->remove) { > filtered_size += obu->raw_size; > } > } > > -if (extradata_size) { > +if (extradata_size && has_seq) { > AVBufferRef *filtered_buf; > uint8_t *extradata, *filtered_data; Same, i think this would be better squashed with the previous commit. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/9] avcodec/extract_extradata: Zero-initialize the padding bytes in all allocated buffers
On 10/3/2018 4:15 PM, Luca Barbato wrote: > From: James Almer > > Reviewed-by: Derek Buitenhuis > Signed-off-by: James Almer > Signed-off-by: Luca Barbato > --- > libavcodec/extract_extradata_bsf.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/libavcodec/extract_extradata_bsf.c > b/libavcodec/extract_extradata_bsf.c > index 10d108054a..ed5d90b246 100644 > --- a/libavcodec/extract_extradata_bsf.c > +++ b/libavcodec/extract_extradata_bsf.c > @@ -114,6 +114,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, > AVPacket *pkt, > ret = AVERROR(ENOMEM); > goto fail; > } > +memset(extradata + extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); > > *data = extradata; > *size = extradata_size; > @@ -137,6 +138,8 @@ static int extract_extradata_h2645(AVBSFContext *ctx, > AVPacket *pkt, > pkt->buf = filtered_buf; > pkt->data = filtered_buf->data; > pkt->size = filtered_data - filtered_buf->data; > + > +memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); > } > } > > @@ -171,6 +174,7 @@ static int extract_extradata_vc1(AVBSFContext *ctx, > AVPacket *pkt, > return AVERROR(ENOMEM); > > memcpy(*data, pkt->data, extradata_size); > +memset(*data + extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); > *size = extradata_size; > > if (s->remove) { > @@ -202,6 +206,8 @@ static int extract_extradata_mpeg124(AVBSFContext *ctx, > AVPacket *pkt, > return AVERROR(ENOMEM); > > memcpy(*data, pkt->data, *size); > +memset(*data + *size, 0, AV_INPUT_BUFFER_PADDING_SIZE); > +memset(*data + *size, 0, AV_INPUT_BUFFER_PADDING_SIZE); Duplicated line. LGTM otherwise. > > if (s->remove) { > pkt->data += *size; > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 7/9] avcodec: add AV1 packet split API
On 10/3/2018 4:15 PM, Luca Barbato wrote: > From: James Almer > > Signed-off-by: James Almer > Signed-off-by: Luca Barbato > --- > libavcodec/av1_parse.c | 103 > libavcodec/av1_parse.h | 126 > + > 2 files changed, 229 insertions(+) > create mode 100644 libavcodec/av1_parse.c > create mode 100644 libavcodec/av1_parse.h This got some extra changes after the fact that i think would be best if they are squashed into this commit instead of being separate. Similarly, the actual mp4/matroska changes that came after this got several modifications that followed the evolution of the spec from draft to final, which in some cases meant rewriting the whole thing. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/3] configure: speed up flatten_extralibs_wrapper()
On 9/17/2018 3:49 PM, Diego Biurrun wrote: > On Sun, Sep 16, 2018 at 11:52:59PM -0300, James Almer wrote: >> From: Avi Halachmi >> >> x50 - x200 faster. > > The set looks very interesting. I've had some ideas on how to speed up > this part of configure already, so I'm doubly happy to see some work > done in that area. > > At a first glance these patches seem to apply several optimizations at > once. I'll have to study them in detail. > > There is no flatten_extralibs_wrapper() though... Forgot to rename that while porting the patch from ffmpeg, sorry. On windows this set made a massive difference, going from several minutes down to one. > > Diego > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/3] configure: speed up flatten_extralibs_wrapper()
From: Avi Halachmi x50 - x200 faster. Currently configure spends 50-70% of its runtime inside a single function: flatten_extralibs[_wrapper] - which does string processing. During its run, nearly 20K command substitutions (subshells) are used, including its callees unique() and resolve(), which is the reason for its lengthy run. This commit avoids all subshells during its execution, speeding it up by about two orders of magnitude, and reducing the overall configure runtime by 50-70% . resolve() is rewritten to avoid subshells, and in unique() and flatten_extralibs() we inline the filter[_out] functionality. Note that logically, unique functionality has more than one possible output (depending on which of the recurring items is kept). As it turns out, other parts expect the last recurring item to be kept (which was the original behavior of uniqie()). This patch preservs its output order. Signed-off-by: James Almer --- configure | 46 +- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/configure b/configure index 48e8536b0..be348e881 100755 --- a/configure +++ b/configure @@ -689,22 +689,37 @@ prepend(){ eval "$var=\"$* \$$var\"" } +reverse () { +eval ' +reverse_out= +for v in $'$1'; do +reverse_out="$v $reverse_out" +done +'$1'=$reverse_out +' +} + +# keeps the last occurence of each non-unique item unique(){ -var=$1 -uniq_list="" -for tok in $(eval echo \$$var); do -uniq_list="$(filter_out $tok $uniq_list) $tok" +unique_out= +eval unique_in=\$$1 +reverse unique_in +for v in $unique_in; do +# " $unique_out" +space such that every item is surrounded with spaces +case " $unique_out" in *" $v "*) continue; esac # already in list +unique_out="$unique_out$v " done -eval "$var=\"${uniq_list}\"" +reverse unique_out +eval $1=\$unique_out } resolve(){ -var=$1 -tmpvar= -for entry in $(eval echo \$$var); do -tmpvar="$tmpvar $(eval echo \$${entry})" +resolve_out= +eval resolve_in=\$$1 +for v in $resolve_in; do +eval 'resolve_out="$resolve_out$'$v' "' done -eval "$var=\"${tmpvar}\"" +eval $1=\$resolve_out } add_cppflags(){ @@ -5097,14 +5112,19 @@ check_deps $CONFIG_LIST \ $ALL_COMPONENTS\ flatten_extralibs(){ -unset nested_entries +nested_entries= list_name=$1 eval list=\$${1} for entry in $list; do entry_copy=$entry resolve entry_copy -append nested_entries $(filter '*_extralibs' $entry_copy) -flat_entries=$(filter_out '*_extralibs' $entry_copy) +flat_entries= +for e in $entry_copy; do +case $e in +*_extralibs) nested_entries="$nested_entries$e ";; + *) flat_entries="$flat_entries$e ";; +esac +done eval $entry="\$flat_entries" done append $list_name "$nested_entries" -- 2.19.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 3/3] configure: _deps: validate, reduce sensitivity
From: Avi Halachm - Allow to add deps in any order rather than "in linking order". - Expand deps chains as required rather than just once. - Validate that there are no cycles. - Validate that [after expansion] deps are limited to other fflibs. - Remove expectation for a specific output order of unique(). Previously when adding items to _deps, developers were required to add them in linking order. This can be awkward and bug-prone, especially when a list is not empty, e.g. when adding conditional deps. It also implicitly expected unique() to keep the last instance of recurring items such that these lists maintain their linking order after removing duplicate items. This patch mainly allows to add deps in any order by keeping just one master list in linking order, and then reordering all the _deps lists to align with the master list order. This master list is LIBRARY_LIST itself, where otherwise its order doesn't matter. The patch also removes a limit where these deps lists were expanded only once. This could have resulted in incomplete expanded lists, or forcing devs to add already-deducable deps to avoid this issue. Note: it is possible to deduce the master list order automatically from the deps lists, but in this case it's probably not worth the added complexity, even if minor. Maintaining one list should be OK. Signed-off-by: James Almer --- configure | 41 + 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/configure b/configure index a70136dc1..2a5d411aa 100755 --- a/configure +++ b/configure @@ -1425,13 +1425,13 @@ FEATURE_LIST=" " LIBRARY_LIST=" -avcodec avdevice avfilter +swscale avformat +avcodec avresample avutil -swscale " LICENSE_LIST=" @@ -2616,7 +2616,7 @@ transcode_aac_example_deps="avcodec avformat avresample" cpu_init_extralibs="pthreads_extralibs" cws2fws_extralibs="zlib_extralibs" -# libraries, in linking order +# libraries, in any order avcodec_deps="avutil" avcodec_select="null_bsf" avdevice_deps="avformat avcodec avutil" @@ -5184,7 +5184,7 @@ fi enabled zlib && add_cppflags -DZLIB_CONST -# conditional library dependencies, in linking order +# conditional library dependencies, in any order enabled movie_filter&& prepend avfilter_deps "avformat avcodec" enabled_any asyncts_filter resample_filter && prepend avfilter_deps "avresample" @@ -5192,11 +5192,36 @@ enabled scale_filter&& prepend avfilter_deps "swscale" enabled opus_decoder&& prepend avcodec_deps "avresample" +# reorder the items at var $1 to align with the items order at var $2 . +# die if an item at $1 is not at $2 . +reorder_by(){ +eval rb_in=\$$1 +eval rb_ordered=\$$2 + +for rb in $rb_in; do +is_in $rb $rb_ordered || die "$rb at \$$1 is not at \$$2" +done + +rb_out= +for rb in $rb_ordered; do +is_in $rb $rb_in && rb_out="$rb_out$rb " +done +eval $1=\$rb_out +} + +# deps-expand fflib $1: N x {append all expanded deps; unique} +# within a set of N items, N expansions are enough to expose a cycle. expand_deps(){ -lib_deps=${1}_deps -eval "deps=\$$lib_deps" -append $lib_deps $(map 'eval echo \$${v}_deps' $deps) -unique $lib_deps +unique ${1}_deps # required for the early break test. +for dummy in $LIBRARY_LIST; do # N iteratios +eval deps=\$${1}_deps +append ${1}_deps $(map 'eval echo \$${v}_deps' $deps) +unique ${1}_deps +eval '[ ${#deps} = ${#'${1}_deps'} ]' && break # doesn't expand anymore +done + +eval is_in $1 \$${1}_deps && die "Dependency cycle at ${1}_deps" +reorder_by ${1}_deps LIBRARY_LIST # linking order is expected later } map 'expand_deps $v' $LIBRARY_LIST -- 2.19.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/3] configure: speed up check_deps()
From: Avi Halachm x4 - x25 faster. check_deps() recursively enables/disables components, and its loop is iterated nearly 6000 times. It's particularly slow in bash - currently consuming more than 50% of configure runtime, and about 20% with other shells. This commit applies few local optimizations, most effective first: - Use $1 $2 ... instead of pushvar/popvar, and same at enable_deep* - Abort early in one notable case - empty deps, to avoid costly no-op. - Smaller changes which do add up: - Handle ${cfg}_checking locally instead of via enable[d]/disable - ${cfg}_checking: test done before inprogress - x2 faster in 50%+ - one eval instead of several at the empty-deps early abort path. - The "actual work" part is unmodified - just its surroundings. Biggest speedups (relative and absolute) are observed with bash. Signed-off-by: James Almer --- configure | 83 --- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/configure b/configure index be348e881..a70136dc1 100755 --- a/configure +++ b/configure @@ -532,13 +532,10 @@ disable_sanitized(){ do_enable_deep(){ for var; do enabled $var && continue -eval sel="\$${var}_select" -eval sgs="\$${var}_suggest" -pushvar var sgs -enable_deep $sel -popvar sgs -enable_deep_weak $sgs -popvar var +set -- $var +eval enable_deep \$${var}_select +var=$1 +eval enable_deep_weak \$${var}_suggest done } @@ -550,9 +547,9 @@ enable_deep(){ enable_deep_weak(){ for var; do disabled $var && continue -pushvar var +set -- $var do_enable_deep $var -popvar var +var=$1 enable_weak $var done } @@ -609,38 +606,44 @@ is_in(){ check_deps(){ for cfg; do -enabled ${cfg}_checking && die "Circular dependency for $cfg." -disabled ${cfg}_checking && continue -enable ${cfg}_checking - -eval dep_all="\$${cfg}_deps" -eval dep_any="\$${cfg}_deps_any" -eval dep_con="\$${cfg}_conflict" -eval dep_sel="\$${cfg}_select" -eval dep_sgs="\$${cfg}_suggest" -eval dep_ifa="\$${cfg}_if" -eval dep_ifn="\$${cfg}_if_any" - -pushvar cfg dep_all dep_any dep_con dep_sel dep_sgs dep_ifa dep_ifn -check_deps $dep_all $dep_any $dep_con $dep_sel $dep_sgs $dep_ifa $dep_ifn -popvar cfg dep_all dep_any dep_con dep_sel dep_sgs dep_ifa dep_ifn - -[ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; } -[ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; } -enabled_all $dep_all || disable $cfg -enabled_any $dep_any || disable $cfg -disabled_all $dep_con || disable $cfg -disabled_any $dep_sel && disable $cfg - -enabled $cfg && enable_deep_weak $dep_sel $dep_sgs - -for dep in $dep_all $dep_any $dep_sel $dep_sgs; do -# filter out library deps, these do not belong in extralibs -is_in $dep $LIBRARY_LIST && continue -enabled $dep && eval append ${cfg}_extralibs ${dep}_extralibs -done +eval [ x\$${cfg}_checking = xdone ] && continue +eval [ x\$${cfg}_checking = xinprogress ] && die "Circular dependency for $cfg." + +eval " +dep_all=\$${cfg}_deps +dep_any=\$${cfg}_deps_any +dep_con=\$${cfg}_conflict +dep_sel=\$${cfg}_select +dep_sgs=\$${cfg}_suggest +dep_ifa=\$${cfg}_if +dep_ifn=\$${cfg}_if_any +" + +# most of the time here $cfg has no deps - avoid costly no-op work +if [ "$dep_all$dep_any$dep_con$dep_sel$dep_sgs$dep_ifa$dep_ifn" ]; then +eval ${cfg}_checking=inprogress + +set -- $cfg "$dep_all" "$dep_any" "$dep_con" "$dep_sel" "$dep_sgs" "$dep_ifa" "$dep_ifn" +check_deps $dep_all $dep_any $dep_con $dep_sel $dep_sgs $dep_ifa $dep_ifn +cfg=$1; dep_all=$2; dep_any=$3; dep_con=$4; dep_sel=$5 dep_sgs=$6; dep_ifa=$7; dep_ifn=$8 + +[ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; } +[ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; } +enabled_all $dep_all || disable $cfg +enabled_any $dep_any || disable $cfg +disabled_all $dep_con || disable $cfg +disabled_any $dep_sel && disable $cfg + +enabled $cfg && enable_deep_weak $dep_sel
Re: [libav-devel] [PATCH] Revert "decode: copy the output parameters from the last bsf in the chain back to the AVCodecContext"
On 9/13/2018 9:35 AM, Luca Barbato wrote: > On 12/09/2018 20:24, James Almer wrote: >> This reverts commit 662558f985f50834eebe82d6b6854c66f33ab320. >> >> The avcodec_parameters_to_context() call was freeing and reallocating >> AVCodecContext->extradata, essentially taking ownership of it, which >> according >> to the doxy is user owned. This is an API break and has produces crashes in >> some library users like Firefox. >> Revert until a better solution is found to internally propagate the filtered >> extradata back into the decoder context. > > The doxy says: > > * - decoding: Set/allocated/freed by user. Yes, meaning the user could just set this pointer to some buffer they intend to reuse and free long after they closed and freed the AVCodecContext. If libavcodec goes and tries to replace it, taking ownership of it, then things can go very wrong. For that matter, commit fd056029f45a9f6d213d9fce8165632042511d4f already made that doxy obsolete by introducing avcodec_free_context() which unconditionally frees extradata right after calling avcodec_close(), a function that was doing it as well but only when it's an encoder. The reason that commit didn't generate any widespread issues like this one is because said users never migrated to avcodec_free_context() to free the AVCodecContext. Any suggestion on what to do? The above commit by Anton is four years old. Do we make it official in the doxy that extradata is to be allocated by the user (using av_malloc() functions) but then ownership is passed to libavcodec after an avcodec_open2() call? It would require to change how avcodec_close() frees the extradata as well. > > We could be more explicit on what you can do with it though. > >> Signed-off-by: James Almer >> --- >> See https://bugzilla.mozilla.org/show_bug.cgi?id=1486080 >> >> Suggestions to work around it are very welcome, of course. While no bitstream >> filter currently autoinserted by a decoder requires the filtered extradata to >> be propagated to work properly, we don't know what may be needed in the >> future, >> and without this the usability of bsfs in decoders is potentially limited. > > We already have AV_PKT_DATA_NEW_EXTRADATA to deal with extradata changes > at the demuxer level, we might reuse it. > > I'm fine with the revert. > > lu > > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] Revert "decode: copy the output parameters from the last bsf in the chain back to the AVCodecContext"
This reverts commit 662558f985f50834eebe82d6b6854c66f33ab320. The avcodec_parameters_to_context() call was freeing and reallocating AVCodecContext->extradata, essentially taking ownership of it, which according to the doxy is user owned. This is an API break and has produces crashes in some library users like Firefox. Revert until a better solution is found to internally propagate the filtered extradata back into the decoder context. Signed-off-by: James Almer --- See https://bugzilla.mozilla.org/show_bug.cgi?id=1486080 Suggestions to work around it are very welcome, of course. While no bitstream filter currently autoinserted by a decoder requires the filtered extradata to be propagated to work properly, we don't know what may be needed in the future, and without this the usability of bsfs in decoders is potentially limited. libavcodec/decode.c | 4 1 file changed, 4 deletions(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index d10a2c8b5..2dab7f2a7 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -221,10 +221,6 @@ int ff_decode_bsfs_init(AVCodecContext *avctx) goto fail; } -ret = avcodec_parameters_to_context(avctx, s->bsfs[s->nb_bsfs - 1]->par_out); -if (ret < 0) -return ret; - return 0; fail: ff_decode_bsfs_uninit(avctx); -- 2.19.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 5/7] avcodec/h264_redundant_pps_bsf: implement a AVBSFContext.flush() callback
Signed-off-by: James Almer --- libavcodec/h264_redundant_pps_bsf.c | 9 + 1 file changed, 9 insertions(+) diff --git a/libavcodec/h264_redundant_pps_bsf.c b/libavcodec/h264_redundant_pps_bsf.c index 24b7b6730..d806427da 100644 --- a/libavcodec/h264_redundant_pps_bsf.c +++ b/libavcodec/h264_redundant_pps_bsf.c @@ -35,6 +35,7 @@ typedef struct H264RedundantPPSContext { int global_pic_init_qp; int current_pic_init_qp; +int extradata_pic_init_qp; } H264RedundantPPSContext; @@ -145,6 +146,7 @@ static int h264_redundant_pps_init(AVBSFContext *bsf) h264_redundant_pps_fixup_pps(ctx, au->units[i].content); } +ctx->extradata_pic_init_qp = ctx->current_pic_init_qp; err = ff_cbs_write_extradata(ctx->output, bsf->par_out, au); if (err < 0) { av_log(bsf, AV_LOG_ERROR, "Failed to write extradata.\n"); @@ -157,6 +159,12 @@ static int h264_redundant_pps_init(AVBSFContext *bsf) return 0; } +static void h264_redundant_pps_flush(AVBSFContext *bsf) +{ +H264RedundantPPSContext *ctx = bsf->priv_data; +ctx->current_pic_init_qp = ctx->extradata_pic_init_qp; +} + static void h264_redundant_pps_close(AVBSFContext *bsf) { H264RedundantPPSContext *ctx = bsf->priv_data; @@ -172,6 +180,7 @@ const AVBitStreamFilter ff_h264_redundant_pps_bsf = { .name = "h264_redundant_pps", .priv_data_size = sizeof(H264RedundantPPSContext), .init = _redundant_pps_init, +.flush = _redundant_pps_flush, .close = _redundant_pps_close, .filter = _redundant_pps_filter, .codec_ids = h264_redundant_pps_codec_ids, -- 2.18.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/7] avcodec/bsf: add a flushing mechanism to AVBSFContext
Meant to reset the internal bsf state without the need to reinitialize it. Signed-off-by: James Almer --- doc/APIchanges | 3 +++ libavcodec/avcodec.h | 6 ++ libavcodec/bsf.c | 10 ++ libavcodec/version.h | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index d385d73b0..9ba03648c 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2017-03-23 API changes, most recent first: +2018-xx-xx - xxx - lavc 58.10.0 - avcodec.h + Add av_bsf_flush(). + 2018-02-xx - xxx - lavfi 7.1.0 - avfilter.h Add AVFilterContext.extra_hw_frames. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index eb234a40d..fb8e34e7d 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -4927,6 +4927,7 @@ typedef struct AVBitStreamFilter { int (*init)(AVBSFContext *ctx); int (*filter)(AVBSFContext *ctx, AVPacket *pkt); void (*close)(AVBSFContext *ctx); +void (*flush)(AVBSFContext *ctx); } AVBitStreamFilter; #if FF_API_OLD_BSF @@ -5029,6 +5030,11 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt); */ int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt); +/** + * Reset the internal bitstream filter state / flush internal buffers. + */ +void av_bsf_flush(AVBSFContext *ctx); + /** * Free a bitstream filter context and everything associated with it; write NULL * into the supplied pointer. diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index 284c7c804..05cad546d 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -170,6 +170,16 @@ int av_bsf_init(AVBSFContext *ctx) return 0; } +void av_bsf_flush(AVBSFContext *ctx) +{ +ctx->internal->eof = 0; + +av_packet_unref(ctx->internal->buffer_pkt); + +if (ctx->filter->flush) +ctx->filter->flush(ctx); +} + int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) { if (!pkt || !pkt->data) { diff --git a/libavcodec/version.h b/libavcodec/version.h index 36a014959..32486a83c 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 9 +#define LIBAVCODEC_VERSION_MINOR 10 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ -- 2.18.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 4/7] avcodec/vp9_superframe_bsf: implement a AVBSFContext.flush() callback
Signed-off-by: James Almer --- libavcodec/vp9_superframe_bsf.c | 12 1 file changed, 12 insertions(+) diff --git a/libavcodec/vp9_superframe_bsf.c b/libavcodec/vp9_superframe_bsf.c index ad66cb599..04b158fa1 100644 --- a/libavcodec/vp9_superframe_bsf.c +++ b/libavcodec/vp9_superframe_bsf.c @@ -191,6 +191,17 @@ static int vp9_superframe_init(AVBSFContext *ctx) return 0; } +static void vp9_superframe_flush(AVBSFContext *ctx) +{ +VP9BSFContext *s = ctx->priv_data; +int n; + +// unref cached data +for (n = 0; n < s->n_cache; n++) +av_packet_unref(s->cache[n]); +s->n_cache = 0; +} + static void vp9_superframe_close(AVBSFContext *ctx) { VP9BSFContext *s = ctx->priv_data; @@ -210,6 +221,7 @@ const AVBitStreamFilter ff_vp9_superframe_bsf = { .priv_data_size = sizeof(VP9BSFContext), .filter = vp9_superframe_filter, .init = vp9_superframe_init, +.flush = vp9_superframe_flush, .close = vp9_superframe_close, .codec_ids = codec_ids, }; -- 2.18.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 6/7] avcodec/decode: flush the internal bsfs instead of constantly reinitalizing them
Initialize the bsfs once when opening the codec and uninitialize them once when closing it, instead of at every codec flush/seek. Signed-off-by: James Almer --- I think i didn't miss any bsf with internal state that needs a flush() callback, but an extra pair of eyes (or more) to make sure would come in handy. In any case, the only bsfs where this matters are those used during decoding, which essentially means those autoinserted by decoders given that the cli doesn't allow -bsf as an input option. But you can't know what an API user may do, so better get them all right. libavcodec/decode.c | 20 ++-- libavcodec/decode.h | 2 ++ libavcodec/utils.c | 5 + 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 8635aec94..2dab7f2a7 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -156,7 +156,7 @@ static int unrefcount_frame(AVCodecInternal *avci, AVFrame *frame) return 0; } -static int bsfs_init(AVCodecContext *avctx) +int ff_decode_bsfs_init(AVCodecContext *avctx) { AVCodecInternal *avci = avctx->internal; DecodeFilterContext *s = >filter; @@ -449,10 +449,6 @@ int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const AVPacke if (avctx->internal->draining) return AVERROR_EOF; -ret = bsfs_init(avctx); -if (ret < 0) -return ret; - av_packet_unref(avci->buffer_pkt); if (avpkt && (avpkt->data || avpkt->side_data_elems)) { ret = av_packet_ref(avci->buffer_pkt, avpkt); @@ -511,10 +507,6 @@ int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr if (!avcodec_is_open(avctx) || !av_codec_is_decoder(avctx->codec)) return AVERROR(EINVAL); -ret = bsfs_init(avctx); -if (ret < 0) -return ret; - if (avci->buffer_frame->buf[0]) { av_frame_move_ref(frame, avci->buffer_frame); } else { @@ -1394,6 +1386,14 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame) return 0; } +static void bsfs_flush(AVCodecContext *avctx) +{ +DecodeFilterContext *s = >internal->filter; + +for (int i = 0; i < s->nb_bsfs; i++) +av_bsf_flush(s->bsfs[i]); +} + void avcodec_flush_buffers(AVCodecContext *avctx) { avctx->internal->draining = 0; @@ -1410,7 +1410,7 @@ void avcodec_flush_buffers(AVCodecContext *avctx) else if (avctx->codec->flush) avctx->codec->flush(avctx); -ff_decode_bsfs_uninit(avctx); +bsfs_flush(avctx); if (!avctx->refcounted_frames) av_frame_unref(avctx->internal->to_free); diff --git a/libavcodec/decode.h b/libavcodec/decode.h index 37b2e45c6..4a76d7a85 100644 --- a/libavcodec/decode.h +++ b/libavcodec/decode.h @@ -69,6 +69,8 @@ typedef struct FrameDecodeData { */ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt); +int ff_decode_bsfs_init(AVCodecContext *avctx); + void ff_decode_bsfs_uninit(AVCodecContext *avctx); /** diff --git a/libavcodec/utils.c b/libavcodec/utils.c index ba3457664..13d9e4e62 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -664,6 +664,10 @@ FF_ENABLE_DEPRECATION_WARNINGS ret = AVERROR(EINVAL); goto free_and_end; } + +ret = ff_decode_bsfs_init(avctx); +if (ret < 0) +goto free_and_end; } end: if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && codec->init) { @@ -706,6 +710,7 @@ FF_ENABLE_DEPRECATION_WARNINGS av_packet_free(>internal->last_pkt_props); av_packet_free(>internal->ds.in_pkt); +ff_decode_bsfs_uninit(avctx); av_freep(>internal->pool); } -- 2.18.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 3/7] avcodec/vp9_superframe_split_bsf: implement a AVBSFContext.flush() callback
Signed-off-by: James Almer --- libavcodec/vp9_superframe_split_bsf.c | 9 + 1 file changed, 9 insertions(+) diff --git a/libavcodec/vp9_superframe_split_bsf.c b/libavcodec/vp9_superframe_split_bsf.c index 4e635a307..4e6e7ff08 100644 --- a/libavcodec/vp9_superframe_split_bsf.c +++ b/libavcodec/vp9_superframe_split_bsf.c @@ -131,6 +131,14 @@ fail: return ret; } +static void vp9_superframe_split_flush(AVBSFContext *ctx) +{ +VP9SFSplitContext *s = ctx->priv_data; + +av_packet_free(>buffer_pkt); +memset(s, 0, sizeof(*s)); +} + static void vp9_superframe_split_uninit(AVBSFContext *ctx) { VP9SFSplitContext *s = ctx->priv_data; @@ -142,5 +150,6 @@ const AVBitStreamFilter ff_vp9_superframe_split_bsf = { .priv_data_size = sizeof(VP9SFSplitContext), .close = vp9_superframe_split_uninit, .filter = vp9_superframe_split_filter, +.flush = vp9_superframe_split_flush, .codec_ids = (const enum AVCodecID []){ AV_CODEC_ID_VP9, AV_CODEC_ID_NONE }, }; -- 2.18.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/7] avcodec/h264_mp4toannexb_bsf: implement a AVBSFContext.flush() callback
Signed-off-by: James Almer --- libavcodec/h264_mp4toannexb_bsf.c | 8 1 file changed, 8 insertions(+) diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index c65aaeb98..c45ecd8ce 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -232,6 +232,13 @@ fail: return ret; } +static void h264_mp4toannexb_flush(AVBSFContext *ctx) +{ +H264BSFContext *s = ctx->priv_data; + +s->first_idr = s->extradata_parsed; +} + static const enum AVCodecID codec_ids[] = { AV_CODEC_ID_H264, AV_CODEC_ID_NONE, }; @@ -241,5 +248,6 @@ const AVBitStreamFilter ff_h264_mp4toannexb_bsf = { .priv_data_size = sizeof(H264BSFContext), .init = h264_mp4toannexb_init, .filter = h264_mp4toannexb_filter, +.flush = h264_mp4toannexb_flush, .codec_ids = codec_ids, }; -- 2.18.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 7/7] avcodec/decode: copy the output parameters from the last bsf in the chain back to the AVCodecContext
Certain AVCodecParameters, like the contents of the extradata, may be changed by the init() function of any of the bitstream filters in the chain. Signed-off-by: James Almer --- libavcodec/decode.c | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 2dab7f2a7..d10a2c8b5 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -221,6 +221,10 @@ int ff_decode_bsfs_init(AVCodecContext *avctx) goto fail; } +ret = avcodec_parameters_to_context(avctx, s->bsfs[s->nb_bsfs - 1]->par_out); +if (ret < 0) +return ret; + return 0; fail: ff_decode_bsfs_uninit(avctx); -- 2.18.0 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] configure: fix inline asm checks
On 6/7/2018 6:01 PM, Diego Biurrun wrote: > On Thu, Jun 07, 2018 at 03:03:21PM +0300, Martin Storsjö wrote: >> Commit 8c893aa3cd5 removed quotes that were required to detect >> inline asm: >> >> check_insn armv5te qadd r0, r0, r0 >> .../test.c:1:34: error: expected string literal in 'asm' >> void foo(void){ __asm__ volatile(qadd r0, r0, r0); } >> >> The correct code is: >> >> void foo(void){ __asm__ volatile("qadd r0, r0, r0"); } >> --- a/configure >> +++ b/configure >> @@ -866,7 +866,7 @@ EOF >> check_insn(){ >> log check_insn "$@" >> -check_inline_asm ${1}_inline "$2" >> +check_inline_asm ${1}_inline "\"$2\"" >> check_as ${1}_external "$2" >> } > > This does not look like the correct fix to me. The required quotes > should be part of the convenience function instead. Notice how calls > to check_insn and check_inline_asm differ in the way they quote their > arguments. There should be no need for this inconsistency. > > I'll look into it. Changing all the calls from check_insn name 'insn' to check_insn name '"insn"' would probably fix the check_inline_asm tests, but may break the check_as tests. I don't have an arm or qemu system to confirm the above, though. > > Diego > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] random_seed: use bcrypt instead of the old wincrypt API
On 4/15/2018 5:17 PM, Martin Storsjö wrote: > From: Steve Lhomme> > Remove the wincrypt API calls since we don't support XP anymore and > bcrypt is available since Vista, even on Windows Store builds. > --- > configure | 6 +++--- > libavutil/random_seed.c | 19 ++- > 2 files changed, 13 insertions(+), 12 deletions(-) > > diff --git a/configure b/configure > index 3c7b6a0981..0eba9b24f3 100755 > --- a/configure > +++ b/configure > @@ -1703,12 +1703,12 @@ SYSTEM_FUNCS=" > " > > SYSTEM_LIBRARIES=" > +bcrypt > sdl > vaapi_1 > vaapi_drm > vaapi_x11 > vdpau_x11 > -wincrypt > " > > TOOLCHAIN_FEATURES=" > @@ -2610,7 +2610,7 @@ avdevice_extralibs="libm_extralibs" > avformat_extralibs="libm_extralibs" > avfilter_extralibs="pthreads_extralibs libm_extralibs" > avresample_extralibs="libm_extralibs" > -avutil_extralibs="clock_gettime_extralibs cuda_extralibs cuvid_extralibs > d3d11va_extralibs libm_extralibs libmfx_extralibs nanosleep_extralibs > pthreads_extralibs user32_extralibs vaapi_extralibs vaapi_drm_extralibs > vaapi_x11_extralibs vdpau_x11_extralibs wincrypt_extralibs" > +avutil_extralibs="clock_gettime_extralibs cuda_extralibs cuvid_extralibs > d3d11va_extralibs libm_extralibs libmfx_extralibs nanosleep_extralibs > pthreads_extralibs user32_extralibs vaapi_extralibs vaapi_drm_extralibs > vaapi_x11_extralibs vdpau_x11_extralibs bcrypt_extralibs" > swscale_extralibs="libm_extralibs" > > # programs > @@ -4579,9 +4579,9 @@ check_header windows.h > # so we also check that atomics actually work here > check_builtin stdatomic stdatomic.h "atomic_int foo; atomic_store(, 0)" > > +check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt > check_lib ole32"windows.h"CoTaskMemFree-lole32 > check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32 > -check_lib wincrypt "windows.h wincrypt.h" CryptGenRandom -ladvapi32 > check_lib psapi"windows.h psapi.h"GetProcessMemoryInfo -lpsapi > > check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss > diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c > index 089d883916..388cb401ba 100644 > --- a/libavutil/random_seed.c > +++ b/libavutil/random_seed.c > @@ -23,9 +23,9 @@ > #if HAVE_UNISTD_H > #include > #endif > -#if HAVE_WINCRYPT > +#if HAVE_BCRYPT > #include > -#include > +#include > #endif > #include > #include > @@ -96,13 +96,14 @@ uint32_t av_get_random_seed(void) > { > uint32_t seed; > > -#if HAVE_WINCRYPT > -HCRYPTPROV provider; > -if (CryptAcquireContext(, NULL, NULL, PROV_RSA_FULL, > -CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) { > -BOOL ret = CryptGenRandom(provider, sizeof(seed), (PBYTE) ); > -CryptReleaseContext(provider, 0); > -if (ret) > +#if HAVE_BCRYPT > +BCRYPT_ALG_HANDLE algo_handle; > +NTSTATUS ret = BCryptOpenAlgorithmProvider(_handle, > BCRYPT_RNG_ALGORITHM, > + MS_PRIMITIVE_PROVIDER, 0); FWIW, there seems to be an old mingw-w64 release that has bcrypt.h, the BCryptGenRandom and BCryptOpenAlgorithmProvider prototypes, but it's missing defines like BCRYPT_RNG_ALGORITHM, MS_PRIMITIVE_PROVIDER and BCRYPT_SUCCESS. An extra check for the latter like check_cpp_condition bcrypt bcrypt.h "defined BCRYPT_RNG_ALGORITHM" would be needed to disable bcrypt on those broken/incomplete toolchains and prevent compilation failures. > +if (BCRYPT_SUCCESS(ret)) { > +NTSTATUS ret = BCryptGenRandom(algo_handle, (UCHAR*), > sizeof(seed), 0); > +BCryptCloseAlgorithmProvider(algo_handle, 0); > +if (BCRYPT_SUCCESS(ret)) > return seed; > } > #endif > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] aac: Rework extradata parsing code
On 4/13/2018 11:43 AM, wm4 wrote: > On Fri, 13 Apr 2018 09:22:30 +0900 > Luca Barbatowrote: > >> On 13/04/2018 06:44, Vittorio Giovara wrote: >>> -if (new_extradata && 0) { >> >> Uh? > > > faa2930f191099621e03c55cca32662467d3cc15 > > flvdec: reenable extradata passing code What flv sample had issues before that commit? Would be best to make sure it still works before applying this patch. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] libaom: remove references to RGB pixfmts
Support for it was apparently never in the codebase, and the enum values were recently removed from the public headers [1] Fixes build with latest libaom build. [1] https://aomedia.googlesource.com/aom/+/3f29cc20e3a4c348cb41a797c68de856ddb84e12 Signed-off-by: James Almer <jamr...@gmail.com> --- libavcodec/libaom.c | 44 1 file changed, 44 deletions(-) diff --git a/libavcodec/libaom.c b/libavcodec/libaom.c index f083129f4..512095b33 100644 --- a/libavcodec/libaom.c +++ b/libavcodec/libaom.c @@ -38,28 +38,6 @@ case AOM_IMG_FMT_I ## fmt ## 16: \ enum AVPixelFormat ff_aom_imgfmt_to_pixfmt(aom_img_fmt_t img, int depth) { switch (img) { -case AOM_IMG_FMT_RGB24: -return AV_PIX_FMT_RGB24; -case AOM_IMG_FMT_RGB565: -return AV_PIX_FMT_RGB565BE; -case AOM_IMG_FMT_RGB555: -return AV_PIX_FMT_RGB555BE; -case AOM_IMG_FMT_UYVY: -return AV_PIX_FMT_UYVY422; -case AOM_IMG_FMT_YUY2: -return AV_PIX_FMT_YUYV422; -case AOM_IMG_FMT_YVYU: -return AV_PIX_FMT_YVYU422; -case AOM_IMG_FMT_BGR24: -return AV_PIX_FMT_BGR24; -case AOM_IMG_FMT_ARGB: -return AV_PIX_FMT_ARGB; -case AOM_IMG_FMT_ARGB_LE: -return AV_PIX_FMT_BGRA; -case AOM_IMG_FMT_RGB565_LE: -return AV_PIX_FMT_RGB565LE; -case AOM_IMG_FMT_RGB555_LE: -return AV_PIX_FMT_RGB555LE; case AOM_IMG_FMT_I420: return AV_PIX_FMT_YUV420P; case AOM_IMG_FMT_I422: @@ -81,28 +59,6 @@ enum AVPixelFormat ff_aom_imgfmt_to_pixfmt(aom_img_fmt_t img, int depth) aom_img_fmt_t ff_aom_pixfmt_to_imgfmt(enum AVPixelFormat pix) { switch (pix) { -case AV_PIX_FMT_RGB24: -return AOM_IMG_FMT_RGB24; -case AV_PIX_FMT_RGB565BE: -return AOM_IMG_FMT_RGB565; -case AV_PIX_FMT_RGB555BE: -return AOM_IMG_FMT_RGB555; -case AV_PIX_FMT_UYVY422: -return AOM_IMG_FMT_UYVY; -case AV_PIX_FMT_YUYV422: -return AOM_IMG_FMT_YUY2; -case AV_PIX_FMT_YVYU422: -return AOM_IMG_FMT_YVYU; -case AV_PIX_FMT_BGR24: -return AOM_IMG_FMT_BGR24; -case AV_PIX_FMT_ARGB: -return AOM_IMG_FMT_ARGB; -case AV_PIX_FMT_BGRA: -return AOM_IMG_FMT_ARGB_LE; -case AV_PIX_FMT_RGB565LE: -return AOM_IMG_FMT_RGB565_LE; -case AV_PIX_FMT_RGB555LE: -return AOM_IMG_FMT_RGB555_LE; case AV_PIX_FMT_YUV420P: return AOM_IMG_FMT_I420; case AV_PIX_FMT_YUV422P: -- 2.16.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] libaom: remove references to yuv440p pixfmt
Support for it was apparently never in the codebase, and the enum values were recently removed from the public headers [1] Fixes build with latest libaom build. [1] https://aomedia.googlesource.com/aom/+/2e3cd5c5c30fa02134681cda900c32486807af3f Signed-off-by: James Almer <jamr...@gmail.com> --- libavcodec/libaom.c | 4 1 file changed, 4 deletions(-) diff --git a/libavcodec/libaom.c b/libavcodec/libaom.c index 220b1bd24..f083129f4 100644 --- a/libavcodec/libaom.c +++ b/libavcodec/libaom.c @@ -68,8 +68,6 @@ enum AVPixelFormat ff_aom_imgfmt_to_pixfmt(aom_img_fmt_t img, int depth) return AV_PIX_FMT_YUV444P; case AOM_IMG_FMT_444A: return AV_PIX_FMT_YUVA444P; -case AOM_IMG_FMT_I440: -return AV_PIX_FMT_YUV440P; HIGH_DEPTH(420) HIGH_DEPTH(422) HIGH_DEPTH(444) @@ -113,8 +111,6 @@ aom_img_fmt_t ff_aom_pixfmt_to_imgfmt(enum AVPixelFormat pix) return AOM_IMG_FMT_I444; case AV_PIX_FMT_YUVA444P: return AOM_IMG_FMT_444A; -case AV_PIX_FMT_YUV440P: -return AOM_IMG_FMT_I440; case AV_PIX_FMT_YUV420P10: return AOM_IMG_FMT_I42016; case AV_PIX_FMT_YUV422P10: -- 2.16.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] use bcrypt instead of the old wincrypt API
On 3/30/2018 3:13 PM, Martin Storsjö wrote: > On Fri, 30 Mar 2018, James Almer wrote: > >> On 3/30/2018 10:57 AM, Martin Storsjö wrote: >>> On Fri, 30 Mar 2018, Diego Biurrun wrote: >>> >>>> On Fri, Mar 30, 2018 at 10:43:27AM -0300, James Almer wrote: >>>>> On 3/30/2018 10:38 AM, Diego Biurrun wrote: >>>>> > On Fri, Mar 30, 2018 at 12:38:05PM +0200, Steve Lhomme wrote: >>>>> >> Le 30/03/2018 à 10:46, Diego Biurrun a écrit : >>>>> >>> On Fri, Mar 30, 2018 at 09:36:05AM +0200, Steve Lhomme wrote: >>>>> >>>> --- a/configure >>>>> >>>> +++ b/configure >>>>> >>>> @@ -4581,6 +4582,7 @@ check_lib ole32 "windows.h" >>>>> CoTaskMemFree -lole32 >>>>> >>>> check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW >>>>> -lshell32 >>>>> >>>> check_lib wincrypt "windows.h wincrypt.h" CryptGenRandom >>>>> -ladvapi32 >>>>> >>>> check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo >>>>> -lpsapi >>>>> >>>> +check_cpp_condition Vista+ windows.h "_WIN32_WINNT >= 0x0600" >>>>> && check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt >>>>> >>>>> If you don't need to set any variable then just use >>>>> test_cpp_condition() >>>> >>>> Yes, good point. >>>> >>>>> >>> Do you really need to check the Vista condition? What about using >>>>> bcrypt >>>>> >>> unconditionally if available? >>>>> >> >>>>> >> Yes, you need to use it only on builds that won't run on XP. >>>>> Otherwise it >>>>> >> will fail to load the bcrypt.dll and the whole libavutil DLL (or >>>>> whatever >>>>> >> its form) will fail to load. It would be possible to do it >>>>> dynamically but >>>>> >> IMO it's overkill. It's not really a critical component. >>>>> > > Is bcrypt available on XP? If no then the CPP condition check >>>>> would seem >>>>> > unnecessary. You could just check for bcrypt and bcrypt being >>>>> available >>>>> > would imply Vista. I think I'm missing something. >>>>> >>>>> check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt >>>>> >>>>> Seems to succeed even if targeting XP, at least on mingw-w64. >>>> >>>> Isn't that wrong then? >>> >>> I guess it just means that mingw-w64 doesn't have _WIN32_WINNT ifdefs >>> guarding the availability of this function in the headers. (The official >>> windows SDK might, although that SDK also have dropped XP support long >>> ago iirc.) >> >> bcrypt.h on mingw-w64 is completely wrapped in checks like >> >> #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || _WIN32_WINNT >>> = 0x0A00 >> >> The former is the reason it succeeds in XP, seeing the latter is >> checking for Windows 10 or newer. > > Hmm, ok. I guess the correct form would be something like > "(WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) && _WIN32_WINNT >= > 0x0600) || _WIN32_WINNT >= 0x0A00" then. > > // Martin The WINAPI_PARTITION_DESKTOP check is already done in configure to enable or disable the uwp variable. In any case, does this mean that on uwp neither BCryptGenRandom or CryptGenRandom are available/allowed? ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] use bcrypt instead of the old wincrypt API
On 3/30/2018 10:57 AM, Martin Storsjö wrote: > On Fri, 30 Mar 2018, Diego Biurrun wrote: > >> On Fri, Mar 30, 2018 at 10:43:27AM -0300, James Almer wrote: >>> On 3/30/2018 10:38 AM, Diego Biurrun wrote: >>> > On Fri, Mar 30, 2018 at 12:38:05PM +0200, Steve Lhomme wrote: >>> >> Le 30/03/2018 à 10:46, Diego Biurrun a écrit : >>> >>> On Fri, Mar 30, 2018 at 09:36:05AM +0200, Steve Lhomme wrote: >>> >>>> --- a/configure >>> >>>> +++ b/configure >>> >>>> @@ -4581,6 +4582,7 @@ check_lib ole32 "windows.h" >>> CoTaskMemFree -lole32 >>> >>>> check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW >>> -lshell32 >>> >>>> check_lib wincrypt "windows.h wincrypt.h" CryptGenRandom >>> -ladvapi32 >>> >>>> check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo >>> -lpsapi >>> >>>> +check_cpp_condition Vista+ windows.h "_WIN32_WINNT >= 0x0600" >>> && check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt >>> >>> If you don't need to set any variable then just use test_cpp_condition() >> >> Yes, good point. >> >>> >>> Do you really need to check the Vista condition? What about using >>> bcrypt >>> >>> unconditionally if available? >>> >> >>> >> Yes, you need to use it only on builds that won't run on XP. >>> Otherwise it >>> >> will fail to load the bcrypt.dll and the whole libavutil DLL (or >>> whatever >>> >> its form) will fail to load. It would be possible to do it >>> dynamically but >>> >> IMO it's overkill. It's not really a critical component. >>> > > Is bcrypt available on XP? If no then the CPP condition check >>> would seem >>> > unnecessary. You could just check for bcrypt and bcrypt being >>> available >>> > would imply Vista. I think I'm missing something. >>> >>> check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt >>> >>> Seems to succeed even if targeting XP, at least on mingw-w64. >> >> Isn't that wrong then? > > I guess it just means that mingw-w64 doesn't have _WIN32_WINNT ifdefs > guarding the availability of this function in the headers. (The official > windows SDK might, although that SDK also have dropped XP support long > ago iirc.) bcrypt.h on mingw-w64 is completely wrapped in checks like #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || _WIN32_WINNT >= 0x0A00 The former is the reason it succeeds in XP, seeing the latter is checking for Windows 10 or newer. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] use bcrypt instead of the old wincrypt API
On 3/30/2018 10:38 AM, Diego Biurrun wrote: > On Fri, Mar 30, 2018 at 12:38:05PM +0200, Steve Lhomme wrote: >> Le 30/03/2018 à 10:46, Diego Biurrun a écrit : >>> On Fri, Mar 30, 2018 at 09:36:05AM +0200, Steve Lhomme wrote: --- a/configure +++ b/configure @@ -4581,6 +4582,7 @@ check_lib ole32"windows.h" CoTaskMemFree-lole32 check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32 check_lib wincrypt "windows.h wincrypt.h" CryptGenRandom -ladvapi32 check_lib psapi"windows.h psapi.h"GetProcessMemoryInfo -lpsapi +check_cpp_condition Vista+ windows.h "_WIN32_WINNT >= 0x0600" && check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt If you don't need to set any variable then just use test_cpp_condition() >>> Do you really need to check the Vista condition? What about using bcrypt >>> unconditionally if available? >> >> Yes, you need to use it only on builds that won't run on XP. Otherwise it >> will fail to load the bcrypt.dll and the whole libavutil DLL (or whatever >> its form) will fail to load. It would be possible to do it dynamically but >> IMO it's overkill. It's not really a critical component. > > Is bcrypt available on XP? If no then the CPP condition check would seem > unnecessary. You could just check for bcrypt and bcrypt being available > would imply Vista. I think I'm missing something. check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt Seems to succeed even if targeting XP, at least on mingw-w64. > >> But with time if XP support is dropped this check can go and wincrypt >> dropped entirely. > > Is it maybe time to consider dropping XP support? > >>> The variable name with an uppercase letter >>> and a '+' is slightly odd. I'm not sure if it can cause problems but I >>> cannot rule it out offhand either. >> >> It seems the same is only used in config.log. And the + didn't cause any >> problem for me. > > I remain sceptical; "it worked for me" is usually not a good argument when > considering edge cases ;) > > Diego > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/2] libaomenc: fix profile setting
Main Profile is yuv420p 8 and 10 bit High Profile is yuv444p 8 and 10 bit Professional Profile is yuv422p 8, 10, and 12 bit, plus every other pixfmt at 12 bit Signed-off-by: James Almer <jamr...@gmail.com> --- libavcodec/libaomenc.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index a2a2c3994..9807bd5ad 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -301,14 +301,14 @@ static av_cold int aom_init(AVCodecContext *avctx) * quality. */ if (avctx->profile != FF_PROFILE_UNKNOWN) enccfg.g_profile = avctx->profile; -else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) +else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P || + avctx->pix_fmt == AV_PIX_FMT_YUV420P10) avctx->profile = enccfg.g_profile = FF_PROFILE_AV1_MAIN; +else if (avctx->pix_fmt == AV_PIX_FMT_YUV444P || + avctx->pix_fmt == AV_PIX_FMT_YUV444P10) +avctx->profile = enccfg.g_profile = FF_PROFILE_AV1_HIGH; else { -const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); -if (desc->comp[0].depth < 12) -avctx->profile = enccfg.g_profile = FF_PROFILE_AV1_HIGH; -else -avctx->profile = enccfg.g_profile = FF_PROFILE_AV1_PROFESSIONAL; +avctx->profile = enccfg.g_profile = FF_PROFILE_AV1_PROFESSIONAL; } -- 2.16.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/2] avcodec: rename the AV1 profiles
Use the proper names instead of numbers Signed-off-by: James Almer <jamr...@gmail.com> --- libavcodec/avcodec.h | 6 +++--- libavcodec/libaomenc.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index ac0915328..eb234a40d 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2551,9 +2551,9 @@ typedef struct AVCodecContext { #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 #define FF_PROFILE_HEVC_REXT4 -#define FF_PROFILE_AV1_00 -#define FF_PROFILE_AV1_11 -#define FF_PROFILE_AV1_22 +#define FF_PROFILE_AV1_MAIN 0 +#define FF_PROFILE_AV1_HIGH 1 +#define FF_PROFILE_AV1_PROFESSIONAL 2 /** * level diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index 94b3ddd32..a2a2c3994 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -302,13 +302,13 @@ static av_cold int aom_init(AVCodecContext *avctx) if (avctx->profile != FF_PROFILE_UNKNOWN) enccfg.g_profile = avctx->profile; else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) -avctx->profile = enccfg.g_profile = FF_PROFILE_AV1_0; +avctx->profile = enccfg.g_profile = FF_PROFILE_AV1_MAIN; else { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); if (desc->comp[0].depth < 12) -avctx->profile = enccfg.g_profile = FF_PROFILE_AV1_1; +avctx->profile = enccfg.g_profile = FF_PROFILE_AV1_HIGH; else -avctx->profile = enccfg.g_profile = FF_PROFILE_AV1_2; +avctx->profile = enccfg.g_profile = FF_PROFILE_AV1_PROFESSIONAL; } -- 2.16.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] configure: Revert some incorrect uses of check_cc()
On 3/29/2018 4:28 AM, Diego Biurrun wrote: > --- > > Thanks to James for pointing this out. > > configure | 16 +++- > 1 file changed, 11 insertions(+), 5 deletions(-) > > diff --git a/configure b/configure > index 90fb6f07ca..a64f241560 100755 > --- a/configure > +++ b/configure > @@ -4841,7 +4841,9 @@ check_disable_warning_headers -Wno-unused-variable > > check_objcflags -fobjc-arc && enable objc_arc > > -check_cc blocks_extension "" "void (^block)(void)" > +test_cc < +void (^block)(void); > +EOF > > # add some linker flags > check_ldflags -Wl,--warn-common > @@ -4895,10 +4897,14 @@ if enabled proper_dce; then > if test_ldflags -Wl,${version_script},$TMPV; then > append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver' > quotes='""' > -check_cc symver_asm_label "" "void ff_foo(void) __asm__ > ("av_foo@VERSION"); > - void ff_foo(void) { > ${inline_asm+__asm__($quotes);} }" > -check_cc symver_gnu_asm "" "__asm__(".symver > ff_foo,av_foo@VERSION"); > - void ff_foo(void) {}" > +test_cc < +void ff_foo(void) __asm__ ("av_foo@VERSION"); > +void ff_foo(void) { ${inline_asm+__asm__($quotes);} } > +EOF > +test_cc < +__asm__(".symver ff_foo,av_foo@VERSION"); > +void ff_foo(void) {} > +EOF > fi > fi LGTM ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/7] configure: Document available options for the --toolchain parameter
On 3/20/2018 6:49 AM, Diego Biurrun wrote: > --- > configure | 4 > 1 file changed, 4 insertions(+) > > diff --git a/configure b/configure > index 78a2065208..d8c3b555cc 100755 > --- a/configure > +++ b/configure > @@ -260,6 +260,10 @@ Toolchain options: >--target-path=DIRpath to view of build directory on target >--target-samples=DIR path to samples directory on target >--toolchain=NAME set tool defaults according to NAME > + (gcc-asan, clang-asan, gcc-msan, clang-msan, > + gcc-tsan, clang-tsan, gcc-usan, clang-usan, > + valgrind-massif, valgrind-memcheck, > + msvc, icl, gcov, llvm-cov, hardened) >--nm=NM use nm tool >--ar=AR use archive tool AR [$ar_default] >--as=AS use assembler AS [$as_default] Ok ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 7/7] configure: Drop unused helper function test_cflags_cpp()
On 3/20/2018 6:49 AM, Diego Biurrun wrote: > --- > configure | 13 - > 1 file changed, 13 deletions(-) > > diff --git a/configure b/configure > index 830f754412..6689858d57 100755 > --- a/configure > +++ b/configure > @@ -1042,19 +1042,6 @@ check_cpp_condition(){ > test_cpp_condition "$@" && enable $name > } > > -test_cflags_cpp(){ > -log test_cflags_cpp "$@" > -flags=$1 > -condition=$2 > -shift 2 > -set -- $($cflags_filter "$flags") > -test_cpp "$@" < -#if !($condition) > -#error "unsatisfied condition: $condition" > -#endif > -EOF > -} > - > check_lib(){ > log check_lib "$@" > name="$1" Ok ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 6/7] configure: Simplify vfp_args check
On 3/20/2018 6:49 AM, Diego Biurrun wrote: > --- > configure | 5 + > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/configure b/configure > index 9257b94631..830f754412 100755 > --- a/configure > +++ b/configure > @@ -4303,10 +4303,7 @@ elif enabled arm; then > elif ! test_cpp_condition stddef.h "defined __ARM_PCS || defined > __SOFTFP__" && [ $target_os != darwin ]; then > case "${cross_prefix:-$cc}" in > *hardfloat*) enable vfp_args; fpabi=vfp ;; > -*) check_ld vfp_args < -__asm__ (".eabi_attribute 28, 1"); > -int main(void) { return 0; } > -EOF > +*) check_ld vfp_args '_asm__ (".eabi_attribute 28, 1"); int > main(void) { return 0; }' && fpabi=vfp || fpabi=soft ;; > esac > warn "Compiler does not indicate floating-point ABI, guessing > $fpabi." > fi Ok if tested. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 5/7] configure: Simplify vararg check
On 3/20/2018 6:49 AM, Diego Biurrun wrote: > --- > configure | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/configure b/configure > index e3c5dcae1e..9257b94631 100755 > --- a/configure > +++ b/configure > @@ -4240,12 +4240,11 @@ od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable > bigendian > check_gas() { > log "check_gas using '$as' as AS" > # :vararg is used on aarch64, arm and ppc altivec > -test_as < +check_as vararg " > .macro m n, y:vararg=0 > \n: .int \y > .endm > -m x > -EOF > +m x" || return 1 > # .altmacro is only used in arm asm > ! enabled arm || check_as gnu_as ".altmacro" > } Ok if tested. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/7] configure: Use a more sensible suffix for x86 assembly tempfiles
On 3/20/2018 6:49 AM, Diego Biurrun wrote: > --- > configure | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/configure b/configure > index ce0d791c1b..dbc5759df4 100755 > --- a/configure > +++ b/configure > @@ -810,10 +810,10 @@ test_as(){ > > test_x86asm(){ > log test_x86asm "$@" > -echo "$1" > $TMPS > -log_file $TMPS > +echo "$1" > $TMPASM > +log_file $TMPASM > shift 1 > -test_cmd $x86asmexe $X86ASMFLAGS "$@" -o $TMPO $TMPS > +test_cmd $x86asmexe $X86ASMFLAGS "$@" -o $TMPO $TMPASM > } > > check_cmd(){ Ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/7] configure: Add check_x86asm() helper function to simplify some expressions
On 3/20/2018 6:49 AM, Diego Biurrun wrote: > --- > configure | 32 > 1 file changed, 20 insertions(+), 12 deletions(-) > > diff --git a/configure b/configure > index d8c3b555cc..ce0d791c1b 100755 > --- a/configure > +++ b/configure > @@ -808,6 +808,14 @@ test_as(){ > test_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS > } > > +test_x86asm(){ > +log test_x86asm "$@" > +echo "$1" > $TMPS > +log_file $TMPS > +shift 1 > +test_cmd $x86asmexe $X86ASMFLAGS "$@" -o $TMPO $TMPS > +} > + > check_cmd(){ > log check_cmd "$@" > cmd=$1 > @@ -844,12 +852,12 @@ check_insn(){ > check_as ${1}_external "$2" > } > > -test_x86asm(){ > -log test_x86asm "$@" > -echo "$1" > $TMPS > -log_file $TMPS > -shift 1 > -test_cmd $x86asmexe $X86ASMFLAGS "$@" -o $TMPO $TMPS > +check_x86asm(){ > +log check_x86asm "$@" > +name=$1 > +shift Maybe be explicit it should shift 1. > +disable $name > +test_x86asm "$@" && enable $name > } > > ld_o(){ > @@ -4421,7 +4429,7 @@ EOF > X86ASMDEP='$(DEPX86ASM) $(X86ASMFLAGS) -M $(X86ASM_O) $< > > $(@:.o=.d)' > X86ASM_DEPFLAGS= > fi > -test_x86asm "movbe ecx, [5]" && enable x86asm > +check_x86asm x86asm "movbe ecx, [5]" > } > > if ! disabled_any asm mmx x86asm; then > @@ -4437,11 +4445,11 @@ EOF > elf*) enabled debug && append X86ASMFLAGS $x86asm_debug ;; > esac > > -test_x86asm "vextracti128 xmm0, ymm0, 0" || disable > avx2_external > -test_x86asm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external > -test_x86asm "vfmadd132ps ymm0, ymm1, ymm2"|| disable > fma3_external > -test_x86asm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable > fma4_external > -test_x86asm "CPU amdnop" || disable cpunop > +check_x86asm avx2_external "vextracti128 xmm0, ymm0, 0" > +check_x86asm xop_external "vpmacsdd xmm0, xmm1, xmm2, xmm3" > +check_x86asm fma3_external "vfmadd132ps ymm0, ymm1, ymm2" > +check_x86asm fma4_external "vfmaddps ymm0, ymm1, ymm2, ymm3" > +check_x86asm cpunop"CPU amdnop" > fi > > case "$cpu" in > LGTM. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH v2] extract_extradata: zero initalize the padding bytes in all allocated buffers
Signed-off-by: James Almer <jamr...@gmail.com> --- libavcodec/extract_extradata_bsf.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c index 100c60d06..b5ba77dd0 100644 --- a/libavcodec/extract_extradata_bsf.c +++ b/libavcodec/extract_extradata_bsf.c @@ -114,6 +114,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, ret = AVERROR(ENOMEM); goto fail; } +memset(extradata + extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); *data = extradata; *size = extradata_size; @@ -137,6 +138,8 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, pkt->buf = filtered_buf; pkt->data = filtered_buf->data; pkt->size = filtered_data - filtered_buf->data; + +memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); } } @@ -171,6 +174,7 @@ static int extract_extradata_vc1(AVBSFContext *ctx, AVPacket *pkt, return AVERROR(ENOMEM); memcpy(*data, pkt->data, extradata_size); +memset(*data + extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); *size = extradata_size; if (s->remove) { @@ -202,6 +206,7 @@ static int extract_extradata_mpeg124(AVBSFContext *ctx, AVPacket *pkt, return AVERROR(ENOMEM); memcpy(*data, pkt->data, *size); +memset(*data + *size, 0, AV_INPUT_BUFFER_PADDING_SIZE); if (s->remove) { pkt->data += *size; -- 2.16.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] extract_extradata: zero initalize the padding bytes in all allocated buffers
On 3/8/2018 5:25 PM, Luca Barbato wrote: > On 08/03/2018 17:08, James Almer wrote: >> Signed-off-by: James Almer <jamr...@gmail.com> >> --- >> libavcodec/extract_extradata_bsf.c | 5 + >> 1 file changed, 5 insertions(+) >> > > Sounds good. Actually, i think the filtered_buf one should zero initialize past the last written byte instead. I'll send an updated patch. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] extract_extradata: zero initalize the padding bytes in all allocated buffers
Signed-off-by: James Almer <jamr...@gmail.com> --- libavcodec/extract_extradata_bsf.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c index 100c60d06..8d341cefc 100644 --- a/libavcodec/extract_extradata_bsf.c +++ b/libavcodec/extract_extradata_bsf.c @@ -105,6 +105,8 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, ret = AVERROR(ENOMEM); goto fail; } +memset(filtered_buf->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); + filtered_data = filtered_buf->data; } @@ -114,6 +116,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, ret = AVERROR(ENOMEM); goto fail; } +memset(extradata + extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); *data = extradata; *size = extradata_size; @@ -171,6 +174,7 @@ static int extract_extradata_vc1(AVBSFContext *ctx, AVPacket *pkt, return AVERROR(ENOMEM); memcpy(*data, pkt->data, extradata_size); +memset(*data + extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); *size = extradata_size; if (s->remove) { @@ -202,6 +206,7 @@ static int extract_extradata_mpeg124(AVBSFContext *ctx, AVPacket *pkt, return AVERROR(ENOMEM); memcpy(*data, pkt->data, *size); +memset(*data + *size, 0, AV_INPUT_BUFFER_PADDING_SIZE); if (s->remove) { pkt->data += *size; -- 2.16.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Support AV1 encoding using libaom
On 2/26/2018 2:10 AM, Luca Barbato wrote: > --- > > Since the bitstream will be frozen soon shouldn't hurt adding it. > > configure | 1 + > libavcodec/Makefile| 1 + > libavcodec/allcodecs.c | 2 +- > libavcodec/libaomenc.c | 602 > + > 4 files changed, 605 insertions(+), 1 deletion(-) > create mode 100644 libavcodec/libaomenc.c > [...] > +/* 0-3: For non-zero values the encoder increasingly optimizes for > reduced > + complexity playback on low powered devices at the expense of encode > + quality. */ > +if (avctx->profile != FF_PROFILE_UNKNOWN) > +enccfg.g_profile = avctx->profile; > +else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) > +avctx->profile = enccfg.g_profile = FF_PROFILE_VP9_0; > +else > +avctx->profile = enccfg.g_profile = FF_PROFILE_VP9_1; You should add profiles for AV1 instead. [...] > +AVCodec ff_libaom_av1_encoder = { > +.name = "libaom-av1", > +.long_name = NULL_IF_CONFIG_SMALL("libaom AV1"), > +.type = AVMEDIA_TYPE_VIDEO, > +.id = AV_CODEC_ID_AV1, > +.priv_data_size = sizeof(AOMContext), > +.init = aom_init, > +.encode2= aom_encode, > +.close = aom_free, > +.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS, AV_CODEC_CAP_EXPERIMENTAL. libvpx_vp9 used to outright forbid encoding with some libvpx versions *after* the bitstream was frozen, let alone before, since it was known to produce bad streams in some situations. So at the very least don't just let users encode potentially bad AV1 files unknowingly. This can be changed once a stable/good version is released. > +.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, > AV_PIX_FMT_NONE }, > +.priv_class = _aom, > +.defaults = defaults, > +.wrapper_name = "libaom", > +}; > -- > 2.12.2 > > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] hvcc: zero initialize the nal buffers past the last written byte
Bug-Id: 1116 Cc: libav-sta...@libav.org Signed-off-by: James Almer <jamr...@gmail.com> --- libavformat/hevc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/hevc.c b/libavformat/hevc.c index f8bfeebd3..1f8a7bb3c 100644 --- a/libavformat/hevc.c +++ b/libavformat/hevc.c @@ -657,6 +657,8 @@ static uint8_t *nal_unit_extract_rbsp(const uint8_t *src, uint32_t src_len, while (i < src_len) dst[len++] = src[i++]; +memset(dst + len, 0, AV_INPUT_BUFFER_PADDING_SIZE); + *dst_len = len; return dst; } -- 2.16.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/7] configure: Drop unnecessary variables, shifts, and quotes in helper functions
On 2/11/2018 4:09 PM, Diego Biurrun wrote: > --- > configure | 21 +++-- > 1 file changed, 7 insertions(+), 14 deletions(-) > > diff --git a/configure b/configure > index ed930e6cd4..904131301d 100755 > --- a/configure > +++ b/configure > @@ -816,7 +816,7 @@ EOF > > check_insn(){ > log check_insn "$@" > -check_inline_asm ${1}_inline "\"$2\"" > +check_inline_asm ${1}_inline "$2" > echo "$2" | check_as && enable ${1}_external || disable ${1}_external > } > > @@ -1097,11 +1097,9 @@ check_struct(){ > check_builtin(){ > log check_builtin "$@" > name=$1 > -headers=$2 > -builtin=$3 > -shift 3 > +shift > disable "$name" > -check_code ld "$headers" "$builtin" "$@" && enable "$name" > +check_code ld "$@" && enable "$name" > } > > check_compile_assert(){ > @@ -1118,25 +1116,20 @@ require(){ > log require "$@" > name_version="$1" > name="${1%% *}" > -headers="$2" > -func="$3" > -shift 3 > -check_lib $name "$headers" $func "$@" || die "ERROR: $name_version not > found" > +shift > +check_lib $name "$@" || die "ERROR: $name_version not found" > } > > require_header(){ > log require_header "$@" > headers="$1" > -shift > -check_header "$headers" "$@" || die "ERROR: $headers not found" > +check_header "$@" || die "ERROR: $headers not found" > } > > require_cpp_condition(){ > log require_cpp_condition "$@" > -header="$1" > condition="$2" > -shift 2 > -check_cpp_condition "$header" "$condition" "$@" || die "ERROR: > $condition not satisfied" > +check_cpp_condition "$@" || die "ERROR: $condition not satisfied" > } > > require_pkg_config(){ Does passing "$@" keep and propagate the arguments split in a way check_code() and similar can properly identify and handle? Checks can use more than one header after all. Should be ok if that's the case. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 10/16] cbs: Refcount all the things!
On 2/11/2018 3:14 PM, Mark Thompson wrote: > +int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx, > + CodedBitstreamUnit *unit, > + size_t size, > + void (*free)(void *opaque, uint8_t *data)) > +{ > +av_assert0(!unit->content && !unit->content_ref); > + > +unit->content = av_mallocz(size); > +if (!unit->content) > +return AVERROR(ENOMEM); > + > +unit->content_ref = av_buffer_create(unit->content, size, > + free ? free > + : _buffer_default_free, av_buffer_create() defaults to av_buffer_default_free() on its own if free is NULL, so no need to do it here. > + ctx, 0); > +if (!unit->content_ref) { > +av_freep(>content); > +return AVERROR(ENOMEM); > +} > + > +return 0; > +} ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] Add HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK
On 1/3/2018 7:53 PM, Sean McGovern wrote: > 2 things: > > - does this actually depend on dlopen directly, or should it be libdl, like > the entries below it? If this is Windows only as the doxy states, then LoadLibrary should be the only dep. But otherwise you're right, it should be libdl and not dlopen. > - would be nice to test, if I could oh maybe get a hold of a Vega *grmbl* It works with any GCN based GPU, so HD7xxx and newer (Older models only support h264). > > Sean McG. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] x264: Support version 155
On 12/26/2017 10:10 AM, Nicolas George wrote: > James Almer (2017-12-26): >>> +#if X264_BUILD >= 155 >>> +if (x4->params.i_bitdepth > 8) >>> +#else > >> Wouldn't using av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth here >> as well be cleaner? > > avctx->pix_fmt tells us what libavcodec wants; x4->params.i_bitdepth > tells us what x264 proposes; they are not necessarily the same thing. x4->params.i_bitdepth is set by libavcodec based on the value of avctx->pix_fmt at the time AVCodec.init() is called, so it should be the same. Unless avctx->pix_fmt can change mid encoding, in which case things would just not work anyway. > > You may want to check the similar change you made on FFmpeg. > > Regards, > > > > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] x264: Support version 155
On 12/26/2017 11:39 AM, Luca Barbato wrote: > On 26/12/2017 13:54, James Almer wrote: >> You can still build libx264 with support for only 8 and 10 bits after >> this multibitdepth change, so ideally you'd still check for what's >> available based on X264_BIT_DEPTH and use the new enum array if it's 0. >> >> I have a patch doing this but was waiting for some feedback elsewhere >> before sending it. > > I decided to not go that way so if somebody changes the 8-only library > with the 10-only library or the hydra he wouldn't have to rebuild Libav. > > Asking for an unsupported pixel format gets you an error message anyway. > > ./avconv -filter_complex testsrc -pix_fmt yuv422p10 -c:v libx264 > /tmp/out.mkv > avconv version v13_dev0-1426-g8436a9e03f, Copyright (c) 2000-2017 the > Libav developers > built on Dec 26 2017 15:37:04 with Apple LLVM version 9.0.0 > (clang-900.0.39.2) > File '/tmp/out.mkv' already exists. Overwrite ? [y/N] y > Stream mapping: > (null) -> Stream #0:0 (libx264) > Press ctrl-c to stop encoding > x264 [error]: not compiled with 10 bit depth support > > lu Alright. Just change the X264_BUILD to 153 (the version where this was introduced) instead of 155 and it should be good. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] x264: Support version 155
On 12/26/2017 8:33 AM, Luca Barbato wrote: > It has native 8 and 10 bit support. > --- > libavcodec/libx264.c | 30 ++ > 1 file changed, 30 insertions(+) > > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c > index 0dec12edd2..6aadf33c94 100644 > --- a/libavcodec/libx264.c > +++ b/libavcodec/libx264.c > @@ -243,7 +243,11 @@ static int X264_frame(AVCodecContext *ctx, AVPacket > *pkt, const AVFrame *frame, > > x264_picture_init( >pic ); > x4->pic.img.i_csp = x4->params.i_csp; > +#if X264_BUILD >= 155 > +if (x4->params.i_bitdepth > 8) > +#else > if (x264_bit_depth > 8) > +#endif Wouldn't using av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth here as well be cleaner? > x4->pic.img.i_csp |= X264_CSP_HIGH_DEPTH; > x4->pic.img.i_plane = 3; > > @@ -395,6 +399,9 @@ static av_cold int X264_init(AVCodecContext *avctx) > x4->params.p_log_private= avctx; > x4->params.i_log_level = X264_LOG_DEBUG; > x4->params.i_csp= convert_pix_fmt(avctx->pix_fmt); > +#if X264_BUILD >= 155 > +x4->params.i_bitdepth = > av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth; > +#endif > > if (avctx->bit_rate) { > x4->params.rc.i_bitrate = avctx->bit_rate / 1000; > @@ -659,6 +666,7 @@ FF_ENABLE_DEPRECATION_WARNINGS > return 0; > } > > +#if X264_BUILD < 155 > static const enum AVPixelFormat pix_fmts_8bit[] = { > AV_PIX_FMT_YUV420P, > AV_PIX_FMT_YUVJ420P, > @@ -685,15 +693,37 @@ static const enum AVPixelFormat pix_fmts_10bit[] = { > AV_PIX_FMT_NV20, > AV_PIX_FMT_NONE > }; > +#endif > + > +static const enum AVPixelFormat pix_fmts_all[] = { > +AV_PIX_FMT_YUV420P, > +AV_PIX_FMT_YUVJ420P, > +AV_PIX_FMT_YUV422P, > +AV_PIX_FMT_YUVJ422P, > +AV_PIX_FMT_YUV444P, > +AV_PIX_FMT_YUVJ444P, > +AV_PIX_FMT_NV12, > +AV_PIX_FMT_NV16, > +AV_PIX_FMT_NV21, > +AV_PIX_FMT_YUV420P10, > +AV_PIX_FMT_YUV422P10, > +AV_PIX_FMT_YUV444P10, > +AV_PIX_FMT_NV20, > +AV_PIX_FMT_NONE > +}; > > static av_cold void X264_init_static(AVCodec *codec) > { > +#if X264_BUILD < 155 > if (x264_bit_depth == 8) > codec->pix_fmts = pix_fmts_8bit; > else if (x264_bit_depth == 9) > codec->pix_fmts = pix_fmts_9bit; > else if (x264_bit_depth == 10) > codec->pix_fmts = pix_fmts_10bit; > +#else > +codec->pix_fmts = pix_fmts_all; > +#endif You can still build libx264 with support for only 8 and 10 bits after this multibitdepth change, so ideally you'd still check for what's available based on X264_BIT_DEPTH and use the new enum array if it's 0. I have a patch doing this but was waiting for some feedback elsewhere before sending it. > } > > #define OFFSET(x) offsetof(X264Context, x) > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] libavcodec: Don't use dllexport, only dllimport when building DLLs
On 11/17/2017 5:35 PM, Martin Storsjö wrote: > On Fri, 17 Nov 2017, James Almer wrote: > >> On 11/16/2017 5:22 AM, Martin Storsjö wrote: >>> The only purpose of dllexport (which is set while building the library >>> that exports the symbols) is to have the linker automatically >>> export such symbols into a DLL without using a def file - it doesn't >>> affect the generated code. >>> >>> For MSVC builds, this isn't essential since we override what symbols >>> to export via an autogenerated def file instead. >>> >>> Update a comment in configure to refer to the right concept. >>> >>> With lld, this avoids warnings about duplicate export directives, >>> when some symbols are requested to be exported both via dllexport >>> attributes and via the autogenerated def file. >>> >>> This also reduces the number of lines of code marginally. >>> --- >>> configure | 2 +- >>> libavcodec/internal.h | 6 +- >>> 2 files changed, 2 insertions(+), 6 deletions(-) >>> >>> diff --git a/configure b/configure >>> index 3bad7fb..62dffd4 100755 >>> --- a/configure >>> +++ b/configure >>> @@ -3883,7 +3883,7 @@ case $target_os in >>> mingw32*|mingw64*) >>> target_os=mingw32 >>> if enabled shared; then >>> - # Cannot build both shared and static libs when using >>> dllexport. >>> + # Cannot build both shared and static libs when using >>> dllimport. >>> disable static >>> fi >>> check_ldflags -Wl,--nxcompat >>> diff --git a/libavcodec/internal.h b/libavcodec/internal.h >>> index da1b2fa..868e3df 100644 >>> --- a/libavcodec/internal.h >>> +++ b/libavcodec/internal.h >>> @@ -285,12 +285,8 @@ int ff_decode_frame_props(AVCodecContext *avctx, >>> AVFrame *frame); >>> */ >>> AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx); >>> >>> -#if defined(_WIN32) && CONFIG_SHARED >>> -#ifdef BUILDING_avcodec >>> -# define av_export_avcodec __declspec(dllexport) >>> -#else >>> +#if defined(_WIN32) && CONFIG_SHARED && !defined(BUILDING_avcodec) >> >> Sorry if it's obvious, but when is BUILDING_avcodec not defined, for >> that matter? library.mak seems to add -DBUILDING_avcodec to the >> preprocessor flags of every libavcodec object. > > When object files in libavformat includes this header, these variables > will get the __declspec(dllimport) attribute - which is the whole reason > why this is an issue at all. Right, forgot this attribute was used in headers included from outside libavcodec and not in c files. Nevermind then. Should be good if confirmed working. > > Technically, this attribute means that instead of referring directly to > the variables, there's an implicit variable __imp_ which is a > pointer to the real one. So this means that libavformat object files > will refer to __imp_avpriv_foo (which is provided by the avcodec DLL > import library), while object files within avcodec themselves refer > directly to the variable itself without this indirection. > > // Martin > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] libavcodec: Don't use dllexport, only dllimport when building DLLs
On 11/16/2017 5:22 AM, Martin Storsjö wrote: > The only purpose of dllexport (which is set while building the library > that exports the symbols) is to have the linker automatically > export such symbols into a DLL without using a def file - it doesn't > affect the generated code. > > For MSVC builds, this isn't essential since we override what symbols > to export via an autogenerated def file instead. > > Update a comment in configure to refer to the right concept. > > With lld, this avoids warnings about duplicate export directives, > when some symbols are requested to be exported both via dllexport > attributes and via the autogenerated def file. > > This also reduces the number of lines of code marginally. > --- > configure | 2 +- > libavcodec/internal.h | 6 +- > 2 files changed, 2 insertions(+), 6 deletions(-) > > diff --git a/configure b/configure > index 3bad7fb..62dffd4 100755 > --- a/configure > +++ b/configure > @@ -3883,7 +3883,7 @@ case $target_os in > mingw32*|mingw64*) > target_os=mingw32 > if enabled shared; then > -# Cannot build both shared and static libs when using dllexport. > +# Cannot build both shared and static libs when using dllimport. > disable static > fi > check_ldflags -Wl,--nxcompat > diff --git a/libavcodec/internal.h b/libavcodec/internal.h > index da1b2fa..868e3df 100644 > --- a/libavcodec/internal.h > +++ b/libavcodec/internal.h > @@ -285,12 +285,8 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame > *frame); > */ > AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx); > > -#if defined(_WIN32) && CONFIG_SHARED > -#ifdef BUILDING_avcodec > -#define av_export_avcodec __declspec(dllexport) > -#else > +#if defined(_WIN32) && CONFIG_SHARED && !defined(BUILDING_avcodec) Sorry if it's obvious, but when is BUILDING_avcodec not defined, for that matter? library.mak seems to add -DBUILDING_avcodec to the preprocessor flags of every libavcodec object. > #define av_export_avcodec __declspec(dllimport) > -#endif > #else > #define av_export_avcodec > #endif > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] makedef: Pass EXTERN_PREFIX from configure to makedef
On 11/16/2017 5:00 AM, Martin Storsjö wrote: > This avoids having to use either "dumpbin -headers" to find out > the current architecture, or pass $ARCH from configure to deduce it. > > When configuring with --disable-asm, ARCH is equal to "c", which doesn't > give any indication of what symbol prefix is to be used. > --- > compat/windows/makedef | 28 +--- > configure | 5 +++-- > 2 files changed, 4 insertions(+), 29 deletions(-) > > diff --git a/compat/windows/makedef b/compat/windows/makedef > index 0cd169c..7258b94 100755 > --- a/compat/windows/makedef > +++ b/compat/windows/makedef > @@ -58,33 +58,7 @@ fi > IFS=' > ' > > -# Determine if we're building for x86 or x86_64 and > -# set the symbol prefix accordingly. > -prefix="" > -if [ -n "$NM" ]; then > -case $ARCH in > -*86) > -prefix="_" > -;; > -*) > -;; > -esac > -else > -arch=$(dumpbin -headers ${libname} | > - tr '\t' ' ' | > - grep '^ \+.\+machine \+(.\+)' | > - head -1 | > - sed -e 's/^ \{1,\}.\{1,\} \{1,\}machine > \{1,\}(\(.\{3,5\}\)).*/\1/') > - > -if [ "${arch}" = "x86" ]; then > -prefix="_" > -else > -if [ "${arch}" != "ARM" ] && [ "${arch}" != "x64" ] && [ "${arch}" > != "ARM64" ]; then > -echo "Unknown machine type." >&2 > -exit 1 > -fi > -fi > -fi > +prefix="$EXTERN_PREFIX" > > started=0 > regex="none" > diff --git a/configure b/configure > index 3bad7fb..fcffbce 100755 > --- a/configure > +++ b/configure > @@ -3898,7 +3898,7 @@ case $target_os in > SLIB_INSTALL_LINKS= > SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' > SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) > $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' > -SLIB_CREATE_DEF_CMD='ARCH="$(ARCH)" AR="$(AR_CMD)" NM="$(NM_CMD)" > $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > > $$(@:$(SLIBSUF)=.def)' > +SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" AR="$(AR_CMD)" > NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver > $(OBJS) > $$(@:$(SLIBSUF)=.def)' > SHFLAGS='-shared > -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) > -Wl,--enable-auto-image-base $$(@:$(SLIBSUF)=.def)' > enabled x86_64 && objformat="win64" || objformat="win32" > ranlib=: > @@ -3918,7 +3918,7 @@ case $target_os in > SLIBSUF=".dll" > SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)' > SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)' > -SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef > $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' > +SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" > $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > > $$(@:$(SLIBSUF)=.def)' > SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)' > SLIB_INSTALL_LINKS= > SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' > @@ -5210,6 +5210,7 @@ SRC_PATH=$source_path > CC_IDENT=$cc_ident > ARCH=$arch > INTRINSICS=$intrinsics > +EXTERN_PREFIX=$extern_prefix > CC=$cc > AS=$as > OBJCC=$objcc LGTM. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] configure: export extern_prefix to use with makedef
On 11/16/2017 11:17 AM, James Almer wrote: > No point in trying to guess it from within makedef when configure > already did it before. > > Fixes linking failures on x86_32 when "arch" isn't one of the values > makedef was expecting. > > Signed-off-by: James Almer <jamr...@gmail.com> > --- > compat/windows/makedef | 29 ++--- > configure | 3 ++- > 2 files changed, 4 insertions(+), 28 deletions(-) Right, i should remember to look at existing patches in the ML before writing and sending stuff myself. Patch obviously dropped for being a duplicate of one sent hours ago. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] configure: export extern_prefix to use with makedef
No point in trying to guess it from within makedef when configure already did it before. Fixes linking failures on x86_32 when "arch" isn't one of the values makedef was expecting. Signed-off-by: James Almer <jamr...@gmail.com> --- compat/windows/makedef | 29 ++--- configure | 3 ++- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/compat/windows/makedef b/compat/windows/makedef index 0cd169c15c..e4eeb56877 100755 --- a/compat/windows/makedef +++ b/compat/windows/makedef @@ -58,33 +58,8 @@ fi IFS=' ' -# Determine if we're building for x86 or x86_64 and -# set the symbol prefix accordingly. -prefix="" -if [ -n "$NM" ]; then -case $ARCH in -*86) -prefix="_" -;; -*) -;; -esac -else -arch=$(dumpbin -headers ${libname} | - tr '\t' ' ' | - grep '^ \+.\+machine \+(.\+)' | - head -1 | - sed -e 's/^ \{1,\}.\{1,\} \{1,\}machine \{1,\}(\(.\{3,5\}\)).*/\1/') - -if [ "${arch}" = "x86" ]; then -prefix="_" -else -if [ "${arch}" != "ARM" ] && [ "${arch}" != "x64" ] && [ "${arch}" != "ARM64" ]; then -echo "Unknown machine type." >&2 -exit 1 -fi -fi -fi +# Symbol prefix, guessed by configure +prefix=$EXTERN_PREFIX started=0 regex="none" diff --git a/configure b/configure index 3bad7fb72c..221f9fd127 100755 --- a/configure +++ b/configure @@ -3898,7 +3898,7 @@ case $target_os in SLIB_INSTALL_LINKS= SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' -SLIB_CREATE_DEF_CMD='ARCH="$(ARCH)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' +SLIB_CREATE_DEF_CMD='AR="$(AR_CMD)" NM="$(NM_CMD)" EXTERN_PREFIX="$(EXTERN_PREFIX)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-auto-image-base $$(@:$(SLIBSUF)=.def)' enabled x86_64 && objformat="win64" || objformat="win32" ranlib=: @@ -5257,6 +5257,7 @@ LIBNAME=$LIBNAME SLIBPREF=$SLIBPREF SLIBSUF=$SLIBSUF EXESUF=$EXESUF +EXTERN_PREFIX=$extern_prefix EXTRA_VERSION=$extra_version CCDEP=$CCDEP CCDEP_FLAGS=$CCDEP_FLAGS -- 2.14.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] configure: use subarch instead of arch to create .def files on mingw
arch is "x86" regardless of target being x86_32 or x86_64, and if configuring with asm disabled it's "c" instead. Using subarch (Always either "x86_32" or "x86_64") and adapting makedef makes sure the symbols are always detected correctly on x86_32. --- compat/windows/makedef | 2 +- configure | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compat/windows/makedef b/compat/windows/makedef index 0cd169c15c..9e88611cc8 100755 --- a/compat/windows/makedef +++ b/compat/windows/makedef @@ -63,7 +63,7 @@ IFS=' prefix="" if [ -n "$NM" ]; then case $ARCH in -*86) +x86_32) prefix="_" ;; *) diff --git a/configure b/configure index e608d26608..df179fc3fb 100755 --- a/configure +++ b/configure @@ -3901,7 +3901,7 @@ case $target_os in SLIB_INSTALL_LINKS= SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' -SLIB_CREATE_DEF_CMD='ARCH="$(ARCH)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' +SLIB_CREATE_DEF_CMD='ARCH="$(SUBARCH)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-auto-image-base $$(@:$(SLIBSUF)=.def)' enabled x86_64 && objformat="win64" || objformat="win32" ranlib=: @@ -5212,6 +5212,7 @@ MANDIR=\$(DESTDIR)$mandir SRC_PATH=$source_path CC_IDENT=$cc_ident ARCH=$arch +SUBARCH=$subarch INTRINSICS=$intrinsics CC=$cc AS=$as -- 2.14.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] Makefile: fix distclean target
It must imply clean. Regression since 7ebe7e8e7a76c0ce302f4f583ef0d14220031214. Signed-off-by: James Almer <jamr...@gmail.com> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5f91294c8e..024d59f815 100644 --- a/Makefile +++ b/Makefile @@ -171,7 +171,7 @@ clean:: $(RM) $(addprefix compat/,$(CLEANSUFFIXES)) $(addprefix compat/*/,$(CLEANSUFFIXES)) $(RM) -rf coverage.info lcov -distclean:: +distclean:: clean $(RM) .version avversion.h config.asm config.h mapfile \ avbuild/.config avbuild/config.* libavutil/avconfig.h \ libavcodec/bsf_list.c libavformat/protocol_list.c -- 2.14.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 5/5] Drop some unnecessary config.h #includes
On 11/3/2017 1:43 PM, Diego Biurrun wrote: > --- > > Noticed while working on the previous patch, spun off into a separate commit. > > libavcodec/thread.h | 1 - > libavformat/tls.h| 4 ++-- > libavutil/aarch64/cpu.h | 1 - > libavutil/arm/cpu.h | 1 - > libavutil/cpu_internal.h | 2 ++ > libavutil/ppc/cpu.h | 1 - > libavutil/x86/cpu.h | 1 - > 7 files changed, 4 insertions(+), 7 deletions(-) > > diff --git a/libavcodec/thread.h b/libavcodec/thread.h > index 864e67eb98..b06958de80 100644 > --- a/libavcodec/thread.h > +++ b/libavcodec/thread.h > @@ -29,7 +29,6 @@ > > #include "libavutil/buffer.h" > > -#include "config.h" > #include "avcodec.h" > > typedef struct ThreadFrame { > diff --git a/libavformat/tls.h b/libavformat/tls.h > index 94f30ab854..846aa8333e 100644 > --- a/libavformat/tls.h > +++ b/libavformat/tls.h > @@ -22,10 +22,10 @@ > #ifndef AVFORMAT_TLS_H > #define AVFORMAT_TLS_H > > -#include "config.h" > -#include "url.h" > #include "libavutil/opt.h" > > +#include "url.h" > + > typedef struct TLSShared { > char *ca_file; > int verify; > diff --git a/libavutil/aarch64/cpu.h b/libavutil/aarch64/cpu.h > index f5b1d89132..0f2531b0dc 100644 > --- a/libavutil/aarch64/cpu.h > +++ b/libavutil/aarch64/cpu.h > @@ -19,7 +19,6 @@ > #ifndef AVUTIL_AARCH64_CPU_H > #define AVUTIL_AARCH64_CPU_H > > -#include "config.h" > #include "libavutil/cpu.h" > #include "libavutil/cpu_internal.h" > > diff --git a/libavutil/arm/cpu.h b/libavutil/arm/cpu.h > index 127993e5dd..99986d908b 100644 > --- a/libavutil/arm/cpu.h > +++ b/libavutil/arm/cpu.h > @@ -19,7 +19,6 @@ > #ifndef AVUTIL_ARM_CPU_H > #define AVUTIL_ARM_CPU_H > > -#include "config.h" > #include "libavutil/cpu.h" > #include "libavutil/cpu_internal.h" > > diff --git a/libavutil/cpu_internal.h b/libavutil/cpu_internal.h > index 18c744a983..4c5e1308aa 100644 > --- a/libavutil/cpu_internal.h > +++ b/libavutil/cpu_internal.h > @@ -19,6 +19,8 @@ > #ifndef AVUTIL_CPU_INTERNAL_H > #define AVUTIL_CPU_INTERNAL_H > > +#include "config.h" > + > #include "cpu.h" > > #define CPUEXT_SUFFIX(flags, suffix, cpuext)\ > diff --git a/libavutil/ppc/cpu.h b/libavutil/ppc/cpu.h > index a8b823f534..bed687125e 100644 > --- a/libavutil/ppc/cpu.h > +++ b/libavutil/ppc/cpu.h > @@ -19,7 +19,6 @@ > #ifndef AVUTIL_PPC_CPU_H > #define AVUTIL_PPC_CPU_H > > -#include "config.h" > #include "libavutil/cpu.h" > #include "libavutil/cpu_internal.h" > > diff --git a/libavutil/x86/cpu.h b/libavutil/x86/cpu.h > index c0a525dd4e..6373e57db2 100644 > --- a/libavutil/x86/cpu.h > +++ b/libavutil/x86/cpu.h > @@ -19,7 +19,6 @@ > #ifndef AVUTIL_X86_CPU_H > #define AVUTIL_X86_CPU_H > > -#include "config.h" > #include "libavutil/cpu.h" > #include "libavutil/cpu_internal.h" Ok if everything still compiles after this, of course. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] configure: Simplify restrict keyword handling
On 11/10/2017 11:57 AM, Diego Biurrun wrote: > Skip a variable indirection and only redefine restrict if necessary. > --- > > Should still work on MSVC 2010 now as I don't kill the ugly workaround. > > configure | 9 + > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/configure b/configure > index 5684bddf9e..17acc98962 100755 > --- a/configure > +++ b/configure > @@ -4134,9 +4134,8 @@ extern_prefix=${sym%%ff_extern*} > > ! disabled inline_asm && check_inline_asm inline_asm '"" ::' > > -_restrict= > for restrict_keyword in restrict __restrict__ __restrict; do > -check_cc < +check_cc < void foo(char * $restrict_keyword p); > EOF > done > @@ -4959,7 +4958,7 @@ elif enabled_any msvc icl; then > # MSVC 2013 and newer can handle it fine. > # If this declspec fails, force including stdlib.h before the restrict > redefinition > # happens in config.h. > -if [ $_restrict != restrict ]; then > +if [ $restrict_keyword != restrict ]; then > check_cc < __declspec($_restrict) void* foo(int); > EOF > @@ -5318,12 +5317,14 @@ cat > $TMPH < #define LIBAV_LICENSE "$(c_escape $license)" > #define AVCONV_DATADIR "$(eval c_escape $datadir)" > #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})" > -#define restrict $_restrict > #define EXTERN_PREFIX "${extern_prefix}" > #define EXTERN_ASM ${extern_prefix} > #define SLIBSUF "$SLIBSUF" > EOF > > +test $restrict_keyword != restrict && > +echo "#define restrict $_restrict" >> $TMPH echo "#define restrict $restrict_keyword" >> $TMPH > + > test -n "$malloc_prefix" && > echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH LGTM with the above fixed. One less pointless define in config.h ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] configure: fix writing library dependencies to config.sh
Signed-off-by: James Almer <jamr...@gmail.com> --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 1f220c8bef..e608d26608 100755 --- a/configure +++ b/configure @@ -5405,7 +5405,7 @@ EOF for lib in $LIBRARY_LIST; do lib_deps="$(eval echo \$${lib}_deps)" -echo ${lib}_deps=\"$lib_deps\" >> avbuild/config.sh +echo ${lib}_deps=\"$lib_deps\" >> $TMPH done cp_if_changed $TMPH avbuild/config.sh -- 2.14.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/5] configure: Factorize check_64_bit()
On 11/3/2017 1:43 PM, Diego Biurrun wrote: > --- > > I'm assuming that the change for MIPS is safe. If you can't test it on a MIPS target, then it would be best to ask someone who can. It probably has its own special check for a reason. > > configure | 15 +++ > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/configure b/configure > index 169a6fa33f..21f24e8e0f 100755 > --- a/configure > +++ b/configure > @@ -3764,8 +3764,7 @@ check_host_cflags $host_cflags_speed > check_64bit(){ > arch32=$1 > arch64=$2 > -expr=$3 > -check_code cc "" "int test[2*($expr) - 1]" && > +check_code cc "" "int test[2*(sizeof(void *) > 4) - 1]" && > subarch=$arch64 || subarch=$arch32 > enable $subarch > } > @@ -3775,27 +3774,27 @@ case "$arch" in > enabled shared && enable_weak pic > ;; > mips) > -check_64bit mips mips64 '_MIPS_SIM > 1' > +check_64bit mips mips64 > enabled shared && enable_weak pic > ;; > parisc) > -check_64bit parisc parisc64 'sizeof(void *) > 4' > +check_64bit parisc parisc64 > enabled shared && enable_weak pic > ;; > ppc) > -check_64bit ppc ppc64 'sizeof(void *) > 4' > +check_64bit ppc ppc64 > enabled shared && enable_weak pic > ;; > s390) > -check_64bit s390 s390x 'sizeof(void *) > 4' > +check_64bit s390 s390x > enabled shared && enable_weak pic > ;; > sparc) > -check_64bit sparc sparc64 'sizeof(void *) > 4' > +check_64bit sparc sparc64 > enabled shared && enable_weak pic > ;; > x86) > -check_64bit x86_32 x86_64 'sizeof(void *) > 4' > +check_64bit x86_32 x86_64 > if enabled x86_64; then > enabled shared && enable_weak pic > objformat=elf64 > Should be good if MIPS64 is confirmed to not break with it. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/5] configure: Coalesce some arch configuration and PIC handling
On 11/3/2017 1:43 PM, Diego Biurrun wrote: > --- > configure | 24 +++- > 1 file changed, 11 insertions(+), 13 deletions(-) > > diff --git a/configure b/configure > index 33c52240aa..169a6fa33f 100755 > --- a/configure > +++ b/configure > @@ -2595,6 +2595,7 @@ pkg_config_default=pkg-config > ranlib="ranlib" > strip="strip" > version_script='--version-script' > +objformat="elf32" > > # machine > arch_default=$(uname -m) > @@ -3766,45 +3767,42 @@ check_64bit(){ > expr=$3 > check_code cc "" "int test[2*($expr) - 1]" && > subarch=$arch64 || subarch=$arch32 > +enable $subarch > } > > case "$arch" in > aarch64|alpha|ia64) > -spic=$shared > +enabled shared && enable_weak pic > ;; > mips) > check_64bit mips mips64 '_MIPS_SIM > 1' > -spic=$shared > +enabled shared && enable_weak pic > ;; > parisc) > check_64bit parisc parisc64 'sizeof(void *) > 4' > -spic=$shared > +enabled shared && enable_weak pic > ;; > ppc) > check_64bit ppc ppc64 'sizeof(void *) > 4' > -spic=$shared > +enabled shared && enable_weak pic > ;; > s390) > check_64bit s390 s390x 'sizeof(void *) > 4' > -spic=$shared > +enabled shared && enable_weak pic > ;; > sparc) > check_64bit sparc sparc64 'sizeof(void *) > 4' > -spic=$shared > +enabled shared && enable_weak pic > ;; > x86) > check_64bit x86_32 x86_64 'sizeof(void *) > 4' > -if test "$subarch" = "x86_64"; then > -spic=$shared > +if enabled x86_64; then > +enabled shared && enable_weak pic > +objformat=elf64 > fi > ;; > esac > > -enable $subarch > -enabled spic && enable_weak pic > - > -enabled x86_64 && objformat=elf64 || objformat="elf32" > - > # OS specific > case $target_os in > aix) > LGTM ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/5] configure: Miscellaneous minor changes
On 11/3/2017 1:43 PM, Diego Biurrun wrote: > - Move a variable closer to where it is used > - Add an explanatory comment > - Simplify a crosscompile check > - Minor SHFLAGS simplification > - Coalesce some threads tests > --- > configure | 17 - > 1 file changed, 8 insertions(+), 9 deletions(-) > > diff --git a/configure b/configure > index 6f96a06f03..33c52240aa 100755 > --- a/configure > +++ b/configure > @@ -347,8 +347,6 @@ EOF >exit 0 > } > > -quotes='""' > - > log(){ > echo "$@" >> $logfile > } > @@ -2861,6 +2859,8 @@ done > > disabled logging && logfile=/dev/null > > +# command line configuration sanity checks > + > # we need to build at least one lib type > if ! enabled_any static shared; then > cat < @@ -3001,11 +3001,10 @@ case "$toolchain" in > ;; > esac > > -test -n "$cross_prefix" && enable cross_compile > - > -if enabled cross_compile; then > +if test -n "$cross_prefix"; then > test -n "$arch" && test -n "$target_os" || > die "Must specify target arch (--arch) and OS (--target-os) when > cross-compiling" > +enable cross_compile > fi > > ar_default="${cross_prefix}${ar_default}" > @@ -3828,7 +3827,7 @@ case $target_os in > ;; > sunos) > SHFLAGS='-shared -Wl,-h,$$(@F)' > -enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS" > +enabled x86 && append SHFLAGS -mimpure-text > network_extralibs="-lsocket -lnsl" > # When using suncc to build, the Solaris linker will mark > # an executable with each instruction set encountered by > @@ -4563,11 +4562,10 @@ if ! disabled pthreads && ! enabled w32threads; then > elif check_func pthread_join; then > enable pthreads > fi > +enabled pthreads && > +check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); > sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs > fi > > -enabled pthreads && > -check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); > sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs > - > disabled zlib || check_lib zlib zlib.h zlibVersion -lz > disabled bzlib || check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2 > > @@ -4849,6 +4847,7 @@ if enabled proper_dce; then > echo "X { local: *; };" > $TMPV > if test_ldflags -Wl,${version_script},$TMPV; then > append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver' > +quotes='""' > check_cc < void ff_foo(void) __asm__ ("av_foo@VERSION"); > void ff_foo(void) { ${inline_asm+__asm__($quotes);} } > LGTM ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] vp9_superframe_bsf: cache packets by creating new references instead of moving pointers
Fixes invalid reads after free. Signed-off-by: James Almer <jamr...@gmail.com> --- libavcodec/vp9_superframe_bsf.c | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/libavcodec/vp9_superframe_bsf.c b/libavcodec/vp9_superframe_bsf.c index 3669216009..ad66cb599b 100644 --- a/libavcodec/vp9_superframe_bsf.c +++ b/libavcodec/vp9_superframe_bsf.c @@ -148,8 +148,9 @@ static int vp9_superframe_filter(AVBSFContext *ctx, AVPacket *out) goto done; } -s->cache[s->n_cache++] = in; -in = NULL; +res = av_packet_ref(s->cache[s->n_cache++], in); +if (res < 0) +goto done; if (invisible) { res = AVERROR(EAGAIN); goto done; @@ -165,7 +166,7 @@ static int vp9_superframe_filter(AVBSFContext *ctx, AVPacket *out) goto done; for (n = 0; n < s->n_cache; n++) -av_packet_free(>cache[n]); +av_packet_unref(s->cache[n]); s->n_cache = 0; done: @@ -175,13 +176,28 @@ done: return res; } +static int vp9_superframe_init(AVBSFContext *ctx) +{ +VP9BSFContext *s = ctx->priv_data; +int n; + +// alloc cache packets +for (n = 0; n < MAX_CACHE; n++) { +s->cache[n] = av_packet_alloc(); +if (!s->cache[n]) +return AVERROR(ENOMEM); +} + +return 0; +} + static void vp9_superframe_close(AVBSFContext *ctx) { VP9BSFContext *s = ctx->priv_data; int n; // free cached data -for (n = 0; n < s->n_cache; n++) +for (n = 0; n < MAX_CACHE; n++) av_packet_free(>cache[n]); } @@ -193,6 +209,7 @@ const AVBitStreamFilter ff_vp9_superframe_bsf = { .name = "vp9_superframe", .priv_data_size = sizeof(VP9BSFContext), .filter = vp9_superframe_filter, +.init = vp9_superframe_init, .close = vp9_superframe_close, .codec_ids = codec_ids, }; -- 2.14.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] avutil: make AV_NOPTS_VALUE signed negative
On 11/4/2017 6:06 AM, Rémi Denis-Courmont wrote: > libav generally uses int64_t to represent timestamps, and thus > AV_NOPTS_VALUE has to fit witin the range of int64_t. > > The current definition of AV_NOPTS_VALUE results in AV_NOPTS_VALUE > having the same type as uint64_t, since its value is positive and > cannot be represented by int64_t. > > See also ISO C11 §6.4.4.1 clause 5. > > This patch ensures that AV_NOPTS_VALUE is an int64_t, avoiding > undefined overflowing conversion from uint64_t to int64_t. > --- > libavutil/avutil.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavutil/avutil.h b/libavutil/avutil.h > index 2339fe3c9c..9a5d8dbe57 100644 > --- a/libavutil/avutil.h > +++ b/libavutil/avutil.h > @@ -238,7 +238,7 @@ enum AVMediaType { > * either pts or dts. > */ > > -#define AV_NOPTS_VALUE INT64_C(0x8000) > +#define AV_NOPTS_VALUE (-INT64_C(0x7fff) - 1) $ grep INT64_MIN stdint.h stdint.h:#define INT64_MIN (-9223372036854775807LL - 1) Maybe just use INT64_MIN? > > /** > * Internal time base represented as integer > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] PATCH] h2645: Allocate a single buffer per packet. Drastically reduces memory usage on pathological streams.
On 11/3/2017 5:04 PM, Diego Biurrun wrote: > On Fri, Nov 03, 2017 at 04:50:56PM -0300, James Almer wrote: >> On 11/3/2017 4:42 PM, Luca Barbato wrote: >>> On 03/11/2017 19:23, Kieran Kunhya wrote: >>>> This patch fixes very high memory usage on pathological streams. >>> >>> this hunk seems spurious (and should not even compile with gcc). >> >> It does, but complains about mixed declarations and code. > > It does not because of -Werror=declaration-after-statement. > > Diego Right, didn't try to compile it before removing it locally so i didn't even notice declaration-after-statement was forced as an error. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] h2645_parse: Allocate a single buffer per packet
From: Kieran KunhyaDrastically reduces memory usage on pathological streams. --- Fixed so it may apply cleanly, and with the memset() change removed. libavcodec/h2645_parse.c | 22 -- libavcodec/h2645_parse.h | 10 -- libavcodec/h264_parser.c | 11 --- libavcodec/qsvenc_hevc.c | 13 + 4 files changed, 37 insertions(+), 19 deletions(-) diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c index b507b19ecb..2ee7672c05 100644 --- a/libavcodec/h2645_parse.c +++ b/libavcodec/h2645_parse.c @@ -30,7 +30,7 @@ #include "h2645_parse.h" int ff_h2645_extract_rbsp(const uint8_t *src, int length, - H2645NAL *nal) + H2645RBSP *rbsp, H2645NAL *nal) { int i, si, di; uint8_t *dst; @@ -88,11 +88,7 @@ int ff_h2645_extract_rbsp(const uint8_t *src, int length, return length; } -av_fast_malloc(>rbsp_buffer, >rbsp_buffer_size, - length + AV_INPUT_BUFFER_PADDING_SIZE); -if (!nal->rbsp_buffer) -return AVERROR(ENOMEM); - +nal->rbsp_buffer = >rbsp_buffer[rbsp->rbsp_buffer_size]; dst = nal->rbsp_buffer; memcpy(dst, src, i); @@ -125,6 +121,8 @@ nsc: nal->size = di; nal->raw_data = src; nal->raw_size = si; +rbsp->rbsp_buffer_size += si; + return si; } @@ -220,6 +218,11 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length, size_t next_avc = is_nalff ? 0 : length; bytestream2_init(, buf, length); +av_fast_padded_malloc(>rbsp.rbsp_buffer, >rbsp.rbsp_buffer_alloc_size, length); +if (!pkt->rbsp.rbsp_buffer) +return AVERROR(ENOMEM); + +pkt->rbsp.rbsp_buffer_size = 0; pkt->nb_nals = 0; while (bytestream2_get_bytes_left() >= 4) { @@ -287,7 +290,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length, } nal = >nals[pkt->nb_nals++]; -consumed = ff_h2645_extract_rbsp(bc.buffer, extract_length, nal); +consumed = ff_h2645_extract_rbsp(bc.buffer, extract_length, >rbsp, nal); if (consumed < 0) return consumed; @@ -322,9 +325,8 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length, void ff_h2645_packet_uninit(H2645Packet *pkt) { -int i; -for (i = 0; i < pkt->nals_allocated; i++) -av_freep(>nals[i].rbsp_buffer); av_freep(>nals); pkt->nals_allocated = 0; +av_freep(>rbsp.rbsp_buffer); +pkt->rbsp.rbsp_buffer_alloc_size = pkt->rbsp.rbsp_buffer_size = 0; } diff --git a/libavcodec/h2645_parse.h b/libavcodec/h2645_parse.h index 9cc4441d9e..63ec493622 100644 --- a/libavcodec/h2645_parse.h +++ b/libavcodec/h2645_parse.h @@ -28,7 +28,6 @@ typedef struct H2645NAL { uint8_t *rbsp_buffer; -int rbsp_buffer_size; int size; const uint8_t *data; @@ -60,9 +59,16 @@ typedef struct H2645NAL { int ref_idc; } H2645NAL; +typedef struct H2645RBSP { +uint8_t *rbsp_buffer; +int rbsp_buffer_alloc_size; +int rbsp_buffer_size; +} H2645RBSP; + /* an input packet split into unescaped NAL units */ typedef struct H2645Packet { H2645NAL *nals; +H2645RBSP rbsp; int nb_nals; int nals_allocated; } H2645Packet; @@ -71,7 +77,7 @@ typedef struct H2645Packet { * Extract the raw (unescaped) bitstream. */ int ff_h2645_extract_rbsp(const uint8_t *src, int length, - H2645NAL *nal); + H2645RBSP *rbsp, H2645NAL *nal); /** * Split an input packet into NAL units. diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index 0bb78e09c8..710b4180f5 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -207,6 +207,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, H264ParseContext *p = s->priv_data; const uint8_t *buf_end = buf + buf_size; +H2645RBSP rbsp = { NULL }; H2645NAL nal = { NULL }; unsigned int pps_id; @@ -225,6 +226,10 @@ static inline int parse_nal_units(AVCodecParserContext *s, if (!buf_size) return 0; +av_fast_padded_malloc(_buffer, _buffer_alloc_size, buf_size); +if (!rbsp.rbsp_buffer) +return AVERROR(ENOMEM); + for (;;) { const SPS *sps; int src_length, consumed; @@ -250,7 +255,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, break; } -consumed = ff_h2645_extract_rbsp(buf, src_length, ); +consumed = ff_h2645_extract_rbsp(buf, src_length, , ); if (consumed < 0) break; @@ -463,7 +468,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, s->field_order = AV_FIELD_UNKNOWN; } -av_freep(_buffer); +av_freep(_buffer); return 0; /* no need to evaluate the rest */ } buf += consumed; @@ -471,7 +476,7 @@ static inline int
Re: [libav-devel] PATCH] h2645: Allocate a single buffer per packet. Drastically reduces memory usage on pathological streams.
On 11/3/2017 4:42 PM, Luca Barbato wrote: > On 03/11/2017 19:23, Kieran Kunhya wrote: >> This patch fixes very high memory usage on pathological streams. > > this hunk seems spurious (and should not even compile with gcc). It does, but complains about mixed declarations and code. It's in any case a pointless change. zero initialization like it's currently doing is valid. > > diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c > index a7c71d9..2ddbbf9 100644 > --- a/libavcodec/h264_parse.c > +++ b/libavcodec/h264_parse.c > @@ -349,7 +349,8 @@ int ff_h264_init_poc(int pic_field_poc[2], int > *pic_poc, > static int decode_extradata_ps(const uint8_t *data, int size, > H264ParamSets *ps, > int is_avc, void *logctx) > { > - H2645Packet pkt = { 0 }; > + H2645Packet pkt; > + memset(, 0, sizeof(pkt)); > int i, ret = 0; > > ret = ff_h2645_packet_split(, data, size, logctx, is_avc, 2, > AV_CODEC_ID_H264, 1); > > lu > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] matroskadec: don't warn about unknown spherical medata when none is present
On 11/2/2017 5:39 PM, Sean McGovern wrote: > Hi, > > On Nov 2, 2017 16:32, "James Almer" <jamr...@gmail.com> wrote: > > On 11/2/2017 5:12 PM, Sean McGovern wrote: >> Hi James, >> >> On Nov 2, 2017 10:03, "James Almer" <jamr...@gmail.com> wrote: >> >> track->video.projection.type is 0 by default, and is the value set by the >> demuxer for files without the element. >> >> Signed-off-by: James Almer <jamr...@gmail.com> >> --- >> libavformat/matroskadec.c | 3 --- >> 1 file changed, 3 deletions(-) >> >> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c >> index c6e1a190a8..5ed03bb642 100644 >> --- a/libavformat/matroskadec.c >> +++ b/libavformat/matroskadec.c >> @@ -1659,9 +1659,6 @@ static int mkv_parse_video_projection(AVStream *st, >> const MatroskaTrack *track) >> } >> break; >> default: >> -av_log(NULL, AV_LOG_WARNING, >> - "Unknown spherical metadata type %"PRIu64"\n", >> - track->video.projection.type); >> return 0; >> } >> >> -- >> 2.14.2 >> >> ___ >> libav-devel mailing list >> libav-devel@libav.org >> https://lists.libav.org/mailman/listinfo/libav-devel >> >> >> Er... I'm not sure this is a better than what I had (with which I > agree >> on your review point). Isn't this log message potentially useful for >> corrupted streams? > > That's a good reason to add a "do nothing" case for > MATROSKA_VIDEO_PROJECTION_TYPE_RECTANGULAR (aka, none), which is the > default value that the demuxer will fill for every single mkv file it > parses, and keep keep the warning for default:. > >> >> Also please note that the sample from BZ #1055 currently registers as >> projection type 15 which maps to the _NB. Pretty strange for a sample >> hailing from 2008. I have a feeling the real bug is elsewhere... > > Not projection type, stereomode type 15. And in that case then the file > is corrupt, and it should perhaps be handled in ff_mkv_stereo3d_conv() > or similar. > >> >> -- Sean McGovern >> ___ >> libav-devel mailing list >> libav-devel@libav.org >> https://lists.libav.org/mailman/listinfo/libav-devel >> > > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > > > > Sorry yes I meant stereomode 15, and I suspect that is a bug from > ff_mkv_stereo3d_conv(). I can't agree to call that sample corrupt however > as mkvtoolnix iterates it just fine. Right, so the file doesn't have a StereoMode element at all, and the _NB value is simply set as default by the demuxer. In any case, all the StereoMode checks effectively make sure that track->video.stereo_mode is < _NB, so there is no bug there. I already sent a new version to silence the Spherical log message on files with no Spherical metadata, so that should be enough. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH v2] matroskadec: don't warn about unknown spherical medata when none is present
track->video.projection.type is set to 0 (a Matroska specific "No spherical metadata present" value, with no related AVSphericalMapping) by default on files without the element. This removes bogus warnings on every single matroska file without Spherical metadata. Signed-off-by: James Almer <jamr...@gmail.com> --- libavformat/matroskadec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index c6e1a190a8..3953cd304e 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1658,6 +1658,9 @@ static int mkv_parse_video_projection(AVStream *st, const MatroskaTrack *track) return AVERROR_INVALIDDATA; } break; +case MATROSKA_VIDEO_PROJECTION_TYPE_RECTANGULAR: +/* No Spherical metadata */ +return 0; default: av_log(NULL, AV_LOG_WARNING, "Unknown spherical metadata type %"PRIu64"\n", -- 2.14.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] matroskadec: don't warn about unknown spherical medata when none is present
On 11/2/2017 5:12 PM, Sean McGovern wrote: > Hi James, > > On Nov 2, 2017 10:03, "James Almer" <jamr...@gmail.com> wrote: > > track->video.projection.type is 0 by default, and is the value set by the > demuxer for files without the element. > > Signed-off-by: James Almer <jamr...@gmail.com> > --- > libavformat/matroskadec.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c > index c6e1a190a8..5ed03bb642 100644 > --- a/libavformat/matroskadec.c > +++ b/libavformat/matroskadec.c > @@ -1659,9 +1659,6 @@ static int mkv_parse_video_projection(AVStream *st, > const MatroskaTrack *track) > } > break; > default: > -av_log(NULL, AV_LOG_WARNING, > - "Unknown spherical metadata type %"PRIu64"\n", > - track->video.projection.type); > return 0; > } > > -- > 2.14.2 > > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > > > Er... I'm not sure this is a better than what I had (with which I agree > on your review point). Isn't this log message potentially useful for > corrupted streams? That's a good reason to add a "do nothing" case for MATROSKA_VIDEO_PROJECTION_TYPE_RECTANGULAR (aka, none), which is the default value that the demuxer will fill for every single mkv file it parses, and keep keep the warning for default:. > > Also please note that the sample from BZ #1055 currently registers as > projection type 15 which maps to the _NB. Pretty strange for a sample > hailing from 2008. I have a feeling the real bug is elsewhere... Not projection type, stereomode type 15. And in that case then the file is corrupt, and it should perhaps be handled in ff_mkv_stereo3d_conv() or similar. > > -- Sean McGovern > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] matroskadec: don't warn about unknown spherical medata when none is present
On 11/2/2017 12:01 PM, Luca Barbato wrote: > On 02/11/2017 15:03, James Almer wrote: >> track->video.projection.type is 0 by default, and is the value set by the >> demuxer for files without the element. >> >> Signed-off-by: James Almer <jamr...@gmail.com> >> --- >> libavformat/matroskadec.c | 3 --- >> 1 file changed, 3 deletions(-) >> >> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c >> index c6e1a190a8..5ed03bb642 100644 >> --- a/libavformat/matroskadec.c >> +++ b/libavformat/matroskadec.c >> @@ -1659,9 +1659,6 @@ static int mkv_parse_video_projection(AVStream >> *st, const MatroskaTrack *track) >> } >> break; >> default: >> - av_log(NULL, AV_LOG_WARNING, >> - "Unknown spherical metadata type %"PRIu64"\n", >> - track->video.projection.type); >> return 0; >> } >> > > not sure if would be overkill add a > > 0: return 0; // nothing to do > > or such. I don't think that's a good idea. There are projections we don't support which need to be handled by default:. Unless of course you prefer handling actual projection values we don't support and 0 ("rectangular" as called by Mastroska, which is the same as none) in a different way. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] matroskadec: don't warn about unknown spherical medata when none is present
track->video.projection.type is 0 by default, and is the value set by the demuxer for files without the element. Signed-off-by: James Almer <jamr...@gmail.com> --- libavformat/matroskadec.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index c6e1a190a8..5ed03bb642 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1659,9 +1659,6 @@ static int mkv_parse_video_projection(AVStream *st, const MatroskaTrack *track) } break; default: -av_log(NULL, AV_LOG_WARNING, - "Unknown spherical metadata type %"PRIu64"\n", - track->video.projection.type); return 0; } -- 2.14.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/3] matroskadec: skip video projection parsing for non-spherical video streams
On 11/1/2017 11:10 PM, Sean McGovern wrote: > --- > libavformat/matroskadec.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c > index c6e1a19..3743d4d 100644 > --- a/libavformat/matroskadec.c > +++ b/libavformat/matroskadec.c > @@ -1606,6 +1606,10 @@ static int mkv_parse_video_projection(AVStream *st, > const MatroskaTrack *track) > int ret; > GetByteContext gb; > > +if (track->video.stereo_mode == MATROSKA_VIDEO_STEREOMODE_TYPE_NB) { > + return 0; > +} > + > bytestream2_init(, track->video.projection.private.data, > track->video.projection.private.size); This is not correct. As Hendrik said stereo mode has nothing to do with Spherical. You can have elements from one but not the other. The problem you're seeing ("Unknown spherical metadata type 0" warning) is because track->video.projection.type == 0 is the default and set by the demuxer for every file without spherical elements. The demuxer should not emit a warning for that value and silently return instead. I'll send a patch for this in a moment. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 5/9] build: Have libxvid depend on roundf() instead of providing a fallback
On 10/18/2017 1:42 AM, Diego Biurrun wrote: > On Tue, Oct 17, 2017 at 11:36:03PM -0300, James Almer wrote: >> On 10/17/2017 10:22 PM, Diego Biurrun wrote: >>> A private fallback roundf() implementation is not worth the trouble >>> for a fringe feature like libxvid encoding. >> >> Removing libxvid support from every MSVC <= 2012 build (and maybe also >> other compilers) to save six lines in an internal header seems a bit >> unjustified... > > Thanks for reminding me which version of MSVC is the sensible one. :) > MS is now distributing them free of charge, so is there any good reason > not to just use a sensible version? No, there's IMO no reason to use a MSVC release older than 2013, but then again, some people/distros still rock GCC 4.4... > > The roundf fallback was added in 2007, probably for some BSD flavor or > some similar fringe thing. The BSDs eventually improved and started > fixing their libcs' POSIX capabilities instead of (literally) patching > all applications. I doubt any platform we still care about lacks roundf. > > Mind you, I care little about this patch and will just drop it. At some > point I think we should just get rid of all this fallback cruft and > just require a POSIX-compatible system. > >> And i don't know if you're aware that the scene of xvid rips is >> (inexplicably) still alive. > > But what do they use for encoding? I expect it would be the libxvid > encoder itself. I have no idea. I just know that xvid is still a thing, so removing support for its main encoder just to clean six lines of code, even if only for crappy compilers, seemed somewhat unjustified. > >>> --- a/configure >>> +++ b/configure >>> @@ -2388,7 +2388,7 @@ libx262_encoder_deps="libx262" >>> libx264_encoder_deps="libx264" >>> libx265_encoder_deps="libx265" >>> libxavs_encoder_deps="libxavs" >>> -libxvid_encoder_deps="libxvid mkstemp" >>> +libxvid_encoder_deps="libxvid mkstemp roundf" >> >> Wouldn't this keep libxvid enabled (thus libavcodec linking to it)? > > Not since I overhauled the link dependency handling :-))) Nice! > > Diego > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 5/9] build: Have libxvid depend on roundf() instead of providing a fallback
On 10/17/2017 10:22 PM, Diego Biurrun wrote: > A private fallback roundf() implementation is not worth the trouble > for a fringe feature like libxvid encoding. Removing libxvid support from every MSVC <= 2012 build (and maybe also other compilers) to save six lines in an internal header seems a bit unjustified... And i don't know if you're aware that the scene of xvid rips is (inexplicably) still alive. > --- > configure| 2 +- > libavutil/libm.h | 7 --- > 2 files changed, 1 insertion(+), 8 deletions(-) > > diff --git a/configure b/configure > index 2008083617..2477086799 100755 > --- a/configure > +++ b/configure > @@ -2388,7 +2388,7 @@ libx262_encoder_deps="libx262" > libx264_encoder_deps="libx264" > libx265_encoder_deps="libx265" > libxavs_encoder_deps="libxavs" > -libxvid_encoder_deps="libxvid mkstemp" > +libxvid_encoder_deps="libxvid mkstemp roundf" Wouldn't this keep libxvid enabled (thus libavcodec linking to it)? > > # demuxers / muxers > ac3_demuxer_select="ac3_parser" > diff --git a/libavutil/libm.h b/libavutil/libm.h > index d6c2cf8623..478207b6c8 100644 > --- a/libavutil/libm.h > +++ b/libavutil/libm.h > @@ -154,13 +154,6 @@ static av_always_inline av_const double round(double x) > } > #endif /* HAVE_ROUND */ > > -#if !HAVE_ROUNDF > -static av_always_inline av_const float roundf(float x) > -{ > -return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5); > -} > -#endif /* HAVE_ROUNDF */ > - > #if !HAVE_TRUNC > static av_always_inline av_const double trunc(double x) > { > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] configure: fix libxavs check
On 10/12/2017 2:17 PM, Diego Biurrun wrote: > On Thu, Oct 12, 2017 at 01:02:57AM -0300, James Almer wrote: >> libxavs may require pthreads and libm at link time, and without >> said ldflags available as global extralibs, the check will fail. >> >> Regression since 7cb1d9e2dbbe5bf4652be5d78cdd68e956fa3d63 >> --- >> I tried replacing the require() check with a require_pkg_config() >> one, and while it included the pthreads ldflag when libxavs was >> compiled with pthreads support, it didn't include the libm one. >> Considering the project seems dead, trying to get the installed >> pkg-config file fixed is probably futile. >> configure | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> --- a/configure >> +++ b/configure >> @@ -4781,7 +4781,7 @@ enabled libx264 && require_pkg_config >> libx264 x264 "stdint.h x264.h" x >> -enabled libxavs && require libxavs "stdint.h xavs.h" >> xavs_encoder_encode -lxavs >> +enabled libxavs && require libxavs "stdint.h xavs.h" >> xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs" > > Hm > > I don't like this. It's clearly a bug in libxavs that you are just working > around here. It should be fixed at the source. Even if libxavs itself may > be unfixable, it's certainly not unforkable. Would anyone even bother forking and maintaining this thing? > > What problem do you have exactly? libxavs certainly works on my FATE instance > that checks all external libraries. I compiled libxavs with default settings, installed it, then configure --enable-libxavs failed at the libxavs check. config.log showed a lot of missing references to pthreads and math functions when trying to link the test using only -lxavs. As i said, the project's .pc file includes a pthreads ldflag (-lpthreads in my case) but not -lm when it's clearly needed (i know some systems don't), so switching to require_pkg_config() is evidently not enough. > > Diego > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] configure: fix libxavs check
libxavs may require pthreads and libm at link time, and without said ldflags available as global extralibs, the check will fail. Regression since 7cb1d9e2dbbe5bf4652be5d78cdd68e956fa3d63 Signed-off-by: James Almer <jamr...@gmail.com> --- I tried replacing the require() check with a require_pkg_config() one, and while it included the pthreads ldflag when libxavs was compiled with pthreads support, it didn't include the libm one. Considering the project seems dead, trying to get the installed pkg-config file fixed is probably futile. configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 960c1ed032..77d71578cc 100755 --- a/configure +++ b/configure @@ -4781,7 +4781,7 @@ enabled libx264 && require_pkg_config libx264 x264 "stdint.h x264.h" x enable libx262; } enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get && require_cpp_condition x265.h "X265_BUILD >= 57" -enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode -lxavs +enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs" enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host || { ! enabled cross_compile && -- 2.14.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 01/10] configure: Drop feature for randomly disabling/enabling components
On 10/10/2017 8:07 PM, Diego Biurrun wrote: > On Tue, Oct 10, 2017 at 08:03:21PM -0300, James Almer wrote: >> On 10/10/2017 7:58 PM, Diego Biurrun wrote: >>> This feature was never used for anything. >> >> Was a fate client ever set with it? Because it's great to find missing >> dependencies on new modules (be it configure deps, object entries in >> Makefile, or FATE test deps if you don't make it a build only run) by >> disabling random things each time it runs. > > I believe that is better achieved by testing that all internal components > build standalone. I (ir)regularly run a script that does exactly that. > Has this feature ever reliably detected bugs within a reasonable timeframe? If run several times it should be able to detect mistakes in Oracle within a day. Even a full fate run wouldn't take long given it disables plenty of things each time. In any case, since it's a developer feature, if nobody is really using it then i guess it can go. > > Diego > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 01/10] configure: Drop feature for randomly disabling/enabling components
On 10/10/2017 7:58 PM, Diego Biurrun wrote: > This feature was never used for anything. Was a fate client ever set with it? Because it's great to find missing dependencies on new modules (be it configure deps, object entries in Makefile, or FATE test deps if you don't make it a build only run) by disabling random things each time it runs. > --- > configure | 41 - > 1 file changed, 41 deletions(-) > > diff --git a/configure b/configure > index f75fb28837..b6a9ed7978 100755 > --- a/configure > +++ b/configure > @@ -338,14 +338,6 @@ Developer options (useful when working on Libav itself): > used only for debugging purposes) >--enable-xmm-clobber-test check XMM registers for clobbering (Win64-only; > should be used only for debugging purposes) > - --enable-random randomly enable/disable components > - --disable-random > - --enable-random=LIST randomly enable/disable specific components or > - --disable-random=LISTcomponent groups. LIST is a comma-separated list > - of NAME[:PROB] entries where NAME is a component > - (group) and PROB the probability associated with > - NAME (default 0.5). > - --random-seed=VALUE seed value for --enable/disable-random >--disable-valgrind-backtrace do not print a backtrace under Valgrind > (only applies to --disable-optimizations builds) >--ignore-tests=TESTS comma-separated list (without "fate-" prefix > @@ -1850,7 +1842,6 @@ CMDLINE_SET=" > optflags > pkg_config > pkg_config_flags > -random_seed > samples > sysinclude > sysroot > @@ -2782,27 +2773,6 @@ show_list() { > exit 0 > } > > -rand_list(){ > -IFS=', ' > -set -- $* > -unset IFS > -for thing; do > -comp=${thing%:*} > -prob=${thing#$comp} > -prob=${prob#:} > -is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper > ${comp%s})_LIST > -echo "prob ${prob:-0.5}" > -printf '%s\n' $comp > -done > -} > - > -do_random(){ > -action=$1 > -shift > -random_seed=$(awk "BEGIN { srand($random_seed); print srand() }") > -$action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == > \"prob\" { prob = \$2; next } rand() < prob { print }") > -} > - > for opt do > optval="${opt#*=}" > case "$opt" in > @@ -2834,14 +2804,6 @@ for opt do > map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST > disable $LIBRARY_LIST $PROGRAM_LIST doc > ;; > ---enable-random|--disable-random) > -action=${opt%%-random} > -do_random ${action#--} $COMPONENT_LIST > -;; > ---enable-random=*|--disable-random=*) > -action=${opt%%-random=*} > -do_random ${action#--} $optval > -;; > --enable-*=*|--disable-*=*) > eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/') > is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt" > @@ -5272,9 +5234,6 @@ echo "shared${shared-no}" > echo "network support ${network-no}" > echo "threading support ${thread_type-no}" > echo "safe bitstream reader ${safe_bitstream_reader-no}" > -test -n "$random_seed" && > -echo "random seed ${random_seed}" > -echo > > echo "External libraries:" > print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH v2] cpu: split flag checks per arch in av_cpu_max_align()
On 9/15/2017 4:33 AM, Luca Barbato wrote: > On 14/09/2017 21:51, James Almer wrote: >> Signed-off-by: James Almer <jamr...@gmail.com> >> --- >> libavutil/aarch64/cpu.c | 9 + >> libavutil/arm/cpu.c | 9 + >> libavutil/cpu.c | 15 --- >> libavutil/cpu_internal.h | 5 + >> libavutil/ppc/cpu.c | 9 + >> libavutil/x86/cpu.c | 11 +++ >> 6 files changed, 51 insertions(+), 7 deletions(-) >> > > I like it. Ping? ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] avcodec/extract_extradata: return an error when buffer allocation fails
On 9/14/2017 4:51 AM, Luca Barbato wrote: > On 13/09/2017 22:07, James Almer wrote: >> ret is 0 by default. >> >> Signed-off-by: James Almer <jamr...@gmail.com> >> --- >> libavcodec/extract_extradata_bsf.c | 5 - >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/libavcodec/extract_extradata_bsf.c >> b/libavcodec/extract_extradata_bsf.c >> index 20840bd6a..100c60d06 100644 >> --- a/libavcodec/extract_extradata_bsf.c >> +++ b/libavcodec/extract_extradata_bsf.c >> @@ -101,14 +101,17 @@ static int extract_extradata_h2645(AVBSFContext >> *ctx, AVPacket *pkt, >> if (s->remove) { >> filtered_buf = av_buffer_alloc(pkt->size + >> AV_INPUT_BUFFER_PADDING_SIZE); >> - if (!filtered_buf) >> + if (!filtered_buf) { >> + ret = AVERROR(ENOMEM); >> goto fail; >> + } >> filtered_data = filtered_buf->data; >> } >> extradata = av_malloc(extradata_size + >> AV_INPUT_BUFFER_PADDING_SIZE); >> if (!extradata) { >> av_buffer_unref(_buf); >> + ret = AVERROR(ENOMEM); >> goto fail; >> } >> > > Seems fine. Ping? ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2 v2] configure: add test_pkg_config()
On 10/3/2017 9:49 PM, Diego Biurrun wrote: > On Fri, Sep 29, 2017 at 10:56:08PM -0300, James Almer wrote: >> --- a/configure >> +++ b/configure >> @@ -1039,8 +1039,15 @@ check_pkg_config(){ >> pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg) >> check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" && >> enable $name && >> -add_cflags"$pkg_cflags" && >> -eval $(sanitize_var_name ${name}_extralibs)="\$pkg_libs" >> +set_sanitized "${name}_cflags"$pkg_cflags && >> +set_sanitized "${name}_extralibs" $pkg_libs >> +} >> + >> +check_pkg_config(){ >> +log check_pkg_config "$@" >> +pkg="${2%% *}" >> +test_pkg_config "$@" || return >> +add_cflags $(get_sanitized "${name}_cflags") >> } > > You're setting pkg, but using name. Of course that works because all > variables are global in this shell script, but it's not exactly pretty > nonetheless. Yes, it was a mistake i didn't notice since name is effectively set globally as you said. > I'll try to make up my mind which way I want to handle > the situation. Want me to send a new version replacing pkg="${2%% *}" with name="$1" as i suggested in a previous reply? ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/2 v2] configure: use test_pkg_config() for the SDL check
On 10/2/2017 6:48 AM, Diego Biurrun wrote: > On Fri, Sep 29, 2017 at 10:56:09PM -0300, James Almer wrote: >> --- a/configure >> +++ b/configure >> @@ -4873,10 +4873,7 @@ fi >> >> # SDL is "special" and adds some CFLAGS that should not pollute anything >> else. >> if enabled avplay; then >> -CFLAGS_SAVE=$CFLAGS >> -check_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h >> SDL_PollEvent && >> -sdl_cflags=$pkg_cflags >> -CFLAGS=$CFLAGS_SAVE >> +test_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h >> SDL_PollEvent >> fi > > Uh, no. You're adding the CFLAGS globally. That's the very thing this, > admittedly, hack tries to prevent. No. I'm using test_pkg_config(), added in the last patch, which will set sdl_cflags but not affect global CFLAGS. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2 v2] configure: add test_pkg_config()
On 10/2/2017 6:49 AM, Diego Biurrun wrote: > On Fri, Sep 29, 2017 at 10:56:08PM -0300, James Almer wrote: >> --- a/configure >> +++ b/configure >> @@ -1025,8 +1025,8 @@ check_lib(){ >> >> -check_pkg_config(){ >> -log check_pkg_config "$@" >> +test_pkg_config(){ >> +log test_pkg_config "$@" >> name="$1" >> pkg_version="$2" >> pkg="${2%% *}" >> @@ -1039,8 +1039,15 @@ check_pkg_config(){ >> pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg) >> check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" && >> enable $name && >> -add_cflags"$pkg_cflags" && >> -eval $(sanitize_var_name ${name}_extralibs)="\$pkg_libs" >> +set_sanitized "${name}_cflags"$pkg_cflags && >> +set_sanitized "${name}_extralibs" $pkg_libs >> +} >> + >> +check_pkg_config(){ >> +log check_pkg_config "$@" >> +pkg="${2%% *}" >> +test_pkg_config "$@" || return >> +add_cflags $(get_sanitized "${name}_cflags") >> } > > At a quick glance, this looks like name and pkg are confused. No. I should actually add name="$1" and remove pkg="${2%% *}" here so it's clear what's using to avoid confusion, even if it's not strictly needed as $name is already set after calling test_pkg_config(). Look at the code I'm removing and the code I'm adding. -eval $(sanitize_var_name ${name}_extralibs)="\$pkg_libs" +set_sanitized "${name}_extralibs" $pkg_libs These two are virtually the same. I just made it use set_sanitized() since it's cleaner looking. test() +set_sanitized "${name}_cflags"$pkg_cflags && check() -add_cflags"$pkg_cflags" +add_cflags $(get_sanitized "${name}_cflags") With this I made sure add_cflags() is still only called in check_pkg_config() and not in the new test_pkg_config(), which will only set the package specific cflags and extralibs. In here $pkg_cflags and ${name}_cflags are always the same, whereas that can't be said for ${pkg}_cflags (example, all four vpx codecs have pkg as vpx). name is what was being used before and what is still being used after this patch. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/2 v2] configure: add test_pkg_config()
This helper is split off check_pkg_config(), setting only the pkg cflags and extralibs. This is useful for checks that don't require setting global cflags, or don't benefit from it. Signed-off-by: James Almer <jamr...@gmail.com> --- Now setting the correct name for the package's _cflags and _extralibs variables, and not setting global extralibs. configure | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/configure b/configure index a3cfe3768..cd60ae865 100755 --- a/configure +++ b/configure @@ -1025,8 +1025,8 @@ check_lib(){ enable $name && eval ${name}_extralibs="\$@" } -check_pkg_config(){ -log check_pkg_config "$@" +test_pkg_config(){ +log test_pkg_config "$@" name="$1" pkg_version="$2" pkg="${2%% *}" @@ -1039,8 +1039,15 @@ check_pkg_config(){ pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg) check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" && enable $name && -add_cflags"$pkg_cflags" && -eval $(sanitize_var_name ${name}_extralibs)="\$pkg_libs" +set_sanitized "${name}_cflags"$pkg_cflags && +set_sanitized "${name}_extralibs" $pkg_libs +} + +check_pkg_config(){ +log check_pkg_config "$@" +pkg="${2%% *}" +test_pkg_config "$@" || return +add_cflags $(get_sanitized "${name}_cflags") } check_exec(){ -- 2.14.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/2 v2] configure: use test_pkg_config() for the SDL check
Removes the extra code to preserve global cflags and extralibs. Signed-off-by: James Almer <jamr...@gmail.com> --- Removed the bogus avplay_extralibs line. It's added automatically as sdl is listed as a dependency of avplay. configure | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/configure b/configure index cd60ae865..4b359ffec 100755 --- a/configure +++ b/configure @@ -4873,10 +4873,7 @@ fi # SDL is "special" and adds some CFLAGS that should not pollute anything else. if enabled avplay; then -CFLAGS_SAVE=$CFLAGS -check_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h SDL_PollEvent && -sdl_cflags=$pkg_cflags -CFLAGS=$CFLAGS_SAVE +test_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h SDL_PollEvent fi ! disabled pod2man && check_cmd pod2man --help && enable pod2man || disable pod2man -- 2.14.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] configure: add test_pkg_config()
On 9/29/2017 2:46 PM, James Almer wrote: > This helper is split off check_pkg_config(), setting pkg but not global > cflags and extralibs. This is useful for checks that don't require or > benefit from setting the latter. > > Signed-off-by: James Almer <jamr...@gmail.com> > --- > configure | 16 > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/configure b/configure > index a3cfe3768..b9b243362 100755 > --- a/configure > +++ b/configure > @@ -1025,8 +1025,8 @@ check_lib(){ > enable $name && eval ${name}_extralibs="\$@" > } > > -check_pkg_config(){ > -log check_pkg_config "$@" > +test_pkg_config(){ > +log test_pkg_config "$@" > name="$1" > pkg_version="$2" > pkg="${2%% *}" > @@ -1039,8 +1039,16 @@ check_pkg_config(){ > pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg) > check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" && > enable $name && > -add_cflags"$pkg_cflags" && > -eval $(sanitize_var_name ${name}_extralibs)="\$pkg_libs" > +set_sanitized "${pkg}_cflags"$pkg_cflags && > +set_sanitized "${pkg}_extralibs" $pkg_libs Looking at this again after Lucas' comment, guess this should be ${name} and not ${pkg}? I tried only with SDL (Since it's autodetected) and it worked, but probably because name and pkg are the same. Will send a new version if that's indeed the case. > +} > + > +check_pkg_config(){ > +log check_pkg_config "$@" > +pkg="${2%% *}" > +test_pkg_config "$@" || return > +add_cflags$(get_sanitized "${pkg}_cflags") > +add_extralibs $(get_sanitized "${pkg}_extralibs") > } > > check_exec(){ > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/2] configure: add test_pkg_config()
This helper is split off check_pkg_config(), setting pkg but not global cflags and extralibs. This is useful for checks that don't require or benefit from setting the latter. Signed-off-by: James Almer <jamr...@gmail.com> --- configure | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/configure b/configure index a3cfe3768..b9b243362 100755 --- a/configure +++ b/configure @@ -1025,8 +1025,8 @@ check_lib(){ enable $name && eval ${name}_extralibs="\$@" } -check_pkg_config(){ -log check_pkg_config "$@" +test_pkg_config(){ +log test_pkg_config "$@" name="$1" pkg_version="$2" pkg="${2%% *}" @@ -1039,8 +1039,16 @@ check_pkg_config(){ pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg) check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" && enable $name && -add_cflags"$pkg_cflags" && -eval $(sanitize_var_name ${name}_extralibs)="\$pkg_libs" +set_sanitized "${pkg}_cflags"$pkg_cflags && +set_sanitized "${pkg}_extralibs" $pkg_libs +} + +check_pkg_config(){ +log check_pkg_config "$@" +pkg="${2%% *}" +test_pkg_config "$@" || return +add_cflags$(get_sanitized "${pkg}_cflags") +add_extralibs $(get_sanitized "${pkg}_extralibs") } check_exec(){ -- 2.14.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/2] configure: use test_pkg_config() for the SDL check
Removes the extra code to preserve global cflags and extralibs. Signed-off-by: James Almer <jamr...@gmail.com> --- configure | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/configure b/configure index b9b243362..36e2ca661 100755 --- a/configure +++ b/configure @@ -2601,6 +2601,7 @@ avconv_suggest="psapi shell32" avplay_deps="avcodec avfilter avformat avresample sdl" avplay_select="rdft format_filter transpose_filter hflip_filter vflip_filter" avplay_suggest="shell32" +avplay_extralibs="sdl_extralibs" avprobe_deps="avcodec avformat" avprobe_suggest="shell32" @@ -4874,10 +4875,7 @@ fi # SDL is "special" and adds some CFLAGS that should not pollute anything else. if enabled avplay; then -CFLAGS_SAVE=$CFLAGS -check_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h SDL_PollEvent && -sdl_cflags=$pkg_cflags -CFLAGS=$CFLAGS_SAVE +test_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h SDL_PollEvent fi ! disabled pod2man && check_cmd pod2man --help && enable pod2man || disable pod2man -- 2.14.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel