Re: [libav-devel] [RFC] [PATCH] pixdesc: Change color property name APIs return type

2017-04-20 Thread wm4
On Thu, 20 Apr 2017 11:26:10 -0400
Vittorio Giovara  wrote:

> This should make these APIs simpler to use, and less error prone
> in case the caller does not check they are valid, and makes them
> more similar to other naming APIs.
> ---
> This should help in the bug in avprobe found by Luca.
> Sending as RFC since I believe we are allowed to break this API as we
> did the version bump, but I'd like to be sure.
> 
> Vittorio
> 
>  libavutil/pixdesc.c | 10 +-
>  libavutil/pixdesc.h | 10 +-
>  2 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> index fb2e1a12f3..a2c4f9ba84 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -2003,30 +2003,30 @@ enum AVPixelFormat av_pix_fmt_swap_endianness(enum 
> AVPixelFormat pix_fmt)
>  const char *av_color_range_name(enum AVColorRange range)
>  {
>  return (unsigned) range < AVCOL_RANGE_NB ?
> -color_range_names[range] : NULL;
> +color_range_names[range] : "unknown";
>  }
>  
>  const char *av_color_primaries_name(enum AVColorPrimaries primaries)
>  {
>  return (unsigned) primaries < AVCOL_PRI_NB ?
> -color_primaries_names[primaries] : NULL;
> +color_primaries_names[primaries] : "unknown";
>  }
>  
>  const char *av_color_transfer_name(enum AVColorTransferCharacteristic 
> transfer)
>  {
>  return (unsigned) transfer < AVCOL_TRC_NB ?
> -color_transfer_names[transfer] : NULL;
> +color_transfer_names[transfer] : "unknown";
>  }
>  
>  const char *av_color_space_name(enum AVColorSpace space)
>  {
>  return (unsigned) space < AVCOL_SPC_NB ?
> -color_space_names[space] : NULL;
> +color_space_names[space] : "unknown";
>  }
>  
>  const char *av_chroma_location_name(enum AVChromaLocation location)
>  {
>  return (unsigned) location < AVCHROMA_LOC_NB ?
> -chroma_location_names[location] : NULL;
> +chroma_location_names[location] : "unknown";
>  }
>  
> diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
> index 3bb10f777a..4e53f59ef5 100644
> --- a/libavutil/pixdesc.h
> +++ b/libavutil/pixdesc.h
> @@ -293,27 +293,27 @@ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt);
>  enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt);
>  
>  /**
> - * @return the name for provided color range or NULL if unknown.
> + * @return the name for provided color range or "unknown" if unknown.
>   */
>  const char *av_color_range_name(enum AVColorRange range);
>  
>  /**
> - * @return the name for provided color primaries or NULL if unknown.
> + * @return the name for provided color primaries or "unknown" if unknown.
>   */
>  const char *av_color_primaries_name(enum AVColorPrimaries primaries);
>  
>  /**
> - * @return the name for provided color transfer or NULL if unknown.
> + * @return the name for provided color transfer or "unknown" if unknown.
>   */
>  const char *av_color_transfer_name(enum AVColorTransferCharacteristic 
> transfer);
>  
>  /**
> - * @return the name for provided color space or NULL if unknown.
> + * @return the name for provided color space or "unknown" if unknown.
>   */
>  const char *av_color_space_name(enum AVColorSpace space);
>  
>  /**
> - * @return the name for provided chroma location or NULL if unknown.
> + * @return the name for provided chroma location or "unknown" if unknown.
>   */
>  const char *av_chroma_location_name(enum AVChromaLocation location);
>  

This is a serious API change and needs to go through the entire
deprecation circus.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [RFC] H.264 raw bitstream editing

2017-04-20 Thread Mark Thompson
There have been vague thoughts on doing this for a while, here is an initial 
working implementation.

The idea here is to have internal API which decomposes an H.264 packet / access 
unit into structures containing every syntax element, and then corresponding 
API to recreate the packets on the other side.

All of the structures are new, because existing structures for these things in 
lavc (SPS/PPS, etc.) tend not to name their fields to match the standard, and 
also store some derived fields rather than the original values.  It would be 
possible to alter the existing structures to be reusable for this but it would 
probably be rather invasive, hence adding new structures for now.

This code supports read/write for all non-VCL NAL units found in normal streams 
(SPS, PPS, AUD, SEI), then support for the slice headers (everything above 
slice_data(), which gets saved to write back later).  Only some SEI messages 
are supported, but other ones are passed through unchanged.

Then there are some BSFs using this to work with H.264 streams:
* The h264_trace BSF logs all of the syntax element found in the stream while 
passing it through unchanged, and is useful for debugging (it can be inserted 
multiple times at different parts of the pipeline).
* The h264_metadata BSF edits header metadata in streams (VUI parameters).  It 
can also insert or remove AUDs, and add SEI user data.
* The h264_redundant_pps and h264_closegop BSFs apply specific fixups.  They 
are included here are examples, and, while working for the specific cases, 
probably aren't robust enough to be applied in their present form.

None of this should be regarded as final - thoughts welcome on everything.

Todo:
* Replace the ad-hoc header-writing code in VAAPI H.264 with this.
* Much of the error handling is missing (leaves structures in invalid states 
and leaks memory).
* Some internal documentation would be nice.
* Some way to avoid all of the copying in cases which don't need it - for 
example, h264_metadata doesn't need to deal with the slice data at all, and 
undoing and redoing the emulation prevention on the whole stream is a waste of 
time (note that the two fixup BSFs do need this, because they may change the 
byte alignment of the slice data).
* SEI read/write is kindof messy (ifdefs and required lengths), could be 
improved.
* Support more SEI - ideally everything which might reasonably be found in any 
normal stream would be supported.
* Inferred values are incomplete.
* h264_generate_ts BSF: we have enough information here to generate correct 
PTS/DTS for muxing raw streams, even when reordering is present.
* More trace information - e.g. knowing all of the reference picture lists 
would be rather nice.
* Support for the slice data?  (E.g. to make a lossless CAVLC <-> CABAC 
filter...)


Thanks,

- Mark
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH 4/6] lavc: Add h264_metadata bitstream filter

2017-04-20 Thread Mark Thompson
This is able to modify some header metadata found in the SPS/VUI,
and can also add/remove AUDs and insert user data in SEI NAL units.
---
 doc/bitstream_filters.texi |  47 +
 libavcodec/Makefile|   2 +
 libavcodec/bitstream_filters.c |   1 +
 libavcodec/h264_metadata_bsf.c | 466 +
 4 files changed, 516 insertions(+)
 create mode 100644 libavcodec/h264_metadata_bsf.c

diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi
index e1c268251..5fa7c76be 100644
--- a/doc/bitstream_filters.texi
+++ b/doc/bitstream_filters.texi
@@ -39,6 +39,53 @@ When this option is enabled, the long-term headers are 
removed from the
 bitstream after extraction.
 @end table
 
+@section h264_metadata
+
+Modify metadata attached to the H.264 stream.
+
+@table @option
+@item aud
+Insert or remove AUD NAL units in all access units of the stream.
+
+@table @samp
+@item insert
+@item remove
+@end table
+
+@item sample_aspect_ratio
+Set the sample aspect ratio in the stream in the VUI parameters.
+
+@item video_format
+@item video_full_range_flag
+Set the video format in the stream (see H.264 section E.2.1 and
+table E-2).
+
+@item colour_primaries
+@item transfer_characteristics
+@item matrix_coefficients
+Set the colour description in the stream (see H.264 section E.2.1
+and tables E-3, E-4 and E-5).
+
+@item chroma_sample_loc_type
+Set the chroma sample location in the stream (see H.264 section
+E.2.1 and figure E-1).
+
+@item frame_rate
+@item fixed_frame_rate_flag
+Set the frame rate in the VUI parameters (num_units_in_tick /
+time_scale).  Note that this is likely to be overridden by container
+parameters when the stream is in a container.
+
+@item sei_user_data
+Insert a string as SEI unregistered user data.  The argument must
+be of the form @emph{UUID+string}, where the UUID is as hex digits
+possibly separated by hyphens, and the string can be anything.
+
+For example, @samp{086f3693-b7b3-4f2c-9653-21492feee5b8+hello} will
+insert the string ``hello'' associated with the given UUID.
+
+@end table
+
 @section h264_mp4toannexb
 
 @section h264_trace
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index df0a563c3..26a0938ef 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -765,6 +765,8 @@ OBJS-$(CONFIG_CHOMP_BSF)  += chomp_bsf.o
 OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o
 OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF)  += extract_extradata_bsf.o\
  h2645_parse.o
+OBJS-$(CONFIG_H264_METADATA_BSF)  += h264_metadata_bsf.o \
+ h264_raw.o
 OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF)   += h264_mp4toannexb_bsf.o
 OBJS-$(CONFIG_H264_TRACE_BSF) += h264_trace_bsf.o \
  h264_raw.o
diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
index f5c842a28..8c1ecb725 100644
--- a/libavcodec/bitstream_filters.c
+++ b/libavcodec/bitstream_filters.c
@@ -28,6 +28,7 @@ extern const AVBitStreamFilter ff_aac_adtstoasc_bsf;
 extern const AVBitStreamFilter ff_chomp_bsf;
 extern const AVBitStreamFilter ff_dump_extradata_bsf;
 extern const AVBitStreamFilter ff_extract_extradata_bsf;
+extern const AVBitStreamFilter ff_h264_metadata_bsf;
 extern const AVBitStreamFilter ff_h264_mp4toannexb_bsf;
 extern const AVBitStreamFilter ff_h264_trace_bsf;
 extern const AVBitStreamFilter ff_hevc_mp4toannexb_bsf;
diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c
new file mode 100644
index 0..3fd4917ff
--- /dev/null
+++ b/libavcodec/h264_metadata_bsf.c
@@ -0,0 +1,466 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/common.h"
+#include "libavutil/opt.h"
+
+#include "bsf.h"
+#include "h264.h"
+#include "h264_raw.h"
+#include "h264_sei.h"
+
+enum {
+PASS,
+INSERT,
+REMOVE,
+};
+
+typedef struct H264MetadataContext {
+H264RawContext raw;
+H264RawAccessUnit access_unit;
+
+int aud;
+
+AVRational sample_aspect_ratio;
+
+int video_format;
+int video_full_range_flag;
+int colour_primaries;
+int transfer_characteristics;
+int matrix_coefficients;
+
+int chroma_sam

[libav-devel] [PATCH 2/6] lavc: Add H.264 raw bitstream manipulation functions

2017-04-20 Thread Mark Thompson
Reads packets (access units) by breaking constituent NAL units into
structures containing all syntax elements.  Writes packets by
reconstructing the stream from the syntax element structures.
---
 libavcodec/h264_raw.c|  777 ++
 libavcodec/h264_raw.h|  439 +
 libavcodec/h264_raw_syntax.c | 1476 ++
 libavcodec/h264_sei.h|1 +
 4 files changed, 2693 insertions(+)
 create mode 100644 libavcodec/h264_raw.c
 create mode 100644 libavcodec/h264_raw.h
 create mode 100644 libavcodec/h264_raw_syntax.c

diff --git a/libavcodec/h264_raw.c b/libavcodec/h264_raw.c
new file mode 100644
index 0..8f840a54a
--- /dev/null
+++ b/libavcodec/h264_raw.c
@@ -0,0 +1,777 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avassert.h"
+#include "libavutil/common.h"
+#include "libavutil/intmath.h"
+
+#include "avcodec.h"
+#include "bitstream.h"
+#include "bytestream.h"
+#include "golomb.h"
+#include "h264.h"
+#include "h264_sei.h"
+#include "h264_raw.h"
+#include "h2645_parse.h"
+#include "put_bits.h"
+
+
+static void h264_raw_trace_header(H264RawContext *ctx,
+  const char *name)
+{
+if (ctx->trace_callback)
+ctx->trace_callback(ctx->trace_callback_context,
+1, "%s\n", name);
+else
+av_log(ctx, ctx->trace_level, "== %s\n", name);
+}
+
+static void h264_raw_trace(H264RawContext *ctx, int position,
+   const char *name, const char *bits,
+   int64_t value)
+{
+size_t name_len, bits_len;
+int pad;
+
+av_assert0(value >= INT_MIN && value <= UINT32_MAX);
+
+name_len = strlen(name);
+bits_len = strlen(bits);
+
+if (name_len + bits_len > 60)
+pad = bits_len + 2;
+else
+pad = 61 - name_len;
+
+if (ctx->trace_callback) {
+ctx->trace_callback(ctx->trace_callback_context,
+0, "%-10d  %s%*s = %"PRId64"\n",
+position, name, pad, bits, value);
+} else {
+av_log(ctx, ctx->trace_level, "%-10d  %s%*s = %"PRId64"\n",
+   position, name, pad, bits, value);
+}
+}
+
+#define READ
+#include "h264_raw_syntax.c"
+#undef READ
+
+#define WRITE
+#include "h264_raw_syntax.c"
+#undef WRITE
+
+
+static int h264_raw_replace_sps(H264RawContext *ctx,
+const H264RawSPS *sps)
+{
+int id = sps->seq_parameter_set_id;
+if (id > FF_ARRAY_ELEMS(ctx->sps)) {
+av_log(ctx, AV_LOG_ERROR, "Invalid SPS id: %d.\n", id);
+return AVERROR_INVALIDDATA;
+}
+av_freep(&ctx->sps[id]);
+ctx->sps[id] = av_malloc(sizeof(*sps));
+if (!ctx->sps[id])
+return AVERROR(ENOMEM);
+memcpy(ctx->sps[id], sps, sizeof(*sps));
+return 0;
+}
+
+static int h264_raw_replace_pps(H264RawContext *ctx,
+const H264RawPPS *pps)
+{
+int id = pps->seq_parameter_set_id;
+if (id > FF_ARRAY_ELEMS(ctx->pps)) {
+av_log(ctx, AV_LOG_ERROR, "Invalid PPS id: %d.\n", id);
+return AVERROR_INVALIDDATA;
+}
+av_freep(&ctx->pps[id]);
+ctx->pps[id] = av_malloc(sizeof(*pps));
+if (!ctx->pps[id])
+return AVERROR(ENOMEM);
+memcpy(ctx->pps[id], pps, sizeof(*pps));
+return 0;
+}
+
+static int h264_raw_read_nal_unit(H264RawContext *ctx,
+  H264RawNALUnit *nal,
+  const uint8_t *data, int size)
+{
+BitstreamContext bc;
+int err;
+
+err = bitstream_init(&bc, data, 8 * size);
+if (err < 0)
+goto fail;
+
+switch (nal->type) {
+case H264_NAL_SPS:
+{
+nal->sps = av_mallocz(sizeof(*nal->sps));
+if (!nal->sps) {
+err = AVERROR(ENOMEM);
+goto fail;
+}
+err = h264_raw_read_sps(ctx, &bc, nal->sps);
+if (err < 0)
+goto fail;
+h264_raw_replace_sps(ctx, nal->sps);
+}
+break;
+case H264_NAL_PPS:
+{
+nal->pps = av_mallocz(sizeof(*nal->pps));
+if (!nal->sps) {
+err = AVERROR(ENO

[libav-devel] [PATCH 6/6] lavc: Add h264_closegop bitstream filter

2017-04-20 Thread Mark Thompson
Takes a broadcast-format stream containing no IDR frames and using
open-GOP throughout and transforms it into a stored stream with IDR
frames and closed-GOP.
---
 doc/bitstream_filters.texi |  16 ++
 libavcodec/Makefile|   2 +
 libavcodec/bitstream_filters.c |   1 +
 libavcodec/h264_closegop_bsf.c | 525 +
 4 files changed, 544 insertions(+)
 create mode 100644 libavcodec/h264_closegop_bsf.c

diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi
index dcb8232e0..cc264102c 100644
--- a/doc/bitstream_filters.texi
+++ b/doc/bitstream_filters.texi
@@ -39,6 +39,22 @@ When this option is enabled, the long-term headers are 
removed from the
 bitstream after extraction.
 @end table
 
+@section h264_closegop
+
+Takes a broadcast-format stream containing no IDR frames and using
+open-GOP throughout and transforms it into a stored stream with IDR
+frames and closed-GOP.
+
+The transformation is lossless, but some frames may be dropped around
+the I frames converted to IDR frames (any B frames which follow the I
+frame in decoding order but precede it in display order).
+
+@table @option
+@item gop_size
+Set the new GOP size of the stream.  This must be set higher than the
+maximum distance between I frames; if set lower the filter will fail.
+@end table
+
 @section h264_metadata
 
 Modify metadata attached to the H.264 stream.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index e7109041b..d2b7a2367 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -765,6 +765,8 @@ OBJS-$(CONFIG_CHOMP_BSF)  += chomp_bsf.o
 OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o
 OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF)  += extract_extradata_bsf.o\
  h2645_parse.o
+OBJS-$(CONFIG_H264_CLOSEGOP_BSF)  += h264_closegop_bsf.o \
+ h264_raw.o
 OBJS-$(CONFIG_H264_METADATA_BSF)  += h264_metadata_bsf.o \
  h264_raw.o
 OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF)   += h264_mp4toannexb_bsf.o
diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
index d24a2c675..bddf12560 100644
--- a/libavcodec/bitstream_filters.c
+++ b/libavcodec/bitstream_filters.c
@@ -28,6 +28,7 @@ extern const AVBitStreamFilter ff_aac_adtstoasc_bsf;
 extern const AVBitStreamFilter ff_chomp_bsf;
 extern const AVBitStreamFilter ff_dump_extradata_bsf;
 extern const AVBitStreamFilter ff_extract_extradata_bsf;
+extern const AVBitStreamFilter ff_h264_closegop_bsf;
 extern const AVBitStreamFilter ff_h264_metadata_bsf;
 extern const AVBitStreamFilter ff_h264_mp4toannexb_bsf;
 extern const AVBitStreamFilter ff_h264_redundant_pps_bsf;
diff --git a/libavcodec/h264_closegop_bsf.c b/libavcodec/h264_closegop_bsf.c
new file mode 100644
index 0..3a8e0cf12
--- /dev/null
+++ b/libavcodec/h264_closegop_bsf.c
@@ -0,0 +1,525 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avassert.h"
+#include "libavutil/common.h"
+#include "libavutil/fifo.h"
+#include "libavutil/opt.h"
+
+#include "bsf.h"
+#include "h264.h"
+#include "h264_raw.h"
+
+typedef struct H264CloseGOPPacket {
+AVPacket *input_packet;
+H264RawAccessUnit access_unit;
+} H264CloseGOPPacket;
+
+typedef struct H264CloseGOPContext {
+H264RawContext input;
+H264RawContext output;
+
+int gop_size;
+
+AVFifoBuffer *fifo;
+int gop_counter;
+int last_intra;
+
+int starting;
+int initial_drop;
+int eof;
+int drain_counter;
+int idr;
+
+int poc_delta;
+
+int frame_num;
+int idr_pic_id;
+int poc;
+} H264CloseGOPContext;
+
+
+static int h264_closegop_make_output(AVBSFContext *bsf, AVPacket *out)
+{
+H264CloseGOPContext *ctx = bsf->priv_data;
+H264CloseGOPPacket *pkt;
+H264RawAccessUnit *au;
+const H264RawSPS *sps;
+const H264RawPPS *pps;
+int err, i, advance_frame_num, drop, key;
+
+again:
+if (ctx->eof) {
+if (av_fifo_size(ctx->fifo) == 0)
+return AVERROR_EOF;
+} else if (ctx->drain_counter == 0) {
+if (ctx->eof)
+return AVERROR_EOF;
+else
+return AVERROR(EAGAIN);
+

[libav-devel] [PATCH 3/6] lavc: Add h264_trace bitstream filter

2017-04-20 Thread Mark Thompson
---
 doc/bitstream_filters.texi |  13 
 libavcodec/Makefile|   2 +
 libavcodec/bitstream_filters.c |   1 +
 libavcodec/h264_trace_bsf.c| 161 +
 4 files changed, 177 insertions(+)
 create mode 100644 libavcodec/h264_trace_bsf.c

diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi
index 64f91f4b5..e1c268251 100644
--- a/doc/bitstream_filters.texi
+++ b/doc/bitstream_filters.texi
@@ -41,6 +41,19 @@ bitstream after extraction.
 
 @section h264_mp4toannexb
 
+@section h264_trace
+
+Generate trace output containing all syntax elements in the H.264
+stream headers (everything above the level of @emph{slice_data()}).
+Includes SPS, PPS, AUD, slice headers, and some SEI.
+
+This is written to the normal logging facility by default.
+
+@table @option
+@item output_file
+Write trace output to this file instead.
+@end table
+
 @section imx_dump_header
 
 @section mjpeg2jpeg
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index e83513384..df0a563c3 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -766,6 +766,8 @@ OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += 
dump_extradata_bsf.o
 OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF)  += extract_extradata_bsf.o\
  h2645_parse.o
 OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF)   += h264_mp4toannexb_bsf.o
+OBJS-$(CONFIG_H264_TRACE_BSF) += h264_trace_bsf.o \
+ h264_raw.o
 OBJS-$(CONFIG_HEVC_MP4TOANNEXB_BSF)   += hevc_mp4toannexb_bsf.o
 OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF)+= imx_dump_header_bsf.o
 OBJS-$(CONFIG_MJPEG2JPEG_BSF) += mjpeg2jpeg_bsf.o
diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
index 79ce40f9e..f5c842a28 100644
--- a/libavcodec/bitstream_filters.c
+++ b/libavcodec/bitstream_filters.c
@@ -29,6 +29,7 @@ extern const AVBitStreamFilter ff_chomp_bsf;
 extern const AVBitStreamFilter ff_dump_extradata_bsf;
 extern const AVBitStreamFilter ff_extract_extradata_bsf;
 extern const AVBitStreamFilter ff_h264_mp4toannexb_bsf;
+extern const AVBitStreamFilter ff_h264_trace_bsf;
 extern const AVBitStreamFilter ff_hevc_mp4toannexb_bsf;
 extern const AVBitStreamFilter ff_imx_dump_header_bsf;
 extern const AVBitStreamFilter ff_mjpeg2jpeg_bsf;
diff --git a/libavcodec/h264_trace_bsf.c b/libavcodec/h264_trace_bsf.c
new file mode 100644
index 0..563261f1f
--- /dev/null
+++ b/libavcodec/h264_trace_bsf.c
@@ -0,0 +1,161 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include 
+
+#include "libavutil/common.h"
+#include "libavutil/log.h"
+#include "libavutil/opt.h"
+
+#include "bsf.h"
+#include "h264_raw.h"
+
+typedef struct H264TraceContext {
+H264RawContext raw;
+
+const char *output_file_name;
+FILE *output_file;
+} H264TraceContext;
+
+
+static void h264_trace_callback(void *context, int new_block, const char 
*format, ...)
+{
+AVBSFContext *bsf = context;
+H264TraceContext *ctx = bsf->priv_data;
+va_list vl;
+va_start(vl, format);
+
+if (ctx->output_file) {
+if (new_block)
+fprintf(ctx->output_file, "\n");
+
+vfprintf(ctx->output_file, format, vl);
+
+if (new_block)
+fprintf(ctx->output_file, "\n");
+} else {
+av_vlog(bsf, AV_LOG_INFO, format, vl);
+}
+
+va_end(vl);
+}
+
+static int h264_trace_init(AVBSFContext *bsf)
+{
+H264TraceContext *ctx = bsf->priv_data;
+int err;
+
+err = ff_h264_raw_init(&ctx->raw, bsf);
+if (err < 0)
+return err;
+
+ctx->raw.trace_enable = 1;
+
+if (ctx->output_file_name) {
+ctx->output_file = fopen(ctx->output_file_name, "w");
+if (!ctx->output_file) {
+err = errno;
+av_log(ctx, AV_LOG_ERROR, "Failed to open "
+   "output file %s: %m.", ctx->output_file_name);
+return AVERROR(err);
+}
+}
+ctx->raw.trace_callback = &h264_trace_callback;
+ctx->raw.trace_callback_context = bsf;
+
+if (bsf->par_in->extradata) {
+H264RawAccessUnit ps;
+
+h264_trace_callback(bsf, 0, "\nExtradata\n");
+
+err = ff_h264_raw_read_extradata(&ctx->raw, &ps, bsf->par_

[libav-devel] [PATCH 1/6] avconv: Flush output BSFs when stream copy reaches EOF

2017-04-20 Thread Mark Thompson
Same as f64d1100a54d12c78ce436181bb64229c56da6b3, for stream copy
rather than encode.
---
 avtools/avconv.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/avtools/avconv.c b/avtools/avconv.c
index 2e218e96c..719d289ff 100644
--- a/avtools/avconv.c
+++ b/avtools/avconv.c
@@ -1127,6 +1127,12 @@ static void do_streamcopy(InputStream *ist, OutputStream 
*ost, const AVPacket *p
 int64_t ost_tb_start_time = av_rescale_q(start_time, AV_TIME_BASE_Q, 
ost->mux_timebase);
 AVPacket opkt;
 
+// EOF: flush output bitstream filters.
+if (!pkt) {
+output_packet(of, &opkt, ost, 1);
+return;
+}
+
 av_init_packet(&opkt);
 
 if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) &&
@@ -1590,7 +1596,7 @@ static void process_input_packet(InputStream *ist, const 
AVPacket *pkt, int no_e
 break;
 }
 }
-for (i = 0; pkt && i < nb_output_streams; i++) {
+for (i = 0; i < nb_output_streams; i++) {
 OutputStream *ost = output_streams[i];
 
 if (!check_output_constraints(ist, ost) || ost->encoding_needed)
@@ -2779,7 +2785,7 @@ static int transcode(void)
 /* at the end of stream, we must flush the decoder buffers */
 for (i = 0; i < nb_input_streams; i++) {
 ist = input_streams[i];
-if (!input_files[ist->file_index]->eof_reached && 
ist->decoding_needed) {
+if (!input_files[ist->file_index]->eof_reached) {
 process_input_packet(ist, NULL, 0);
 }
 }
-- 
2.11.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH 5/6] lavc: Add h264_redundant_pps bitstream filter

2017-04-20 Thread Mark Thompson
This applies a specific fixup to some Bluray streams which contain
redundant PPSs modifying irrelevant parameters of the stream which
confuse other transformations which require correct extradata.

A new single global PPS is created, and all of the redundant PPSs
within the stream are removed.
---
 doc/bitstream_filters.texi  |   9 ++
 libavcodec/Makefile |   2 +
 libavcodec/bitstream_filters.c  |   1 +
 libavcodec/h264_redundant_pps_bsf.c | 179 
 4 files changed, 191 insertions(+)
 create mode 100644 libavcodec/h264_redundant_pps_bsf.c

diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi
index 5fa7c76be..dcb8232e0 100644
--- a/doc/bitstream_filters.texi
+++ b/doc/bitstream_filters.texi
@@ -88,6 +88,15 @@ insert the string ``hello'' associated with the given UUID.
 
 @section h264_mp4toannexb
 
+@section h264_redundant_pps
+
+This applies a specific fixup to some Bluray streams which contain
+redundant PPSs modifying irrelevant parameters of the stream which
+confuse other transformations which require correct extradata.
+
+A new single global PPS is created, and all of the redundant PPSs
+within the stream are removed.
+
 @section h264_trace
 
 Generate trace output containing all syntax elements in the H.264
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 26a0938ef..e7109041b 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -768,6 +768,8 @@ OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF)  += 
extract_extradata_bsf.o\
 OBJS-$(CONFIG_H264_METADATA_BSF)  += h264_metadata_bsf.o \
  h264_raw.o
 OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF)   += h264_mp4toannexb_bsf.o
+OBJS-$(CONFIG_H264_REDUNDANT_PPS_BSF) += h264_redundant_pps_bsf.o \
+ h264_raw.o
 OBJS-$(CONFIG_H264_TRACE_BSF) += h264_trace_bsf.o \
  h264_raw.o
 OBJS-$(CONFIG_HEVC_MP4TOANNEXB_BSF)   += hevc_mp4toannexb_bsf.o
diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
index 8c1ecb725..d24a2c675 100644
--- a/libavcodec/bitstream_filters.c
+++ b/libavcodec/bitstream_filters.c
@@ -30,6 +30,7 @@ extern const AVBitStreamFilter ff_dump_extradata_bsf;
 extern const AVBitStreamFilter ff_extract_extradata_bsf;
 extern const AVBitStreamFilter ff_h264_metadata_bsf;
 extern const AVBitStreamFilter ff_h264_mp4toannexb_bsf;
+extern const AVBitStreamFilter ff_h264_redundant_pps_bsf;
 extern const AVBitStreamFilter ff_h264_trace_bsf;
 extern const AVBitStreamFilter ff_hevc_mp4toannexb_bsf;
 extern const AVBitStreamFilter ff_imx_dump_header_bsf;
diff --git a/libavcodec/h264_redundant_pps_bsf.c 
b/libavcodec/h264_redundant_pps_bsf.c
new file mode 100644
index 0..98f10079e
--- /dev/null
+++ b/libavcodec/h264_redundant_pps_bsf.c
@@ -0,0 +1,179 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+
+#include "libavutil/common.h"
+#include "libavutil/mem.h"
+
+#include "bsf.h"
+#include "h264.h"
+#include "h264_raw.h"
+
+typedef struct H264RedundantPPSContext {
+H264RawContext input;
+H264RawContext output;
+
+H264RawAccessUnit access_unit;
+
+int global_pic_init_qp;
+int current_pic_init_qp;
+} H264RedundantPPSContext;
+
+
+static int h264_redundant_pps_fixup_pps(H264RedundantPPSContext *ctx,
+H264RawPPS *pps)
+{
+av_log(NULL, AV_LOG_WARNING, "pic_init_qp %d -> %d.\n",
+   ctx->current_pic_init_qp, pps->pic_init_qp_minus26 + 26);
+
+// Record the current value of pic_init_qp in order to fix up
+// following slices, then overwrite with the global value.
+ctx->current_pic_init_qp = pps->pic_init_qp_minus26 + 26;
+pps->pic_init_qp_minus26 = ctx->global_pic_init_qp - 26;
+
+// Some PPSs have this set, so it must be set in all of them.
+// (Slices which do not use such a PPS on input will still have
+// *_weight_l*flag as zero and therefore write equivalently.)
+pps->weighted_pred_flag = 1;
+
+return 0;
+}
+
+static int h264_redundant_pps_fixup_slice(H264RedundantPPSContext *ctx,
+  H264RawSliceHeader *slice)
+{
+int

Re: [libav-devel] [PATCH 1/2] hevc: Add NEON IDCT DC functions for bitdepth 8

2017-04-20 Thread Diego Biurrun
On Thu, Apr 20, 2017 at 11:04:26PM +0300, Martin Storsjö wrote:
> On Thu, 20 Apr 2017, Alexandra Hájková wrote:
> >From: Seppo Tomperi 
> >--- a/libavcodec/arm/hevcdsp_init_arm.c
> >+++ b/libavcodec/arm/hevcdsp_init_arm.c
> >@@ -26,8 +26,12 @@
> >#include "libavcodec/hevcdsp.h"
> >
> >void ff_hevc_idct_4x4_8_neon(int16_t *coeffs, int col_limit);
> >+void ff_hevc_idct_4x4_dc_8_neon(int16_t *coeffs);
> >void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit);
> >+void ff_hevc_idct_8x8_dc_8_neon(int16_t *coeffs);
> >void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit);
> >+void ff_hevc_idct_16x16_dc_8_neon(int16_t *coeffs);
> >+void ff_hevc_idct_32x32_dc_8_neon(int16_t *coeffs);
> >void ff_hevc_idct_4x4_10_neon(int16_t *coeffs, int col_limit);
> >void ff_hevc_idct_8x8_10_neon(int16_t *coeffs, int col_limit);
> >void ff_hevc_idct_16x16_10_neon(int16_t *coeffs, int col_limit);
> 
> As Diego suggested and I said in the previous review, group these with the
> idct_dc separately. You do this change in patch 2/2, but make it this way in
> the first commit directly instead of changing it later.

Yes, it's pointless churn to add the lines in 1/2 and move them in 2/2.

> >@@ -38,9 +42,14 @@ av_cold void ff_hevc_dsp_init_arm(HEVCDSPContext *c, int 
> >bit_depth)
> >
> >if (have_neon(cpu_flags)) {
> >if (bit_depth == 8) {
> >-c->idct[0] = ff_hevc_idct_4x4_8_neon;
> >-c->idct[1] = ff_hevc_idct_8x8_8_neon;
> >-c->idct[2] = ff_hevc_idct_16x16_8_neon;
> >+c->idct_dc[0] = ff_hevc_idct_4x4_dc_8_neon;
> >+c->idct_dc[1] = ff_hevc_idct_8x8_dc_8_neon;
> >+c->idct_dc[2] = ff_hevc_idct_16x16_dc_8_neon;
> >+c->idct_dc[3] = ff_hevc_idct_32x32_dc_8_neon;
> >+
> >+c->idct[0]= ff_hevc_idct_4x4_8_neon;
> >+c->idct[1]= ff_hevc_idct_8x8_8_neon;
> >+c->idct[2]= ff_hevc_idct_16x16_8_neon;
> 
> I'm not sure if I feel that it's necessary to realign the idct lines here;
> since they're grouped separately we could just have them aligned separately
> as well. (I'm not sure if Diego agrees here or not.)

I'd just add the idct_dc lines below w/o touching the existing lines.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 1/2] hevc: Add NEON IDCT DC functions for bitdepth 8

2017-04-20 Thread Martin Storsjö

On Thu, 20 Apr 2017, Alexandra Hájková wrote:


From: Seppo Tomperi 

Signed-off-by: Alexandra Hájková 
---
libavcodec/arm/hevc_idct.S| 78 +++
libavcodec/arm/hevcdsp_init_arm.c | 15 ++--
2 files changed, 90 insertions(+), 3 deletions(-)

diff --git a/libavcodec/arm/hevc_idct.S b/libavcodec/arm/hevc_idct.S
index 156d476..f0008aa 100644
--- a/libavcodec/arm/hevc_idct.S
+++ b/libavcodec/arm/hevc_idct.S
@@ -1,5 +1,7 @@
/*
 * ARM NEON optimised IDCT functions for HEVC decoding
+ *
+ * Copyright (c) 2014 Seppo Tomperi 
 * Copyright (c) 2017 Alexandra Hájková
 *
 * This file is part of Libav.
@@ -28,6 +30,82 @@ const trans, align=4
.short 57, 43, 25, 9
endconst

+function ff_hevc_idct_4x4_dc_8_neon, export=1
+ldrsh   r1, [r0]
+ldr r2, =0x20
+add r1, #1
+asr r1, #1
+add r1, r2
+asr r1, #6
+vdup.16 q0, r1
+vdup.16 q1, r1
+vst1.16 {q0, q1}, [r0, :128]
+bx  lr
+endfunc
+
+function ff_hevc_idct_8x8_dc_8_neon, export=1
+ldrsh   r1, [r0]
+ldr r2, =0x20
+add r1, #1
+asr r1, #1
+add r1, r2
+asr r1, #6
+vdup.16 q8, r1
+vdup.16 q9, r1
+vmov.16 q10, q8
+vmov.16 q11, q8
+vmov.16 q12, q8
+vmov.16 q13, q8
+vmov.16 q14, q8
+vmov.16 q15, q8
+vstmr0, {q8-q15}
+bx  lr
+endfunc
+
+function ff_hevc_idct_16x16_dc_8_neon, export=1
+ldrsh   r1, [r0]
+ldr r2, =0x20
+add r1, #1
+asr r1, #1
+add r1, r2
+asr r1, #6
+vdup.16 q8, r1
+vdup.16 q9, r1
+vmov.16 q10, q8
+vmov.16 q11, q8
+vmov.16 q12, q8
+vmov.16 q13, q8
+vmov.16 q14, q8
+vmov.16 q15, q8
+vstmr0!, {q8-q15}
+vstmr0!, {q8-q15}
+vstmr0!, {q8-q15}
+vstmr0, {q8-q15}
+bx  lr
+endfunc
+
+function ff_hevc_idct_32x32_dc_8_neon, export=1
+ldrsh   r1, [r0]
+ldr r2, =0x20
+add r1, #1
+asr r1, #1
+add r1, r2
+asr r1, #6
+mov r3, #16
+vdup.16 q8, r1
+vdup.16 q9, r1
+vmov.16 q10, q8
+vmov.16 q11, q8
+vmov.16 q12, q8
+vmov.16 q13, q8
+vmov.16 q14, q8
+vmov.16 q15, q8
+1:  subsr3, #1
+vstmr0!, {q8-q15}
+bne 1b
+bx lr


Misindented bx lr


+endfunc
+
.macro sum_sub out, in, c, op
  .ifc \op, +
vmlal.s16   \out, \in, \c
diff --git a/libavcodec/arm/hevcdsp_init_arm.c 
b/libavcodec/arm/hevcdsp_init_arm.c
index e61587f..10f60bc 100644
--- a/libavcodec/arm/hevcdsp_init_arm.c
+++ b/libavcodec/arm/hevcdsp_init_arm.c
@@ -26,8 +26,12 @@
#include "libavcodec/hevcdsp.h"

void ff_hevc_idct_4x4_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_4x4_dc_8_neon(int16_t *coeffs);
void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_8x8_dc_8_neon(int16_t *coeffs);
void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_16x16_dc_8_neon(int16_t *coeffs);
+void ff_hevc_idct_32x32_dc_8_neon(int16_t *coeffs);
void ff_hevc_idct_4x4_10_neon(int16_t *coeffs, int col_limit);
void ff_hevc_idct_8x8_10_neon(int16_t *coeffs, int col_limit);
void ff_hevc_idct_16x16_10_neon(int16_t *coeffs, int col_limit);


As Diego suggested and I said in the previous review, group these with the 
idct_dc separately. You do this change in patch 2/2, but make it this way 
in the first commit directly instead of changing it later.



@@ -38,9 +42,14 @@ av_cold void ff_hevc_dsp_init_arm(HEVCDSPContext *c, int 
bit_depth)

if (have_neon(cpu_flags)) {
if (bit_depth == 8) {
-c->idct[0] = ff_hevc_idct_4x4_8_neon;
-c->idct[1] = ff_hevc_idct_8x8_8_neon;
-c->idct[2] = ff_hevc_idct_16x16_8_neon;
+c->idct_dc[0] = ff_hevc_idct_4x4_dc_8_neon;
+c->idct_dc[1] = ff_hevc_idct_8x8_dc_8_neon;
+c->idct_dc[2] = ff_hevc_idct_16x16_dc_8_neon;
+c->idct_dc[3] = ff_hevc_idct_32x32_dc_8_neon;
+
+c->idct[0]= ff_hevc_idct_4x4_8_neon;
+c->idct[1]= ff_hevc_idct_8x8_8_neon;
+c->idct[2]= ff_hevc_idct_16x16_8_neon;


I'm not sure if I feel that it's necessary to realign the idct lines here; 

[libav-devel] [PATCH 2/2] hevc: Add support for bitdepth 10 for IDCT DC

2017-04-20 Thread Alexandra Hájková
---
 libavcodec/arm/hevc_idct.S| 42 +++
 libavcodec/arm/hevcdsp_init_arm.c | 22 ++--
 2 files changed, 45 insertions(+), 19 deletions(-)

diff --git a/libavcodec/arm/hevc_idct.S b/libavcodec/arm/hevc_idct.S
index f0008aa..41b1b29 100644
--- a/libavcodec/arm/hevc_idct.S
+++ b/libavcodec/arm/hevc_idct.S
@@ -30,26 +30,29 @@ const trans, align=4
 .short 57, 43, 25, 9
 endconst
 
-function ff_hevc_idct_4x4_dc_8_neon, export=1
+.macro idct_4x4_dc bitdepth
+function ff_hevc_idct_4x4_dc_\bitdepth\()_neon, export=1
 ldrsh   r1, [r0]
-ldr r2, =0x20
+ldr r2, =(1 << (13 - \bitdepth))
 add r1, #1
 asr r1, #1
 add r1, r2
-asr r1, #6
+asr r1, #(14 - \bitdepth)
 vdup.16 q0, r1
 vdup.16 q1, r1
 vst1.16 {q0, q1}, [r0, :128]
 bx  lr
 endfunc
+.endm
 
-function ff_hevc_idct_8x8_dc_8_neon, export=1
+.macro idct_8x8_dc bitdepth
+function ff_hevc_idct_8x8_dc_\bitdepth\()_neon, export=1
 ldrsh   r1, [r0]
-ldr r2, =0x20
+ldr r2, =(1 << (13 - \bitdepth))
 add r1, #1
 asr r1, #1
 add r1, r2
-asr r1, #6
+asr r1, #(14 - \bitdepth)
 vdup.16 q8, r1
 vdup.16 q9, r1
 vmov.16 q10, q8
@@ -61,14 +64,16 @@ function ff_hevc_idct_8x8_dc_8_neon, export=1
 vstmr0, {q8-q15}
 bx  lr
 endfunc
+.endm
 
-function ff_hevc_idct_16x16_dc_8_neon, export=1
+.macro idct_16x16_dc bitdepth
+function ff_hevc_idct_16x16_dc_\bitdepth\()_neon, export=1
 ldrsh   r1, [r0]
-ldr r2, =0x20
+ldr r2, =(1 << (13 - \bitdepth))
 add r1, #1
 asr r1, #1
 add r1, r2
-asr r1, #6
+asr r1, #(14 - \bitdepth)
 vdup.16 q8, r1
 vdup.16 q9, r1
 vmov.16 q10, q8
@@ -83,14 +88,16 @@ function ff_hevc_idct_16x16_dc_8_neon, export=1
 vstmr0, {q8-q15}
 bx  lr
 endfunc
+.endm
 
-function ff_hevc_idct_32x32_dc_8_neon, export=1
+.macro idct_32x32_dc bitdepth
+function ff_hevc_idct_32x32_dc_\bitdepth\()_neon, export=1
 ldrsh   r1, [r0]
-ldr r2, =0x20
+ldr r2, =(1 << (13 - \bitdepth))
 add r1, #1
 asr r1, #1
 add r1, r2
-asr r1, #6
+asr r1, #(14 - \bitdepth)
 mov r3, #16
 vdup.16 q8, r1
 vdup.16 q9, r1
@@ -103,8 +110,9 @@ function ff_hevc_idct_32x32_dc_8_neon, export=1
 1:  subsr3, #1
 vstmr0!, {q8-q15}
 bne 1b
-bx lr
+bx  lr
 endfunc
+.endm
 
 .macro sum_sub out, in, c, op
   .ifc \op, +
@@ -496,8 +504,16 @@ tr_16x4 secondpass_10, 20 - 10
 .ltorg
 
 idct_4x4 8
+idct_4x4_dc 8
 idct_4x4 10
+idct_4x4_dc 10
 idct_8x8 8
+idct_8x8_dc 8
 idct_8x8 10
+idct_8x8_dc 10
 idct_16x16 8
+idct_16x16_dc 8
 idct_16x16 10
+idct_16x16_dc 10
+idct_32x32_dc 8
+idct_32x32_dc 10
diff --git a/libavcodec/arm/hevcdsp_init_arm.c 
b/libavcodec/arm/hevcdsp_init_arm.c
index 10f60bc..99eff78 100644
--- a/libavcodec/arm/hevcdsp_init_arm.c
+++ b/libavcodec/arm/hevcdsp_init_arm.c
@@ -25,13 +25,18 @@
 
 #include "libavcodec/hevcdsp.h"
 
-void ff_hevc_idct_4x4_8_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_4x4_dc_8_neon(int16_t *coeffs);
-void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_8x8_dc_8_neon(int16_t *coeffs);
-void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_16x16_dc_8_neon(int16_t *coeffs);
 void ff_hevc_idct_32x32_dc_8_neon(int16_t *coeffs);
+void ff_hevc_idct_4x4_dc_10_neon(int16_t *coeffs);
+void ff_hevc_idct_8x8_dc_10_neon(int16_t *coeffs);
+void ff_hevc_idct_16x16_dc_10_neon(int16_t *coeffs);
+void ff_hevc_idct_32x32_dc_10_neon(int16_t *coeffs);
+
+void ff_hevc_idct_4x4_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_4x4_10_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_8x8_10_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_16x16_10_neon(int16_t *coeffs, int col_limit);
@@ -52,9 +57,14 @@ av_cold void ff_hevc_dsp_init_arm(HEVCDSPContext *c, int 
bit_depth)
 c->idct[2]= ff_hevc_idct_16x16_8_neon;
 }
 if (bit_depth == 10) {
-c->idct[0] = ff_hevc_idct_4x4_10_neon;
-c->idct[1] = ff_

[libav-devel] [PATCH 1/2] hevc: Add NEON IDCT DC functions for bitdepth 8

2017-04-20 Thread Alexandra Hájková
From: Seppo Tomperi 

Signed-off-by: Alexandra Hájková 
---
 libavcodec/arm/hevc_idct.S| 78 +++
 libavcodec/arm/hevcdsp_init_arm.c | 15 ++--
 2 files changed, 90 insertions(+), 3 deletions(-)

diff --git a/libavcodec/arm/hevc_idct.S b/libavcodec/arm/hevc_idct.S
index 156d476..f0008aa 100644
--- a/libavcodec/arm/hevc_idct.S
+++ b/libavcodec/arm/hevc_idct.S
@@ -1,5 +1,7 @@
 /*
  * ARM NEON optimised IDCT functions for HEVC decoding
+ *
+ * Copyright (c) 2014 Seppo Tomperi 
  * Copyright (c) 2017 Alexandra Hájková
  *
  * This file is part of Libav.
@@ -28,6 +30,82 @@ const trans, align=4
 .short 57, 43, 25, 9
 endconst
 
+function ff_hevc_idct_4x4_dc_8_neon, export=1
+ldrsh   r1, [r0]
+ldr r2, =0x20
+add r1, #1
+asr r1, #1
+add r1, r2
+asr r1, #6
+vdup.16 q0, r1
+vdup.16 q1, r1
+vst1.16 {q0, q1}, [r0, :128]
+bx  lr
+endfunc
+
+function ff_hevc_idct_8x8_dc_8_neon, export=1
+ldrsh   r1, [r0]
+ldr r2, =0x20
+add r1, #1
+asr r1, #1
+add r1, r2
+asr r1, #6
+vdup.16 q8, r1
+vdup.16 q9, r1
+vmov.16 q10, q8
+vmov.16 q11, q8
+vmov.16 q12, q8
+vmov.16 q13, q8
+vmov.16 q14, q8
+vmov.16 q15, q8
+vstmr0, {q8-q15}
+bx  lr
+endfunc
+
+function ff_hevc_idct_16x16_dc_8_neon, export=1
+ldrsh   r1, [r0]
+ldr r2, =0x20
+add r1, #1
+asr r1, #1
+add r1, r2
+asr r1, #6
+vdup.16 q8, r1
+vdup.16 q9, r1
+vmov.16 q10, q8
+vmov.16 q11, q8
+vmov.16 q12, q8
+vmov.16 q13, q8
+vmov.16 q14, q8
+vmov.16 q15, q8
+vstmr0!, {q8-q15}
+vstmr0!, {q8-q15}
+vstmr0!, {q8-q15}
+vstmr0, {q8-q15}
+bx  lr
+endfunc
+
+function ff_hevc_idct_32x32_dc_8_neon, export=1
+ldrsh   r1, [r0]
+ldr r2, =0x20
+add r1, #1
+asr r1, #1
+add r1, r2
+asr r1, #6
+mov r3, #16
+vdup.16 q8, r1
+vdup.16 q9, r1
+vmov.16 q10, q8
+vmov.16 q11, q8
+vmov.16 q12, q8
+vmov.16 q13, q8
+vmov.16 q14, q8
+vmov.16 q15, q8
+1:  subsr3, #1
+vstmr0!, {q8-q15}
+bne 1b
+bx lr
+endfunc
+
 .macro sum_sub out, in, c, op
   .ifc \op, +
 vmlal.s16   \out, \in, \c
diff --git a/libavcodec/arm/hevcdsp_init_arm.c 
b/libavcodec/arm/hevcdsp_init_arm.c
index e61587f..10f60bc 100644
--- a/libavcodec/arm/hevcdsp_init_arm.c
+++ b/libavcodec/arm/hevcdsp_init_arm.c
@@ -26,8 +26,12 @@
 #include "libavcodec/hevcdsp.h"
 
 void ff_hevc_idct_4x4_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_4x4_dc_8_neon(int16_t *coeffs);
 void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_8x8_dc_8_neon(int16_t *coeffs);
 void ff_hevc_idct_16x16_8_neon(int16_t *coeffs, int col_limit);
+void ff_hevc_idct_16x16_dc_8_neon(int16_t *coeffs);
+void ff_hevc_idct_32x32_dc_8_neon(int16_t *coeffs);
 void ff_hevc_idct_4x4_10_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_8x8_10_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_16x16_10_neon(int16_t *coeffs, int col_limit);
@@ -38,9 +42,14 @@ av_cold void ff_hevc_dsp_init_arm(HEVCDSPContext *c, int 
bit_depth)
 
 if (have_neon(cpu_flags)) {
 if (bit_depth == 8) {
-c->idct[0] = ff_hevc_idct_4x4_8_neon;
-c->idct[1] = ff_hevc_idct_8x8_8_neon;
-c->idct[2] = ff_hevc_idct_16x16_8_neon;
+c->idct_dc[0] = ff_hevc_idct_4x4_dc_8_neon;
+c->idct_dc[1] = ff_hevc_idct_8x8_dc_8_neon;
+c->idct_dc[2] = ff_hevc_idct_16x16_dc_8_neon;
+c->idct_dc[3] = ff_hevc_idct_32x32_dc_8_neon;
+
+c->idct[0]= ff_hevc_idct_4x4_8_neon;
+c->idct[1]= ff_hevc_idct_8x8_8_neon;
+c->idct[2]= ff_hevc_idct_16x16_8_neon;
 }
 if (bit_depth == 10) {
 c->idct[0] = ff_hevc_idct_4x4_10_neon;
-- 
2.10.2

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [RFC] [PATCH] stereo3d: Update the naming API to be more consistent

2017-04-20 Thread Luca Barbato
On 4/20/17 5:34 PM, Vittorio Giovara wrote:
> Change input type of the type->str function and return a proper
> error code for the str->type function.
> ---
> Similar reasoning to the previous patch.
> Vittorio
> 

Fine for me.

lu

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [RFC] [PATCH] pixdesc: Change color property name APIs return type

2017-04-20 Thread Luca Barbato
On 4/20/17 5:45 PM, Hendrik Leppkes wrote:
> On Thu, Apr 20, 2017 at 5:26 PM, Vittorio Giovara
>  wrote:
>> This should make these APIs simpler to use, and less error prone
>> in case the caller does not check they are valid, and makes them
>> more similar to other naming APIs.
>> ---
>> This should help in the bug in avprobe found by Luca.
>> Sending as RFC since I believe we are allowed to break this API as we
>> did the version bump, but I'd like to be sure.
>>
> 
> I prefer returning NULL, its a clear indicator of no name being
> present, and allows the caller to just not show this field at all.
> As a side-effect, it allows these APIs to actually be used to check
> the validity of the values, since invalid values have no name (and
> strcmp'ing the resul is not quite handy).
> 
> If one caller has a problem with a NULL return, it should perhaps be
> fixed in the caller.

A patch for it is already there, the question is more about what's
consistent and what's not to me.

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 2/8] libavutil: add mastering display metadata sidedata

2017-04-20 Thread Vittorio Giovara
On Tue, Apr 11, 2017 at 9:35 AM, Anton Khirnov  wrote:
> Quoting Vittorio Giovara (2017-04-10 14:44:38)
>> On Fri, Apr 7, 2017 at 3:13 PM, James Almer  wrote:
>> > On 4/7/2017 3:20 PM, Vittorio Giovara wrote:
>> >> On Fri, Apr 7, 2017 at 8:13 PM, James Almer  wrote:
>> >>> On 4/7/2017 1:48 PM, Vittorio Giovara wrote:
>>  On Fri, Apr 7, 2017 at 2:27 PM, Steve Lhomme  wrote:
>> > + * @note The struct should be allocated with 
>> > av_mastering_display_metadata_alloc()
>> > + *   and its size is not a part of the public ABI.
>> > + */
>> > +typedef struct AVMasteringDisplayMetadata {
>> > +} AVMasteringDisplayMetadata;
>> > +
>> > +/**
>> > + * Allocate an AVMasteringDisplayMetadata structure and set its 
>> > fields to
>> > + * default values. The resulting struct can be freed using av_freep().
>> > + *
>> > + * @return An AVMasteringDisplayMetadata filled with default values 
>> > or NULL
>> > + * on failure.
>> > + */
>> > +AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void);
>> 
>>  This signature might be problematic, it should host a size_t* which
>>  should be filled with the size of the struct, like it's done for other
>>  side data (except stereo3d for historical reasons).
>> >>>
>> >>> That will mean different signature between projects.
>> >>>
>> >>> And for that matter, why were you against me trying to add a replacement
>> >>> alloc function with this parameter, then?
>> >>
>> >> Because I don't think it's an issue big enough to warrant an API
>> >> change over existing code.
>> >>
>> >> On the other hand this new code in Libav so hopefully the code should
>> >> be fixed before committing and there is no need to break anything.
>> >> It's unfortunate that the signature will be different but either
>> >> documentation or ABI is currently violated in ffmpeg, there is no need
>> >> to replicate this behaviour in libav, in my opinion.
>> >
>> > We could add a function that returns size for this and every other
>> > similar struct, even if they already have an alloc function that
>> > also returns the struct size like Spherical.
>> > Something like that is in any case needed for av_*_new_side_data(),
>> > as those function do their own memory allocation.
>>
>> Hi James,
>> this could be a plausible workaround, which should be done in addition
>> to fixing the signature in my opinion.
>> Let's wait for other people opinions and ideas on this though.
>
> Why should we add workarounds when a perfectly working pattern exists
> already (the size_t* parameter to the alloc function). If mismatching
> signatures are a concern for you then the function could be renamed (its
> name is overly long for my taste anyway).

I'd tend to agree, probably on the extreme side: I see little point of
having "metadata" in every function name, header and types, it is
intrinsic to the information that is being carried, in my opinion.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [RFC] [PATCH] pixdesc: Change color property name APIs return type

2017-04-20 Thread Hendrik Leppkes
On Thu, Apr 20, 2017 at 5:26 PM, Vittorio Giovara
 wrote:
> This should make these APIs simpler to use, and less error prone
> in case the caller does not check they are valid, and makes them
> more similar to other naming APIs.
> ---
> This should help in the bug in avprobe found by Luca.
> Sending as RFC since I believe we are allowed to break this API as we
> did the version bump, but I'd like to be sure.
>

I prefer returning NULL, its a clear indicator of no name being
present, and allows the caller to just not show this field at all.
As a side-effect, it allows these APIs to actually be used to check
the validity of the values, since invalid values have no name (and
strcmp'ing the resul is not quite handy).

If one caller has a problem with a NULL return, it should perhaps be
fixed in the caller.

- Hendrik
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] spherical: add functions to retrieve and request projection names

2017-04-20 Thread Vittorio Giovara
From: James Almer 

Signed-off-by: James Almer 
Signed-off-by: Vittorio Giovara 
---
Hopefully this is the version everyone can compromise on.
Vittorio

 doc/APIchanges|  4 
 libavutil/spherical.c | 28 
 libavutil/spherical.h | 18 ++
 libavutil/version.h   |  2 +-
 4 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index a0ca3b7ac0..09b4b31557 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,10 @@ libavutil: 2017-03-23
 
 API changes, most recent first:
 
+2017-04-xx - xxx - lavu 56.1.0 - spherical.h
+  Add av_spherical_projection_name().
+  Add av_spherical_from_name().
+
 2017-03-xx - xxx - lavc 57.37.0 - avcodec.h
   Add AVCodecContext.hwaccel_flags field. This will control some hwaccels at
   a later point.
diff --git a/libavutil/spherical.c b/libavutil/spherical.c
index f5accc487d..30c94951f1 100644
--- a/libavutil/spherical.c
+++ b/libavutil/spherical.c
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "common.h"
 #include "mem.h"
 #include "spherical.h"
 
@@ -50,3 +51,30 @@ void av_spherical_tile_bounds(AVSphericalMapping *map,
 *right  = orig_width  - width  - *left;
 *bottom = orig_height - height - *top;
 }
+
+static const char *spherical_projection_names[] = {
+[AV_SPHERICAL_EQUIRECTANGULAR]  = "equirectangular",
+[AV_SPHERICAL_CUBEMAP]  = "cubemap",
+[AV_SPHERICAL_EQUIRECTANGULAR_TILE] = "tiled equirectangular",
+};
+
+const char *av_spherical_projection_name(enum AVSphericalProjection projection)
+{
+if ((unsigned) projection >= FF_ARRAY_ELEMS(spherical_projection_names))
+return "unknown";
+
+return spherical_projection_names[projection];
+}
+
+int av_spherical_from_name(const char *name)
+{
+int i;
+
+for (i = 0; i < FF_ARRAY_ELEMS(spherical_projection_names); i++) {
+size_t len = strlen(spherical_projection_names[i]);
+if (!strncmp(spherical_projection_names[i], name, len))
+return i;
+}
+
+return AVERROR(ENOSYS);
+}
diff --git a/libavutil/spherical.h b/libavutil/spherical.h
index fd662cf676..51ef22421e 100644
--- a/libavutil/spherical.h
+++ b/libavutil/spherical.h
@@ -206,6 +206,24 @@ void av_spherical_tile_bounds(AVSphericalMapping *map,
   size_t width, size_t height,
   size_t *left, size_t *top,
   size_t *right, size_t *bottom);
+
+/**
+ * Provide a human-readable name of a given AVSphericalProjection.
+ *
+ * @param projection The input AVSphericalProjection.
+ *
+ * @return The name of the AVSphericalProjection, or "unknown".
+ */
+const char *av_spherical_projection_name(enum AVSphericalProjection 
projection);
+
+/**
+ * Get the AVSphericalProjection form a human-readable name.
+ *
+ * @param name The input string.
+ *
+ * @return The AVSphericalProjection value, or AVERROR if not found.
+ */
+int av_spherical_from_name(const char *name);
 /**
  * @}
  * @}
diff --git a/libavutil/version.h b/libavutil/version.h
index b8425ea2c8..fd72ff431d 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -54,7 +54,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR 56
-#define LIBAVUTIL_VERSION_MINOR  0
+#define LIBAVUTIL_VERSION_MINOR  1
 #define LIBAVUTIL_VERSION_MICRO  0
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
2.12.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [RFC] [PATCH] stereo3d: Update the naming API to be more consistent

2017-04-20 Thread Vittorio Giovara
Change input type of the type->str function and return a proper
error code for the str->type function.
---
Similar reasoning to the previous patch.
Vittorio

 libavutil/stereo3d.c | 6 +++---
 libavutil/stereo3d.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavutil/stereo3d.c b/libavutil/stereo3d.c
index 5dc902e909..6e2f9f3ad2 100644
--- a/libavutil/stereo3d.c
+++ b/libavutil/stereo3d.c
@@ -54,9 +54,9 @@ static const char * const stereo3d_type_names[] = {
 [AV_STEREO3D_COLUMNS] = "interleaved columns",
 };
 
-const char *av_stereo3d_type_name(unsigned int type)
+const char *av_stereo3d_type_name(enum AVStereo3DType type)
 {
-if (type >= FF_ARRAY_ELEMS(stereo3d_type_names))
+if ((unsigned) type >= FF_ARRAY_ELEMS(stereo3d_type_names))
 return "unknown";
 
 return stereo3d_type_names[type];
@@ -72,5 +72,5 @@ int av_stereo3d_from_name(const char *name)
 return i;
 }
 
-return -1;
+return AVERROR(EINVAL);
 }
diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
index 0fa9f63a2c..cbf138faef 100644
--- a/libavutil/stereo3d.h
+++ b/libavutil/stereo3d.h
@@ -190,7 +190,7 @@ AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame);
  *
  * @return The name of the stereo3d value, or "unknown".
  */
-const char *av_stereo3d_type_name(unsigned int type);
+const char *av_stereo3d_type_name(enum AVStereo3DType type);
 
 /**
  * Get the AVStereo3DType form a human-readable name.
-- 
2.12.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [RFC] [PATCH] pixdesc: Change color property name APIs return type

2017-04-20 Thread Luca Barbato
On 4/20/17 5:26 PM, Vittorio Giovara wrote:
> This should make these APIs simpler to use, and less error prone
> in case the caller does not check they are valid, and makes them
> more similar to other naming APIs.
> ---
> This should help in the bug in avprobe found by Luca.
> Sending as RFC since I believe we are allowed to break this API as we
> did the version bump, but I'd like to be sure.
> 

I'm not against it and I guess we should keep breaking stuff for the
next month :p

lu

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [RFC] [PATCH] pixdesc: Change color property name APIs return type

2017-04-20 Thread Vittorio Giovara
This should make these APIs simpler to use, and less error prone
in case the caller does not check they are valid, and makes them
more similar to other naming APIs.
---
This should help in the bug in avprobe found by Luca.
Sending as RFC since I believe we are allowed to break this API as we
did the version bump, but I'd like to be sure.

Vittorio

 libavutil/pixdesc.c | 10 +-
 libavutil/pixdesc.h | 10 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index fb2e1a12f3..a2c4f9ba84 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2003,30 +2003,30 @@ enum AVPixelFormat av_pix_fmt_swap_endianness(enum 
AVPixelFormat pix_fmt)
 const char *av_color_range_name(enum AVColorRange range)
 {
 return (unsigned) range < AVCOL_RANGE_NB ?
-color_range_names[range] : NULL;
+color_range_names[range] : "unknown";
 }
 
 const char *av_color_primaries_name(enum AVColorPrimaries primaries)
 {
 return (unsigned) primaries < AVCOL_PRI_NB ?
-color_primaries_names[primaries] : NULL;
+color_primaries_names[primaries] : "unknown";
 }
 
 const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
 {
 return (unsigned) transfer < AVCOL_TRC_NB ?
-color_transfer_names[transfer] : NULL;
+color_transfer_names[transfer] : "unknown";
 }
 
 const char *av_color_space_name(enum AVColorSpace space)
 {
 return (unsigned) space < AVCOL_SPC_NB ?
-color_space_names[space] : NULL;
+color_space_names[space] : "unknown";
 }
 
 const char *av_chroma_location_name(enum AVChromaLocation location)
 {
 return (unsigned) location < AVCHROMA_LOC_NB ?
-chroma_location_names[location] : NULL;
+chroma_location_names[location] : "unknown";
 }
 
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
index 3bb10f777a..4e53f59ef5 100644
--- a/libavutil/pixdesc.h
+++ b/libavutil/pixdesc.h
@@ -293,27 +293,27 @@ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt);
 enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt);
 
 /**
- * @return the name for provided color range or NULL if unknown.
+ * @return the name for provided color range or "unknown" if unknown.
  */
 const char *av_color_range_name(enum AVColorRange range);
 
 /**
- * @return the name for provided color primaries or NULL if unknown.
+ * @return the name for provided color primaries or "unknown" if unknown.
  */
 const char *av_color_primaries_name(enum AVColorPrimaries primaries);
 
 /**
- * @return the name for provided color transfer or NULL if unknown.
+ * @return the name for provided color transfer or "unknown" if unknown.
  */
 const char *av_color_transfer_name(enum AVColorTransferCharacteristic 
transfer);
 
 /**
- * @return the name for provided color space or NULL if unknown.
+ * @return the name for provided color space or "unknown" if unknown.
  */
 const char *av_color_space_name(enum AVColorSpace space);
 
 /**
- * @return the name for provided chroma location or NULL if unknown.
+ * @return the name for provided chroma location or "unknown" if unknown.
  */
 const char *av_chroma_location_name(enum AVChromaLocation location);
 
-- 
2.12.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] avplay: Do not try to allocate new frames when the player is closing

2017-04-20 Thread Luca Barbato
On 4/18/17 12:24 AM, Luca Barbato wrote:
> The allocation event can trigger while the decoding thread is already
> closing.
> 
> Bug-Id: 1052
> CC: libav-sta...@libav.org
> ---
>  avtools/avplay.c | 15 +--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 

Ping.

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] swscale-test: const correctness

2017-04-20 Thread Luca Barbato
On 19/04/2017 11:11, Diego Biurrun wrote:
> ---
> 
> The casts are somewhat ugly, but probably unavoidable...
> 

Ugly but correct.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel