[FFmpeg-devel] [PATCH v3 3/5] avfilter/vf_showinfo: display user data unregistered message

2019-12-18 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/vf_showinfo.c | 33 +
 1 file changed, 33 insertions(+)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 31f6b32aa4..bb3b37e0c5 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -169,6 +169,36 @@ static void dump_content_light_metadata(AVFilterContext 
*ctx, AVFrameSideData *s
metadata->MaxCLL, metadata->MaxFALL);
 }
 
+static int string_is_ascii(const uint8_t *str)
+{
+while (*str && *str < 128) str++;
+return !*str;
+}
+
+static void dump_user_data_unregistered_metadata(AVFilterContext *ctx, 
AVFrameSideData *sd)
+{
+const int uuid_size = 16;
+uint8_t *user_data = sd->data;
+
+if (sd->size < uuid_size) {
+av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))", 
sd->size, uuid_size);
+return;
+}
+
+av_log(ctx, AV_LOG_INFO, "User Data Unregistered:\n");
+av_log(ctx, AV_LOG_INFO, "UUID=");
+for (int i = 0; i < uuid_size; i++)
+av_log(ctx, AV_LOG_INFO, "%x", user_data[i]);
+av_log(ctx, AV_LOG_INFO, "\n");
+
+user_data += uuid_size;
+/* Only print the user data details if it's string */
+if (string_is_ascii(user_data)) {
+av_log(ctx, AV_LOG_INFO, "User Data=");
+av_log(ctx, AV_LOG_INFO, "%s", user_data);
+}
+}
+
 static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
 {
 const char *color_range_str = av_color_range_name(frame->color_range);
@@ -319,6 +349,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 av_log(ctx, AV_LOG_INFO, "GOP timecode - %s", tcbuf);
 break;
 }
+case AV_FRAME_DATA_USER_DATA_UNREGISTERED:
+dump_user_data_unregistered_metadata(ctx, sd);
+break;
 default:
 av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d bytes)",
sd->type, sd->size);
-- 
2.21.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v3 5/5] avcodec/h264: create user data unregistered side data for H.264

2019-12-18 Thread lance . lmwang
From: Limin Wang 

Below is the sample with more than one user data SEI message for -vf showinfo
(need to apply the patchset):

[Parsed_showinfo_0 @ 0x7f8d42f01480]   side data - User Data Unregistered:
[Parsed_showinfo_0 @ 0x7f8d42f01480] UUID=186f369370304f2c603021492feee5b8
[Parsed_showinfo_0 @ 0x7f8d42f01480] User Data=hello
[Parsed_showinfo_0 @ 0x7f8d42f01480]   side data - User Data Unregistered:
[Parsed_showinfo_0 @ 0x7f8d42f01480] UUID=186f369370304f2c603021492feee5b9
[Parsed_showinfo_0 @ 0x7f8d42f01480] User Data=ttytest1

Signed-off-by: Limin Wang 
---
 libavcodec/h264_sei.c |  23 -
 libavcodec/h264_sei.h |   2 +
 libavcodec/h264_slice.c   |  18 
 tests/ref/fate/mov-zombie | 195 +-
 4 files changed, 168 insertions(+), 70 deletions(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index a565feabe2..7b23604a66 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -52,6 +52,10 @@ void ff_h264_sei_uninit(H264SEIContext *h)
 h->afd.present =  0;
 
 av_buffer_unref(>a53_caption.buf_ref);
+for (int i = 0; i < h->unregistered.nb_buf_ref; i++)
+av_buffer_unref(>unregistered.buf_ref[i]);
+h->unregistered.nb_buf_ref = 0;
+av_freep(>unregistered.buf_ref);
 }
 
 static int decode_picture_timing(H264SEIPictureTiming *h, GetBitContext *gb,
@@ -246,25 +250,34 @@ static int 
decode_unregistered_user_data(H264SEIUnregistered *h, GetBitContext *
 {
 uint8_t *user_data;
 int e, build, i;
+AVBufferRef *buf_ref, **tmp;
 
-if (size < 16 || size >= INT_MAX - 1)
+if (size < 16)
 return AVERROR_INVALIDDATA;
 
-user_data = av_malloc(size + 1);
-if (!user_data)
+if (h->nb_buf_ref > INT_MAX / sizeof(*h->buf_ref) - 1)
+   return AVERROR(EINVAL);
+
+tmp = av_realloc(h->buf_ref, (h->nb_buf_ref + 1) * sizeof(*h->buf_ref));
+if (!tmp)
+return AVERROR(ENOMEM);
+h->buf_ref = tmp;
+
+buf_ref = av_buffer_alloc(size);
+if (!buf_ref)
 return AVERROR(ENOMEM);
+user_data = buf_ref->data;
 
 for (i = 0; i < size; i++)
 user_data[i] = get_bits(gb, 8);
+h->buf_ref[h->nb_buf_ref++] = buf_ref;
 
-user_data[i] = 0;
 e = sscanf(user_data + 16, "x264 - core %d", );
 if (e == 1 && build > 0)
 h->x264_build = build;
 if (e == 1 && build == 1 && !strncmp(user_data+16, "x264 - core ", 16))
 h->x264_build = 67;
 
-av_free(user_data);
 return 0;
 }
 
diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
index a75c3aa175..aa4595ff25 100644
--- a/libavcodec/h264_sei.h
+++ b/libavcodec/h264_sei.h
@@ -121,6 +121,8 @@ typedef struct H264SEIA53Caption {
 
 typedef struct H264SEIUnregistered {
 int x264_build;
+AVBufferRef **buf_ref;
+int nb_buf_ref;
 } H264SEIUnregistered;
 
 typedef struct H264SEIRecoveryPoint {
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index e24d41ca50..d43612e19b 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1285,6 +1285,24 @@ static int h264_export_frame_props(H264Context *h)
 h->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 }
 
+for (int i = 0; i < h->sei.unregistered.nb_buf_ref; i++) {
+H264SEIUnregistered *unreg = >sei.unregistered;
+
+if (unreg->buf_ref[i]) {
+AVFrameSideData *sd = av_frame_new_side_data_from_buf(cur->f,
+AV_FRAME_DATA_USER_DATA_UNREGISTERED,
+unreg->buf_ref[i]);
+if (!sd)
+av_buffer_unref(>buf_ref[i]);
+unreg->buf_ref[i] = NULL;
+}
+}
+
+if (h->sei.unregistered.nb_buf_ref > 0) {
+h->sei.unregistered.nb_buf_ref = 0;
+av_freep(>sei.unregistered.buf_ref);
+}
+
 if (h->sei.picture_timing.timecode_cnt > 0) {
 uint32_t tc = 0;
 uint32_t *tc_sd;
diff --git a/tests/ref/fate/mov-zombie b/tests/ref/fate/mov-zombie
index f45fa59637..0888295cfc 100644
--- a/tests/ref/fate/mov-zombie
+++ b/tests/ref/fate/mov-zombie
@@ -1,133 +1,198 @@
 
packet|codec_type=video|stream_index=0|pts=0|pts_time=0.00|dts=-3004|dts_time=-0.033378|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=4133|pos=11309|flags=K_
 
packet|codec_type=video|stream_index=0|pts=5440|pts_time=0.060444|dts=-567|dts_time=-0.006300|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1077|pos=15442|flags=__

[FFmpeg-devel] [PATCH v3 4/5] avcodec/h264_sei: fix the size of user data unregistered

2019-12-18 Thread lance . lmwang
From: Limin Wang 

According to the specifications, the payloadSize includes the 16-byte size of 
UUID.

Signed-off-by: Limin Wang 
---
 libavcodec/h264_sei.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index d4eb9c0dab..a565feabe2 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -247,14 +247,14 @@ static int 
decode_unregistered_user_data(H264SEIUnregistered *h, GetBitContext *
 uint8_t *user_data;
 int e, build, i;
 
-if (size < 16 || size >= INT_MAX - 16)
+if (size < 16 || size >= INT_MAX - 1)
 return AVERROR_INVALIDDATA;
 
-user_data = av_malloc(16 + size + 1);
+user_data = av_malloc(size + 1);
 if (!user_data)
 return AVERROR(ENOMEM);
 
-for (i = 0; i < size + 16; i++)
+for (i = 0; i < size; i++)
 user_data[i] = get_bits(gb, 8);
 
 user_data[i] = 0;
-- 
2.21.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v3 2/5] avcodec/hevc_sei: add support for user data unregistered SEI message

2019-12-18 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavcodec/hevc_sei.c   | 34 +
 libavcodec/hevc_sei.h   |  6 +
 libavcodec/hevcdec.c| 18 +++
 tests/ref/fate/hevc-monochrome-crop |  3 +++
 4 files changed, 61 insertions(+)

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index c59bd4321e..7f738a049c 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -206,6 +206,33 @@ static int 
decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB
 return 0;
 }
 
+static int decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, 
GetBitContext *gb,
+  int size)
+{
+AVBufferRef *buf_ref, **tmp;
+
+if (size < 16)
+   return AVERROR(EINVAL);
+
+if (s->nb_buf_ref > INT_MAX / sizeof(*s->buf_ref) - 1)
+   return AVERROR(EINVAL);
+
+tmp = av_realloc(s->buf_ref, (s->nb_buf_ref + 1) * sizeof(*s->buf_ref));
+if (!tmp)
+return AVERROR(ENOMEM);
+s->buf_ref = tmp;
+
+buf_ref = av_buffer_alloc(size);
+if (!buf_ref)
+return AVERROR(ENOMEM);
+
+for (int i = 0; i < size; i++)
+buf_ref->data[i] = get_bits(gb, 8);
+s->buf_ref[s->nb_buf_ref++] = buf_ref;
+
+return 0;
+}
+
 static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, 
GetBitContext *gb,
  int size)
 {
@@ -293,6 +320,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, void 
*logctx, HEVCSEI *s,
 return decode_nal_sei_active_parameter_sets(s, gb, logctx);
 case HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
 return decode_nal_sei_user_data_registered_itu_t_t35(s, gb, size);
+case HEVC_SEI_TYPE_USER_DATA_UNREGISTERED:
+return decode_nal_sei_user_data_unregistered(>unregistered, gb, 
size);
 case HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
 return decode_nal_sei_alternative_transfer(>alternative_transfer, 
gb);
 default:
@@ -365,4 +394,9 @@ void ff_hevc_reset_sei(HEVCSEI *s)
 {
 s->a53_caption.a53_caption_size = 0;
 av_freep(>a53_caption.a53_caption);
+
+for (int i = 0; i < s->unregistered.nb_buf_ref; i++)
+av_buffer_unref(>unregistered.buf_ref[i]);
+s->unregistered.nb_buf_ref = 0;
+av_freep(>unregistered.buf_ref);
 }
diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
index f6516ae982..2464117d47 100644
--- a/libavcodec/hevc_sei.h
+++ b/libavcodec/hevc_sei.h
@@ -87,6 +87,11 @@ typedef struct HEVCSEIA53Caption {
 uint8_t *a53_caption;
 } HEVCSEIA53Caption;
 
+typedef struct HEVCSEIUnregistered {
+AVBufferRef **buf_ref;
+int nb_buf_ref;
+} HEVCSEIUnregistered;
+
 typedef struct HEVCSEIMasteringDisplay {
 int present;
 uint16_t display_primaries[3][2];
@@ -112,6 +117,7 @@ typedef struct HEVCSEI {
 HEVCSEIDisplayOrientation display_orientation;
 HEVCSEIPictureTiming picture_timing;
 HEVCSEIA53Caption a53_caption;
+HEVCSEIUnregistered unregistered;
 HEVCSEIMasteringDisplay mastering_display;
 HEVCSEIContentLight content_light;
 int active_seq_parameter_set_id;
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 8f1c162ace..a4981e983c 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2789,6 +2789,24 @@ static int set_side_data(HEVCContext *s)
 s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 }
 
+for (int i = 0; i < s->sei.unregistered.nb_buf_ref; i++) {
+HEVCSEIUnregistered *unreg = >sei.unregistered;
+
+if (unreg->buf_ref[i]) {
+AVFrameSideData *sd = av_frame_new_side_data_from_buf(out,
+AV_FRAME_DATA_USER_DATA_UNREGISTERED,
+unreg->buf_ref[i]);
+if (!sd)
+av_buffer_unref(>buf_ref[i]);
+unreg->buf_ref[i] = NULL;
+}
+}
+
+if (s->sei.unregistered.nb_buf_ref > 0) {
+s->sei.unregistered.nb_buf_ref = 0;
+av_freep(>sei.unregistered.buf_ref);
+}
+
 return 0;
 }
 
diff --git a/tests/ref/fate/hevc-monochrome-crop 
b/tests/ref/fate/hevc-monochrome-crop
index 4e45412acf..43f0abbcfa 100644
--- a/tests/ref/fate/hevc-monochrome-crop
+++ b/tests/ref/fate/hevc-monochrome-crop
@@ -1,6 +1,9 @@
 [FRAME]
 width=384
 height=240
+[SIDE_DATA]
+side_data_type=User Data Unregistered
+[/SIDE_DATA]
 [/FRAME]
 [STREAM]
 width=384
-- 
2.21.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v3 1/5] avutil: add AV_FRAME_DATA_USER_DATA_UNREGISTERED side data type

2019-12-18 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 doc/APIchanges  | 3 +++
 libavutil/frame.c   | 1 +
 libavutil/frame.h   | 8 
 libavutil/version.h | 2 +-
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 401c65a753..7955dfa659 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2019-12-17 - xx - lavu 56.37.101 - frame.h
+  Add AV_FRAME_DATA_USER_DATA_UNREGISTERED.
+
 2019-11-17 - 1c23abc88f - lavu 56.36.100 - eval API
   Add av_expr_count_vars().
 
diff --git a/libavutil/frame.c b/libavutil/frame.c
index e4038096c2..1d0faec687 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -842,6 +842,7 @@ const char *av_frame_side_data_name(enum 
AVFrameSideDataType type)
 #endif
 case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata 
SMPTE2094-40 (HDR10+)";
 case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
+case AV_FRAME_DATA_USER_DATA_UNREGISTERED: return "User Data Unregistered";
 }
 return NULL;
 }
diff --git a/libavutil/frame.h b/libavutil/frame.h
index b5afb58634..9e8c3a9009 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -179,6 +179,14 @@ enum AVFrameSideDataType {
  * array element is implied by AVFrameSideData.size / 
AVRegionOfInterest.self_size.
  */
 AV_FRAME_DATA_REGIONS_OF_INTEREST,
+
+/**
+ * User data unregistered metadata associated with a video frame.
+ * This data payload is stored as uint8_t in AVFrameSideData.data.
+ * The number of bytes of data payload is AVFrameSideData.size.
+ * The data payload consists of 16 bytes UUID and real user data.
+ */
+AV_FRAME_DATA_USER_DATA_UNREGISTERED,
 };
 
 enum AVActiveFormatDescription {
diff --git a/libavutil/version.h b/libavutil/version.h
index e18163388d..f45e74fb95 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  56
-#define LIBAVUTIL_VERSION_MINOR  36
+#define LIBAVUTIL_VERSION_MINOR  37
 #define LIBAVUTIL_VERSION_MICRO 101
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
2.21.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH V4 2/2] libswscale/x86/yuv2rgb: add ssse3 version

2019-12-18 Thread Ting Fu
Tested using this command:
/ffmpeg -pix_fmt yuv420p -s 1920*1080 -i ArashRawYuv420.yuv \
-vcodec rawvideo -s 1920*1080 -pix_fmt rgb24 -f null /dev/null

The fps increase from 389 to 640 on my local machine.

Signed-off-by: Ting Fu 
---
 libswscale/x86/yuv2rgb.c  |   8 +-
 libswscale/x86/yuv2rgb_template.c |  58 +++-
 libswscale/x86/yuv_2_rgb.asm  | 145 ++
 3 files changed, 192 insertions(+), 19 deletions(-)

diff --git a/libswscale/x86/yuv2rgb.c b/libswscale/x86/yuv2rgb.c
index ed9b613cab..b83dd7089a 100644
--- a/libswscale/x86/yuv2rgb.c
+++ b/libswscale/x86/yuv2rgb.c
@@ -61,13 +61,19 @@ DECLARE_ASM_CONST(8, uint64_t, pb_07) = 
0x0707070707070707ULL;
 #define COMPILE_TEMPLATE_MMXEXT 1
 #endif /* HAVE_MMXEXT */
 
+//SSSE3 versions
+#if HAVE_SSSE3
+#define COMPILE_TEMPLATE_SSSE3 1
+#endif
+
 #include "yuv2rgb_template.c"
 
 av_cold SwsFunc ff_yuv2rgb_init_x86(SwsContext *c)
 {
 int cpu_flags = av_get_cpu_flags();
 
-if (EXTERNAL_MMX(cpu_flags) || EXTERNAL_MMXEXT(cpu_flags)) {
+if (EXTERNAL_MMX(cpu_flags) || EXTERNAL_MMXEXT(cpu_flags) ||
+EXTERNAL_SSSE3(cpu_flags)) {
 switch (c->dstFormat) {
 case AV_PIX_FMT_RGB32:
 if (c->srcFormat == AV_PIX_FMT_YUVA420P) {
diff --git a/libswscale/x86/yuv2rgb_template.c 
b/libswscale/x86/yuv2rgb_template.c
index bcc8eb7602..97a3645b90 100644
--- a/libswscale/x86/yuv2rgb_template.c
+++ b/libswscale/x86/yuv2rgb_template.c
@@ -40,6 +40,30 @@
 const uint8_t *pv = src[2] +   (y >> vshift) * srcStride[2]; \
 x86_reg index = -h_size / 2; \
 
+extern void ff_yuv_420_rgb24_ssse3(x86_reg index, uint8_t *image, const 
uint8_t *pu_index,
+   const uint8_t *pv_index, const uint64_t 
*pointer_c_dither,
+   const uint8_t *py_2index);
+extern void ff_yuv_420_bgr24_ssse3(x86_reg index, uint8_t *image, const 
uint8_t *pu_index,
+   const uint8_t *pv_index, const uint64_t 
*pointer_c_dither,
+   const uint8_t *py_2index);
+extern void ff_yuv_420_rgb15_ssse3(x86_reg index, uint8_t *image, const 
uint8_t *pu_index,
+   const uint8_t *pv_index, const uint64_t 
*pointer_c_dither,
+   const uint8_t *py_2index);
+extern void ff_yuv_420_rgb16_ssse3(x86_reg index, uint8_t *image, const 
uint8_t *pu_index,
+   const uint8_t *pv_index, const uint64_t 
*pointer_c_dither,
+   const uint8_t *py_2index);
+extern void ff_yuv_420_rgb32_ssse3(x86_reg index, uint8_t *image, const 
uint8_t *pu_index,
+   const uint8_t *pv_index, const uint64_t 
*pointer_c_dither,
+   const uint8_t *py_2index);
+extern void ff_yuv_420_bgr32_ssse3(x86_reg index, uint8_t *image, const 
uint8_t *pu_index,
+   const uint8_t *pv_index, const uint64_t 
*pointer_c_dither,
+   const uint8_t *py_2index);
+extern void ff_yuva_420_rgb32_ssse3(x86_reg index, uint8_t *image, const 
uint8_t *pu_index,
+const uint8_t *pv_index, const uint64_t 
*pointer_c_dither,
+const uint8_t *py_2index, const uint8_t 
*pa_2index);
+extern void ff_yuva_420_bgr32_ssse3(x86_reg index, uint8_t *image, const 
uint8_t *pu_index,
+const uint8_t *pv_index, const uint64_t 
*pointer_c_dither,
+const uint8_t *py_2index, const uint8_t 
*pa_2index);
 extern void ff_yuv_420_rgb24_mmxext(x86_reg index, uint8_t *image, const 
uint8_t *pu_index,
 const uint8_t *pv_index, const uint64_t 
*pointer_c_dither,
 const uint8_t *py_2index);
@@ -84,7 +108,12 @@ static inline int yuv420_rgb15(SwsContext *c, const uint8_t 
*src[],
 c->greenDither = ff_dither8[y   & 1];
 c->redDither   = ff_dither8[(y + 1) & 1];
 #endif
+
+#if COMPILE_TEMPLATE_SSSE3
+ff_yuv_420_rgb15_ssse3(index, image, pu - index, pv - index, 
&(c->redDither), py - 2 * index);
+#else
 ff_yuv_420_rgb15_mmx(index, image, pu - index, pv - index, 
&(c->redDither), py - 2 * index);
+#endif
 }
 return srcSliceH;
 }
@@ -102,7 +131,12 @@ static inline int yuv420_rgb16(SwsContext *c, const 
uint8_t *src[],
 c->greenDither = ff_dither4[y   & 1];
 c->redDither   = ff_dither8[(y + 1) & 1];
 #endif
+
+#if COMPILE_TEMPLATE_SSSE3
+ff_yuv_420_rgb16_ssse3(index, image, pu - index, pv - index, 
&(c->redDither), py - 2 * index);
+#else
 ff_yuv_420_rgb16_mmx(index, image, pu - index, pv - index, 
&(c->redDither), py - 2 * index);
+#endif
 }
 return srcSliceH;
 }
@@ -115,7 +149,9 @@ static inline int yuv420_rgb24(SwsContext *c, const uint8_t 
*src[],
 

[FFmpeg-devel] [PATCH V4 1/2] libswscale/x86/yuv2rgb: Change inline assembly into nasm code

2019-12-18 Thread Ting Fu
Tested using this command:
./ffmpeg -pix_fmt yuv420p -s 1920*1080 -i ArashRawYuv420.yuv \
-vcodec rawvideo -s 1920*1080 -pix_fmt rgb24 -f null /dev/null

The fps increase from 151 to 389 on my local machine.

Signed-off-by: Ting Fu 
---
 libswscale/x86/Makefile   |   1 +
 libswscale/x86/swscale.c  |  16 +-
 libswscale/x86/yuv2rgb.c  |  81 +++---
 libswscale/x86/yuv2rgb_template.c | 441 ++
 libswscale/x86/yuv_2_rgb.asm  | 270 ++
 5 files changed, 395 insertions(+), 414 deletions(-)
 create mode 100644 libswscale/x86/yuv_2_rgb.asm

diff --git a/libswscale/x86/Makefile b/libswscale/x86/Makefile
index f317d5dd9b..831d5359aa 100644
--- a/libswscale/x86/Makefile
+++ b/libswscale/x86/Makefile
@@ -12,3 +12,4 @@ X86ASM-OBJS += x86/input.o
  \
x86/output.o \
x86/scale.o  \
x86/rgb_2_rgb.o  \
+   x86/yuv_2_rgb.o  \
diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index 0eed4f18d5..e9d474a1e8 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -29,6 +29,14 @@
 #include "libavutil/cpu.h"
 #include "libavutil/pixdesc.h"
 
+const DECLARE_ALIGNED(8, uint64_t, ff_dither4)[2] = {
+0x0103010301030103LL,
+0x0200020002000200LL,};
+
+const DECLARE_ALIGNED(8, uint64_t, ff_dither8)[2] = {
+0x0602060206020602LL,
+0x0004000400040004LL,};
+
 #if HAVE_INLINE_ASM
 
 #define DITHER1XBPP
@@ -38,14 +46,6 @@ DECLARE_ASM_CONST(8, uint64_t, bFC)=   
0xFCFCFCFCFCFCFCFCLL;
 DECLARE_ASM_CONST(8, uint64_t, w10)=   0x0010001000100010LL;
 DECLARE_ASM_CONST(8, uint64_t, w02)=   0x0002000200020002LL;
 
-const DECLARE_ALIGNED(8, uint64_t, ff_dither4)[2] = {
-0x0103010301030103LL,
-0x0200020002000200LL,};
-
-const DECLARE_ALIGNED(8, uint64_t, ff_dither8)[2] = {
-0x0602060206020602LL,
-0x0004000400040004LL,};
-
 DECLARE_ASM_CONST(8, uint64_t, b16Mask)=   0x001F001F001F001FLL;
 DECLARE_ASM_CONST(8, uint64_t, g16Mask)=   0x07E007E007E007E0LL;
 DECLARE_ASM_CONST(8, uint64_t, r16Mask)=   0xF800F800F800F800LL;
diff --git a/libswscale/x86/yuv2rgb.c b/libswscale/x86/yuv2rgb.c
index 5e2f77c20f..ed9b613cab 100644
--- a/libswscale/x86/yuv2rgb.c
+++ b/libswscale/x86/yuv2rgb.c
@@ -37,7 +37,7 @@
 #include "libavutil/x86/cpu.h"
 #include "libavutil/cpu.h"
 
-#if HAVE_INLINE_ASM
+#if HAVE_X86ASM
 
 #define DITHER1XBPP // only for MMX
 
@@ -50,70 +50,51 @@ DECLARE_ASM_CONST(8, uint64_t, pb_03) = 
0x0303030303030303ULL;
 DECLARE_ASM_CONST(8, uint64_t, pb_07) = 0x0707070707070707ULL;
 
 //MMX versions
-#if HAVE_MMX_INLINE && HAVE_6REGS
-#undef RENAME
+#if HAVE_MMX
 #undef COMPILE_TEMPLATE_MMXEXT
 #define COMPILE_TEMPLATE_MMXEXT 0
-#define RENAME(a) a ## _mmx
-#include "yuv2rgb_template.c"
-#endif /* HAVE_MMX_INLINE && HAVE_6REGS */
+#endif /* HAVE_MMX */
 
 // MMXEXT versions
-#if HAVE_MMXEXT_INLINE && HAVE_6REGS
-#undef RENAME
+#if HAVE_MMXEXT
 #undef COMPILE_TEMPLATE_MMXEXT
 #define COMPILE_TEMPLATE_MMXEXT 1
-#define RENAME(a) a ## _mmxext
-#include "yuv2rgb_template.c"
-#endif /* HAVE_MMXEXT_INLINE && HAVE_6REGS */
+#endif /* HAVE_MMXEXT */
 
-#endif /* HAVE_INLINE_ASM */
+#include "yuv2rgb_template.c"
 
 av_cold SwsFunc ff_yuv2rgb_init_x86(SwsContext *c)
 {
-#if HAVE_MMX_INLINE && HAVE_6REGS
 int cpu_flags = av_get_cpu_flags();
 
-#if HAVE_MMXEXT_INLINE
-if (INLINE_MMXEXT(cpu_flags)) {
-switch (c->dstFormat) {
-case AV_PIX_FMT_RGB24:
-return yuv420_rgb24_mmxext;
-case AV_PIX_FMT_BGR24:
-return yuv420_bgr24_mmxext;
-}
-}
-#endif
-
-if (INLINE_MMX(cpu_flags)) {
+if (EXTERNAL_MMX(cpu_flags) || EXTERNAL_MMXEXT(cpu_flags)) {
 switch (c->dstFormat) {
-case AV_PIX_FMT_RGB32:
-if (c->srcFormat == AV_PIX_FMT_YUVA420P) {
-#if HAVE_7REGS && CONFIG_SWSCALE_ALPHA
-return yuva420_rgb32_mmx;
+case AV_PIX_FMT_RGB32:
+if (c->srcFormat == AV_PIX_FMT_YUVA420P) {
+#if CONFIG_SWSCALE_ALPHA
+return yuva420_rgb32;
 #endif
-break;
-} else
-return yuv420_rgb32_mmx;
-case AV_PIX_FMT_BGR32:
-if (c->srcFormat == AV_PIX_FMT_YUVA420P) {
-#if HAVE_7REGS && CONFIG_SWSCALE_ALPHA
-return yuva420_bgr32_mmx;
+break;
+} else
+return yuv420_rgb32;
+case AV_PIX_FMT_BGR32:
+if (c->srcFormat == AV_PIX_FMT_YUVA420P) {
+#if CONFIG_SWSCALE_ALPHA
+return yuva420_bgr32;
 #endif
-break;
-} else
-return yuv420_bgr32_mmx;
-case AV_PIX_FMT_RGB24:
-return 

Re: [FFmpeg-devel] [PATCH v2 3/5] avfilter/vf_showinfo: display user data unregistered message

2019-12-18 Thread Limin Wang
On Wed, Dec 18, 2019 at 12:47:49PM -0300, James Almer wrote:
> On 12/18/2019 8:06 AM, lance.lmw...@gmail.com wrote:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavfilter/vf_showinfo.c | 40 +++
> >  1 file changed, 40 insertions(+)
> > 
> > diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> > index 31f6b32aa4..77ee7f312c 100644
> > --- a/libavfilter/vf_showinfo.c
> > +++ b/libavfilter/vf_showinfo.c
> > @@ -169,6 +169,43 @@ static void 
> > dump_content_light_metadata(AVFilterContext *ctx, AVFrameSideData *s
> > metadata->MaxCLL, metadata->MaxFALL);
> >  }
> >  
> > +static int is_ascii(uint8_t ch)
> > +{
> > +if (ch >= 32 && ch <= 127)
> 
> Should be < 127, i think.
> 

yes, 127 is DEL control character

> > +return 1;
> > +else
> > +return 0;
> > +}
> > +
> > +static void dump_user_data_unregistered_metadata(AVFilterContext *ctx, 
> > AVFrameSideData *sd)
> > +{
> > +const int uuid_size = 16;
> > +uint8_t *user_data = sd->data;
> > +
> > +if (sd->size < uuid_size) {
> > +av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))", 
> > sd->size, uuid_size);
> > +return;
> > +}
> > +
> > +av_log(ctx, AV_LOG_INFO, "User Data Unregistered:\n");
> > +av_log(ctx, AV_LOG_INFO, "UUID=");
> > +for (int i = 0; i < uuid_size; i++)
> > +av_log(ctx, AV_LOG_INFO, "%x", user_data[i]);
> > +av_log(ctx, AV_LOG_INFO, "\n");
> > +av_log(ctx, AV_LOG_INFO, "User Data=");
> > +for (int i = uuid_size; i < sd->size; i++) {
> > +/* printable ascii */
> > +if (is_ascii(*(user_data + i))) {
> 
> user_data[i]

yes, it's more simple

> > +av_log(ctx, AV_LOG_INFO, "%c", *(user_data + i));
> 
> Ditto.
> 
> > +} else {
> > +/* don't print the last byte `\0` character for ascii */
> > +if ((i == sd->size - 1) && *(user_data + i) == 0)
> 
> Ditto.
> 
> > +continue;
> > +av_log(ctx, AV_LOG_INFO, "%x", *(user_data + i));
> 
> Ditto.
> 
> Also, maybe print 0x%02x instead.

sure.

> 
> > +}
> > +}
> 
> What if it's binary data where a few of the bytes are in the printable
> range? It might be worth checking if the entire buffer is printable and
> then choosing between using %s or %x for the whole thing.

I prefer to print the data, for most of user data is string, so it'll
helpful for user to dump the info. I'll add a function a check the entire buffer
first like below function:

 static int string_is_ascii(const uint8_t *str)
 {
 while (*str && *str < 128) str++;
 return !*str;
 }


> 
> Or maybe just not print anything at all. We're not doing it for closed
> captions frame side data after all.
> 
> > +}
> > +
> >  static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
> >  {
> >  const char *color_range_str = 
> > av_color_range_name(frame->color_range);
> > @@ -319,6 +356,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> > *frame)
> >  av_log(ctx, AV_LOG_INFO, "GOP timecode - %s", tcbuf);
> >  break;
> >  }
> > +case AV_FRAME_DATA_USER_DATA_UNREGISTERED:
> > +dump_user_data_unregistered_metadata(ctx, sd);
> > +break;
> >  default:
> >  av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d 
> > bytes)",
> > sd->type, sd->size);
> > 
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v1 3/5] avfilter/vf_showinfo: display user data unregistered message

2019-12-18 Thread Limin Wang
On Wed, Dec 18, 2019 at 11:22:05PM +0100, Michael Niedermayer wrote:
> On Wed, Dec 18, 2019 at 08:55:04AM +0800, Limin Wang wrote:
> > On Tue, Dec 17, 2019 at 10:22:47PM +0100, Michael Niedermayer wrote:
> > > On Tue, Dec 17, 2019 at 06:22:15PM +0800, lance.lmw...@gmail.com wrote:
> > > > From: Limin Wang 
> > > > 
> > > > Signed-off-by: Limin Wang 
> > > > ---
> > > >  libavfilter/vf_showinfo.c | 20 
> > > >  1 file changed, 20 insertions(+)
> > > > 
> > > > diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> > > > index 31f6b32aa4..0d227983c2 100644
> > > > --- a/libavfilter/vf_showinfo.c
> > > > +++ b/libavfilter/vf_showinfo.c
> > > > @@ -169,6 +169,23 @@ static void 
> > > > dump_content_light_metadata(AVFilterContext *ctx, AVFrameSideData *s
> > > > metadata->MaxCLL, metadata->MaxFALL);
> > > >  }
> > > >  
> > > > +static void dump_user_data_unregistered_metadata(AVFilterContext *ctx, 
> > > > AVFrameSideData *sd)
> > > > +{
> > > > +const int uuid_size = 16;
> > > > +
> > > > +if (sd->size < uuid_size) {
> > > > +av_log(ctx, AV_LOG_ERROR, "invalid data");
> > > > +return;
> > > > +}
> > > 
> > > The need for a UUID (of 16bytes) is not described in the text describing 
> > > this side data type
> > By the specs:
> > user_data_unregistered( payloadSize ) { C Descriptor
> > uuid_iso_iec_11578  5 u(128)
> > for( i = 16; i < payloadSize; i++ )
> > user_data_payload_byte  5 b(8)
> > }
> 
> ive been inprecise
> what i have meant was this:
> @@ -179,6 +179,13 @@ enum AVFrameSideDataType {
>   * array element is implied by AVFrameSideData.size / 
> AVRegionOfInterest.self_size.
>   */  
>   
>  AV_FRAME_DATA_REGIONS_OF_INTEREST,
> +
> +/**
> + * User data unregistered metadata associated with a video frame.
> + * This user data payload is stored as uint8_t in AVFrameSideData.data.
> + * The number of bytes of user data is AVFrameSideData.size.

Got it, I'll add the one more line description for the need for the UUID.
* The user data consists of 16 bytes UUID and the other parts are 
* real user data .

> + */
> +AV_FRAME_DATA_USER_DATA_UNREGISTERED,
>  };
> 
>  enum AVActiveFormatDescription {
> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Rewriting code that is poorly written but fully understood is good.
> Rewriting code that one doesnt understand is a sign that one is less smart
> then the original author, trying to rewrite it will not make it better.



> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2 2/5] avcodec/hevc_sei: add support for user data unregistered SEI message

2019-12-18 Thread Limin Wang
On Wed, Dec 18, 2019 at 12:54:26PM -0300, James Almer wrote:
> On 12/18/2019 8:06 AM, lance.lmw...@gmail.com wrote:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavcodec/hevc_sei.c   | 22 ++
> >  libavcodec/hevc_sei.h   |  5 +
> >  libavcodec/hevcdec.c| 10 ++
> >  tests/ref/fate/hevc-monochrome-crop |  3 +++
> >  4 files changed, 40 insertions(+)
> > 
> > diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
> > index c59bd4321e..55d67c8e15 100644
> > --- a/libavcodec/hevc_sei.c
> > +++ b/libavcodec/hevc_sei.c
> > @@ -206,6 +206,24 @@ static int 
> > decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB
> >  return 0;
> >  }
> >  
> > +static int decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, 
> > GetBitContext *gb,
> > +  int size)
> > +{
> > +int i;
> > +
> > +if (size < 16)
> > +   return AVERROR(EINVAL);
> > +
> > +s->buf_ref = av_buffer_alloc(size);
> 
> Can there be more than one of these SEI messages per frame? I think we
> can export more than one frame side data of the same type, so this code
> should consider that scenario.

Yes, it's possible. I'll study how to it.

> 
> > +if (!s->buf_ref)
> > +return AVERROR(ENOMEM);
> > +
> > +for (i = 0; i < size; i++)
> > +s->buf_ref->data[i] = get_bits(gb, 8);
> > +
> > +return 0;
> > +}
> > +
> >  static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, 
> > GetBitContext *gb,
> >   int size)
> >  {
> > @@ -293,6 +311,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, 
> > void *logctx, HEVCSEI *s,
> >  return decode_nal_sei_active_parameter_sets(s, gb, logctx);
> >  case HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
> >  return decode_nal_sei_user_data_registered_itu_t_t35(s, gb, size);
> > +case HEVC_SEI_TYPE_USER_DATA_UNREGISTERED:
> > +return decode_nal_sei_user_data_unregistered(>unregistered, gb, 
> > size);
> >  case HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
> >  return 
> > decode_nal_sei_alternative_transfer(>alternative_transfer, gb);
> >  default:
> > @@ -365,4 +385,6 @@ void ff_hevc_reset_sei(HEVCSEI *s)
> >  {
> >  s->a53_caption.a53_caption_size = 0;
> >  av_freep(>a53_caption.a53_caption);
> > +
> > +av_buffer_unref(>unregistered.buf_ref);
> >  }
> > diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
> > index f6516ae982..a557ee7ab7 100644
> > --- a/libavcodec/hevc_sei.h
> > +++ b/libavcodec/hevc_sei.h
> > @@ -87,6 +87,10 @@ typedef struct HEVCSEIA53Caption {
> >  uint8_t *a53_caption;
> >  } HEVCSEIA53Caption;
> >  
> > +typedef struct HEVCSEIUnregistered {
> > +AVBufferRef *buf_ref;
> > +} HEVCSEIUnregistered;
> > +
> >  typedef struct HEVCSEIMasteringDisplay {
> >  int present;
> >  uint16_t display_primaries[3][2];
> > @@ -112,6 +116,7 @@ typedef struct HEVCSEI {
> >  HEVCSEIDisplayOrientation display_orientation;
> >  HEVCSEIPictureTiming picture_timing;
> >  HEVCSEIA53Caption a53_caption;
> > +HEVCSEIUnregistered unregistered;
> >  HEVCSEIMasteringDisplay mastering_display;
> >  HEVCSEIContentLight content_light;
> >  int active_seq_parameter_set_id;
> > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> > index 8f1c162ace..b1c7af090e 100644
> > --- a/libavcodec/hevcdec.c
> > +++ b/libavcodec/hevcdec.c
> > @@ -2789,6 +2789,16 @@ static int set_side_data(HEVCContext *s)
> >  s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
> >  }
> >  
> > +if (s->sei.unregistered.buf_ref) {
> > +HEVCSEIUnregistered *unreg = >sei.unregistered;
> > +
> > +AVFrameSideData *sd = av_frame_new_side_data_from_buf(out, 
> > AV_FRAME_DATA_USER_DATA_UNREGISTERED,
> > +unreg->buf_ref);
> > +if (!sd)
> > +av_buffer_unref(>buf_ref);
> > +unreg->buf_ref = NULL;
> > +}
> > +
> >  return 0;
> >  }
> >  
> > diff --git a/tests/ref/fate/hevc-monochrome-crop 
> > b/tests/ref/fate/hevc-monochrome-crop
> > index 4e45412acf..43f0abbcfa 100644
> > --- a/tests/ref/fate/hevc-monochrome-crop
> > +++ b/tests/ref/fate/hevc-monochrome-crop
> > @@ -1,6 +1,9 @@
> >  [FRAME]
> >  width=384
> >  height=240
> > +[SIDE_DATA]
> > +side_data_type=User Data Unregistered
> > +[/SIDE_DATA]
> >  [/FRAME]
> >  [STREAM]
> >  width=384
> > 
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, 

Re: [FFmpeg-devel] [PATCH v2 2/2] avcodec/libvpxenc: add a way to explicitly set temporal layer id

2019-12-18 Thread Wonkap Jang
Hi Michael,

On Wed, Dec 18, 2019 at 2:59 PM Michael Niedermayer 
wrote:

> On Tue, Dec 17, 2019 at 02:42:21PM -0800, Wonkap Jang wrote:
> > In order for rate control to correctly allocate bitrate to each temporal
> > layer, correct temporal layer id has to be set to each frame. This
> > commit provides the ability to set correct temporal layer id for each
> > frame.
> > ---
> >  libavcodec/libvpxenc.c | 11 ++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
>
> these 2 patches together fail to build
>
> CC  libavcodec/libvpxenc.o
> libavcodec/libvpxenc.c: In function ‘vpx_encode’:
> libavcodec/libvpxenc.c:1541:25: error: ‘vpx_svc_layer_id_t’ has no member
> named ‘temporal_layer_id_per_spatial’
>  layer_id.temporal_layer_id_per_spatial[0] =
> layer_id.temporal_layer_id;
>  ^
> libavcodec/libvpxenc.c:1572:17: error: ‘vpx_svc_layer_id_t’ has no member
> named ‘temporal_layer_id_per_spatial’
>  layer_id.temporal_layer_id_per_spatial[0] =
> layer_id.temporal_layer_id;
>  ^
> make: *** [libavcodec/libvpxenc.o] Error 1
>
> Looks like I missed guarding it with version number. I'll make the change.

Thanks,

Wonkap


> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Freedom in capitalist society always remains about the same as it was in
> ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] Add a commandline option to control loop restoration for libaom

2019-12-18 Thread Wang Cao
Signed-off-by: Wang Cao 
---
 libavcodec/libaomenc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index e06697c1bf..41a250302d 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -92,6 +92,7 @@ typedef struct AOMEncoderContext {
 int enable_cdef;
 int enable_global_motion;
 int enable_intrabc;
+int enable_restoration;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -110,6 +111,7 @@ static const char *const ctlidstr[] = {
 [AV1E_SET_SUPERBLOCK_SIZE]  = "AV1E_SET_SUPERBLOCK_SIZE",
 [AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS",
 [AV1E_SET_TILE_ROWS]= "AV1E_SET_TILE_ROWS",
+[AV1E_SET_ENABLE_RESTORATION] = "AV1E_SET_ENABLE_RESTORATION",
 #ifdef AOM_CTRL_AV1E_SET_ROW_MT
 [AV1E_SET_ROW_MT]   = "AV1E_SET_ROW_MT",
 #endif
@@ -688,6 +690,9 @@ static av_cold int aom_init(AVCodecContext *avctx,
 codecctl_int(avctx, AOME_SET_ARNR_STRENGTH,ctx->arnr_strength);
 if (ctx->enable_cdef >= 0)
 codecctl_int(avctx, AV1E_SET_ENABLE_CDEF, ctx->enable_cdef);
+if (ctx->enable_restoration >= 0)
+  codecctl_int(avctx, AV1E_SET_ENABLE_RESTORATION, 
ctx->enable_restoration);
+
 codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
 if (ctx->crf >= 0)
 codecctl_int(avctx, AOME_SET_CQ_LEVEL,  ctx->crf);
@@ -1084,6 +1089,7 @@ static const AVOption options[] = {
 { "enable-cdef",  "Enable CDEF filtering", 
OFFSET(enable_cdef),AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
 { "enable-global-motion",  "Enable global motion", 
OFFSET(enable_global_motion), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
 { "enable-intrabc",  "Enable intra block copy prediction mode", 
OFFSET(enable_intrabc), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
+{ "enable-restoration",  "Enable Loop Restoration filtering",  
   OFFSET(enable_restoration),AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
 { NULL },
 };
 
-- 
2.24.1.735.g03f4e72817-goog

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] doc/encoders: add VP9 temporal scalability encoding option

2019-12-18 Thread Wonkap Jang
Will do.

Thanks!

Wonkap

On Wed, Dec 18, 2019 at 1:37 PM James Zern 
wrote:

> Hi,
>
> On Wed, Dec 18, 2019 at 10:16 AM Wonkap Jang  wrote:
> >
> > Hi James,
> >
> > Some of the changes are on lines right next to each other, and will cause
> > conflict... I could make it a separate commit...
> > Would that work?
> > So, I would make docs into two separate commits and the code already has
> > two commits... so overall 4 commits in succession.
> >
>
> The doc fix should land quickly, so the other could be rebased after that.
>
> > Would this work?
> >
> > Thank you,
> >
> > Wonkap
> >
> >
> > On Tue, Dec 17, 2019 at 5:59 PM James Zern <
> jzern-at-google@ffmpeg.org>
> > wrote:
> >
> > > Hi,
> > >
> > > On Mon, Dec 16, 2019 at 2:21 PM Wonkap Jang
> > >  wrote:
> > > >
> > > > Documentation change for adding support for encoding
> > > > with temporal scalability in VP9.
> > > > ---
> > >
> > > This part sounds related to the other patches you're sending. The
> > > documentation can be added with the code change for vp9.
> > >
> > > >  doc/encoders.texi | 23 ++-
> > > >  1 file changed, 18 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > > > index 4ee518a124..7efc446a6c 100644
> > > > --- a/doc/encoders.texi
> > > > +++ b/doc/encoders.texi
> > > > [...]
> > > >  ffmpeg -i INPUT -c:v libvpx -ts-parameters ts_number_layers=3:\
> > > > -ts_target_bitrate=25,50,100:ts_rate_decimator=4,2,1:\
> > > > -ts_periodicity=4:ts_layer_id=0,2,1,2 OUTPUT
> > > > +ts_target_bitrate=250,500,1000:ts_rate_decimator=4,2,1:\
> > > > +ts_periodicity=4:ts_layer_id=0,2,1,2:ts_layering_mode=3 OUTPUT
> > > >  @end example
> > > >  Below is a brief explanation of each of the parameters, please
> > > >  refer to @code{struct vpx_codec_enc_cfg} in @code{vpx/vpx_encoder.h}
> > > for more
> > > > @@ -1903,13 +1901,28 @@ details.
> > > >  @item ts_number_layers
> > > >  Number of temporal coding layers.
> > > >  @item ts_target_bitrate
> > > > -Target bitrate for each temporal layer.
> > > > +Target bitrate for each temporal layer in kbps.
> > > > +(bitrate should be inclusive of the lower temporal layer).
> > >
> > > This portion is a bug fix for the existing docs (bps -> kbps). Can you
> > > split this out to its own patch?
> > > ___
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel@ffmpeg.org
> > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > >
> > > To unsubscribe, visit link above, or email
> > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2 2/2] avcodec/libvpxenc: add a way to explicitly set temporal layer id

2019-12-18 Thread Michael Niedermayer
On Tue, Dec 17, 2019 at 02:42:21PM -0800, Wonkap Jang wrote:
> In order for rate control to correctly allocate bitrate to each temporal
> layer, correct temporal layer id has to be set to each frame. This
> commit provides the ability to set correct temporal layer id for each
> frame.
> ---
>  libavcodec/libvpxenc.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)

these 2 patches together fail to build

CC  libavcodec/libvpxenc.o
libavcodec/libvpxenc.c: In function ‘vpx_encode’:
libavcodec/libvpxenc.c:1541:25: error: ‘vpx_svc_layer_id_t’ has no member named 
‘temporal_layer_id_per_spatial’
 layer_id.temporal_layer_id_per_spatial[0] = 
layer_id.temporal_layer_id;
 ^
libavcodec/libvpxenc.c:1572:17: error: ‘vpx_svc_layer_id_t’ has no member named 
‘temporal_layer_id_per_spatial’
 layer_id.temporal_layer_id_per_spatial[0] = layer_id.temporal_layer_id;
 ^
make: *** [libavcodec/libvpxenc.o] Error 1

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] web: add hosting provider

2019-12-18 Thread Michael Niedermayer
On Tue, Dec 17, 2019 at 03:58:36PM -0900, Lou Logan wrote:
> Hosting has been provided by telepoint.bg for 4 years now.
> This places an unobtrusive note placed in the footer to acknowledge
> their continuing support.
> 
> Signed-off-by: Lou Logan 
> ---
>  src/template_footer1 | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/template_footer1 b/src/template_footer1
> index 1d28d8a..e73a694 100644
> --- a/src/template_footer1
> +++ b/src/template_footer1
> @@ -1,4 +1,5 @@
>  
> +  Hosting provided by  href="https://telepoint.bg;>telepoint.bg
>   
> 
>   

this or something similar LGTM

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v1 3/5] avfilter/vf_showinfo: display user data unregistered message

2019-12-18 Thread Michael Niedermayer
On Wed, Dec 18, 2019 at 08:55:04AM +0800, Limin Wang wrote:
> On Tue, Dec 17, 2019 at 10:22:47PM +0100, Michael Niedermayer wrote:
> > On Tue, Dec 17, 2019 at 06:22:15PM +0800, lance.lmw...@gmail.com wrote:
> > > From: Limin Wang 
> > > 
> > > Signed-off-by: Limin Wang 
> > > ---
> > >  libavfilter/vf_showinfo.c | 20 
> > >  1 file changed, 20 insertions(+)
> > > 
> > > diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> > > index 31f6b32aa4..0d227983c2 100644
> > > --- a/libavfilter/vf_showinfo.c
> > > +++ b/libavfilter/vf_showinfo.c
> > > @@ -169,6 +169,23 @@ static void 
> > > dump_content_light_metadata(AVFilterContext *ctx, AVFrameSideData *s
> > > metadata->MaxCLL, metadata->MaxFALL);
> > >  }
> > >  
> > > +static void dump_user_data_unregistered_metadata(AVFilterContext *ctx, 
> > > AVFrameSideData *sd)
> > > +{
> > > +const int uuid_size = 16;
> > > +
> > > +if (sd->size < uuid_size) {
> > > +av_log(ctx, AV_LOG_ERROR, "invalid data");
> > > +return;
> > > +}
> > 
> > The need for a UUID (of 16bytes) is not described in the text describing 
> > this side data type
> By the specs:
> user_data_unregistered( payloadSize ) { C Descriptor
> uuid_iso_iec_11578  5 u(128)
> for( i = 16; i < payloadSize; i++ )
> user_data_payload_byte  5 b(8)
> }

ive been inprecise
what i have meant was this:
@@ -179,6 +179,13 @@ enum AVFrameSideDataType {
  * array element is implied by AVFrameSideData.size / 
AVRegionOfInterest.self_size.
  */

 AV_FRAME_DATA_REGIONS_OF_INTEREST,
+
+/**
+ * User data unregistered metadata associated with a video frame.
+ * This user data payload is stored as uint8_t in AVFrameSideData.data.
+ * The number of bytes of user data is AVFrameSideData.size.
+ */
+AV_FRAME_DATA_USER_DATA_UNREGISTERED,
 };

 enum AVActiveFormatDescription {

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] doc/encoders: correct the description for ts_target_bitrate

2019-12-18 Thread Wonkap Jang
Hi James,

I have updated the libvpx.
https://chromium-review.googlesource.com/c/webm/libvpx/+/1974899

Thank you,

Wonkap

On Wed, Dec 18, 2019 at 1:39 PM James Zern 
wrote:

> Hi,
>
> On Wed, Dec 18, 2019 at 1:17 PM Wonkap Jang
>  wrote:
> >
> > ts_target_bitrate is in kbps, not bps. This commit clarifies the unit
> > and modifies the example to match the description.
> > ---
> >  doc/encoders.texi | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
>
> lgtm if you can verify that with the libvpx implementation and update
> the docs [1].
>
> [1]
> https://chromium.googlesource.com/webm/libvpx/+/refs/heads/master/vpx/vpx_encoder.h#646
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] doc/encoders: correct the description for ts_target_bitrate

2019-12-18 Thread James Zern
Hi,

On Wed, Dec 18, 2019 at 1:17 PM Wonkap Jang
 wrote:
>
> ts_target_bitrate is in kbps, not bps. This commit clarifies the unit
> and modifies the example to match the description.
> ---
>  doc/encoders.texi | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>

lgtm if you can verify that with the libvpx implementation and update
the docs [1].

[1] 
https://chromium.googlesource.com/webm/libvpx/+/refs/heads/master/vpx/vpx_encoder.h#646
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] doc/encoders: add VP9 temporal scalability encoding option

2019-12-18 Thread James Zern
Hi,

On Wed, Dec 18, 2019 at 10:16 AM Wonkap Jang  wrote:
>
> Hi James,
>
> Some of the changes are on lines right next to each other, and will cause
> conflict... I could make it a separate commit...
> Would that work?
> So, I would make docs into two separate commits and the code already has
> two commits... so overall 4 commits in succession.
>

The doc fix should land quickly, so the other could be rebased after that.

> Would this work?
>
> Thank you,
>
> Wonkap
>
>
> On Tue, Dec 17, 2019 at 5:59 PM James Zern 
> wrote:
>
> > Hi,
> >
> > On Mon, Dec 16, 2019 at 2:21 PM Wonkap Jang
> >  wrote:
> > >
> > > Documentation change for adding support for encoding
> > > with temporal scalability in VP9.
> > > ---
> >
> > This part sounds related to the other patches you're sending. The
> > documentation can be added with the code change for vp9.
> >
> > >  doc/encoders.texi | 23 ++-
> > >  1 file changed, 18 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > > index 4ee518a124..7efc446a6c 100644
> > > --- a/doc/encoders.texi
> > > +++ b/doc/encoders.texi
> > > [...]
> > >  ffmpeg -i INPUT -c:v libvpx -ts-parameters ts_number_layers=3:\
> > > -ts_target_bitrate=25,50,100:ts_rate_decimator=4,2,1:\
> > > -ts_periodicity=4:ts_layer_id=0,2,1,2 OUTPUT
> > > +ts_target_bitrate=250,500,1000:ts_rate_decimator=4,2,1:\
> > > +ts_periodicity=4:ts_layer_id=0,2,1,2:ts_layering_mode=3 OUTPUT
> > >  @end example
> > >  Below is a brief explanation of each of the parameters, please
> > >  refer to @code{struct vpx_codec_enc_cfg} in @code{vpx/vpx_encoder.h}
> > for more
> > > @@ -1903,13 +1901,28 @@ details.
> > >  @item ts_number_layers
> > >  Number of temporal coding layers.
> > >  @item ts_target_bitrate
> > > -Target bitrate for each temporal layer.
> > > +Target bitrate for each temporal layer in kbps.
> > > +(bitrate should be inclusive of the lower temporal layer).
> >
> > This portion is a bug fix for the existing docs (bps -> kbps). Can you
> > split this out to its own patch?
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] doc/encoders: correct the description for ts_target_bitrate

2019-12-18 Thread Wonkap Jang
ts_target_bitrate is in kbps, not bps. This commit clarifies the unit
and modifies the example to match the description.
---
 doc/encoders.texi | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 4ee518a124..a207363650 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1893,7 +1893,7 @@ key=value pairs. For example, to specify temporal 
scalability parameters
 with @code{ffmpeg}:
 @example
 ffmpeg -i INPUT -c:v libvpx -ts-parameters ts_number_layers=3:\
-ts_target_bitrate=25,50,100:ts_rate_decimator=4,2,1:\
+ts_target_bitrate=250,500,1000:ts_rate_decimator=4,2,1:\
 ts_periodicity=4:ts_layer_id=0,2,1,2 OUTPUT
 @end example
 Below is a brief explanation of each of the parameters, please
@@ -1903,7 +1903,8 @@ details.
 @item ts_number_layers
 Number of temporal coding layers.
 @item ts_target_bitrate
-Target bitrate for each temporal layer.
+Target bitrate for each temporal layer (in kbps).
+(bitrate should be inclusive of the lower temporal layer).
 @item ts_rate_decimator
 Frame rate decimation factor for each temporal layer.
 @item ts_periodicity
-- 
2.24.1.735.g03f4e72817-goog

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] web: add hosting provider

2019-12-18 Thread Lou Logan
On Tue, 17 Dec 2019 15:58:36 -0900
Lou Logan  wrote:

> +  Hosting provided by  href="https://telepoint.bg;>telepoint.bg

Will switch position of p and small since p should not be a child
element of small.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] web: add hosting provider

2019-12-18 Thread Tomas Härdin
tis 2019-12-17 klockan 15:58 -0900 skrev Lou Logan:
> Hosting has been provided by telepoint.bg for 4 years now.
> This places an unobtrusive note placed in the footer to acknowledge
> their continuing support.
> 
> Signed-off-by: Lou Logan 
> ---
>  src/template_footer1 | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/template_footer1 b/src/template_footer1
> index 1d28d8a..e73a694 100644
> --- a/src/template_footer1
> +++ b/src/template_footer1
> @@ -1,4 +1,5 @@
>  
> +  Hosting provided by https://telepoint.bg;>telepoint.bg
>   
> 
>   

Cool, didn't know that. Approve!

/Tomas

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] doc/encoders: add VP9 temporal scalability encoding option

2019-12-18 Thread Wonkap Jang
Hi James,

Some of the changes are on lines right next to each other, and will cause
conflict... I could make it a separate commit...
Would that work?
So, I would make docs into two separate commits and the code already has
two commits... so overall 4 commits in succession.

Would this work?

Thank you,

Wonkap


On Tue, Dec 17, 2019 at 5:59 PM James Zern 
wrote:

> Hi,
>
> On Mon, Dec 16, 2019 at 2:21 PM Wonkap Jang
>  wrote:
> >
> > Documentation change for adding support for encoding
> > with temporal scalability in VP9.
> > ---
>
> This part sounds related to the other patches you're sending. The
> documentation can be added with the code change for vp9.
>
> >  doc/encoders.texi | 23 ++-
> >  1 file changed, 18 insertions(+), 5 deletions(-)
> >
> > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > index 4ee518a124..7efc446a6c 100644
> > --- a/doc/encoders.texi
> > +++ b/doc/encoders.texi
> > [...]
> >  ffmpeg -i INPUT -c:v libvpx -ts-parameters ts_number_layers=3:\
> > -ts_target_bitrate=25,50,100:ts_rate_decimator=4,2,1:\
> > -ts_periodicity=4:ts_layer_id=0,2,1,2 OUTPUT
> > +ts_target_bitrate=250,500,1000:ts_rate_decimator=4,2,1:\
> > +ts_periodicity=4:ts_layer_id=0,2,1,2:ts_layering_mode=3 OUTPUT
> >  @end example
> >  Below is a brief explanation of each of the parameters, please
> >  refer to @code{struct vpx_codec_enc_cfg} in @code{vpx/vpx_encoder.h}
> for more
> > @@ -1903,13 +1901,28 @@ details.
> >  @item ts_number_layers
> >  Number of temporal coding layers.
> >  @item ts_target_bitrate
> > -Target bitrate for each temporal layer.
> > +Target bitrate for each temporal layer in kbps.
> > +(bitrate should be inclusive of the lower temporal layer).
>
> This portion is a bug fix for the existing docs (bps -> kbps). Can you
> split this out to its own patch?
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/7] avformat/icecast: Free the right buffer on error

2019-12-18 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> In case an AVBPrint was not complete, icecast_open() would free some
> buffers that have not been allocated yet instead of freeing the data of
> the AVBPrint (if they have been allocated). Because this error does not
> trigger a jump to the general cleanup section any more, one can moreover
> remove a (now unnecessary) initialization of a pointer.
> 
> Furthermore, finalizing an AVBPrint can fail (namely when the string
> inside the AVBPrint has not been allocated yet) and so this needs to be
> checked.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/icecast.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/icecast.c b/libavformat/icecast.c
> index d2198b78ec..052cd37f3e 100644
> --- a/libavformat/icecast.c
> +++ b/libavformat/icecast.c
> @@ -89,7 +89,7 @@ static int icecast_open(URLContext *h, const char *uri, int 
> flags)
>  
>  // URI part variables
>  char h_url[1024], host[1024], auth[1024], path[1024];
> -char *headers = NULL, *user = NULL;
> +char *headers, *user = NULL;
>  int port, ret;
>  AVBPrint bp;
>  
> @@ -105,10 +105,11 @@ static int icecast_open(URLContext *h, const char *uri, 
> int flags)
>  cat_header(, "Ice-Genre", s->genre);
>  cat_header(, "Ice-Public", s->public ? "1" : "0");
>  if (!av_bprint_is_complete()) {
> -ret = AVERROR(ENOMEM);
> -goto cleanup;
> +av_bprint_finalize(, NULL);
> +return AVERROR(ENOMEM);
>  }
> -av_bprint_finalize(, );
> +if ((ret = av_bprint_finalize(, )) < 0)
> +return ret;
>  
>  // Set options
>  av_dict_set(_dict, "method", s->legacy_icecast ? "SOURCE" : "PUT", 
> 0);
> 
Ping.

- Andreas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2 2/5] avcodec/hevc_sei: add support for user data unregistered SEI message

2019-12-18 Thread James Almer
On 12/18/2019 8:06 AM, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavcodec/hevc_sei.c   | 22 ++
>  libavcodec/hevc_sei.h   |  5 +
>  libavcodec/hevcdec.c| 10 ++
>  tests/ref/fate/hevc-monochrome-crop |  3 +++
>  4 files changed, 40 insertions(+)
> 
> diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
> index c59bd4321e..55d67c8e15 100644
> --- a/libavcodec/hevc_sei.c
> +++ b/libavcodec/hevc_sei.c
> @@ -206,6 +206,24 @@ static int 
> decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB
>  return 0;
>  }
>  
> +static int decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, 
> GetBitContext *gb,
> +  int size)
> +{
> +int i;
> +
> +if (size < 16)
> +   return AVERROR(EINVAL);
> +
> +s->buf_ref = av_buffer_alloc(size);

Can there be more than one of these SEI messages per frame? I think we
can export more than one frame side data of the same type, so this code
should consider that scenario.

> +if (!s->buf_ref)
> +return AVERROR(ENOMEM);
> +
> +for (i = 0; i < size; i++)
> +s->buf_ref->data[i] = get_bits(gb, 8);
> +
> +return 0;
> +}
> +
>  static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, 
> GetBitContext *gb,
>   int size)
>  {
> @@ -293,6 +311,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, void 
> *logctx, HEVCSEI *s,
>  return decode_nal_sei_active_parameter_sets(s, gb, logctx);
>  case HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
>  return decode_nal_sei_user_data_registered_itu_t_t35(s, gb, size);
> +case HEVC_SEI_TYPE_USER_DATA_UNREGISTERED:
> +return decode_nal_sei_user_data_unregistered(>unregistered, gb, 
> size);
>  case HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
>  return decode_nal_sei_alternative_transfer(>alternative_transfer, 
> gb);
>  default:
> @@ -365,4 +385,6 @@ void ff_hevc_reset_sei(HEVCSEI *s)
>  {
>  s->a53_caption.a53_caption_size = 0;
>  av_freep(>a53_caption.a53_caption);
> +
> +av_buffer_unref(>unregistered.buf_ref);
>  }
> diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
> index f6516ae982..a557ee7ab7 100644
> --- a/libavcodec/hevc_sei.h
> +++ b/libavcodec/hevc_sei.h
> @@ -87,6 +87,10 @@ typedef struct HEVCSEIA53Caption {
>  uint8_t *a53_caption;
>  } HEVCSEIA53Caption;
>  
> +typedef struct HEVCSEIUnregistered {
> +AVBufferRef *buf_ref;
> +} HEVCSEIUnregistered;
> +
>  typedef struct HEVCSEIMasteringDisplay {
>  int present;
>  uint16_t display_primaries[3][2];
> @@ -112,6 +116,7 @@ typedef struct HEVCSEI {
>  HEVCSEIDisplayOrientation display_orientation;
>  HEVCSEIPictureTiming picture_timing;
>  HEVCSEIA53Caption a53_caption;
> +HEVCSEIUnregistered unregistered;
>  HEVCSEIMasteringDisplay mastering_display;
>  HEVCSEIContentLight content_light;
>  int active_seq_parameter_set_id;
> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> index 8f1c162ace..b1c7af090e 100644
> --- a/libavcodec/hevcdec.c
> +++ b/libavcodec/hevcdec.c
> @@ -2789,6 +2789,16 @@ static int set_side_data(HEVCContext *s)
>  s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
>  }
>  
> +if (s->sei.unregistered.buf_ref) {
> +HEVCSEIUnregistered *unreg = >sei.unregistered;
> +
> +AVFrameSideData *sd = av_frame_new_side_data_from_buf(out, 
> AV_FRAME_DATA_USER_DATA_UNREGISTERED,
> +unreg->buf_ref);
> +if (!sd)
> +av_buffer_unref(>buf_ref);
> +unreg->buf_ref = NULL;
> +}
> +
>  return 0;
>  }
>  
> diff --git a/tests/ref/fate/hevc-monochrome-crop 
> b/tests/ref/fate/hevc-monochrome-crop
> index 4e45412acf..43f0abbcfa 100644
> --- a/tests/ref/fate/hevc-monochrome-crop
> +++ b/tests/ref/fate/hevc-monochrome-crop
> @@ -1,6 +1,9 @@
>  [FRAME]
>  width=384
>  height=240
> +[SIDE_DATA]
> +side_data_type=User Data Unregistered
> +[/SIDE_DATA]
>  [/FRAME]
>  [STREAM]
>  width=384
> 

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2 3/5] avfilter/vf_showinfo: display user data unregistered message

2019-12-18 Thread James Almer
On 12/18/2019 8:06 AM, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/vf_showinfo.c | 40 +++
>  1 file changed, 40 insertions(+)
> 
> diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> index 31f6b32aa4..77ee7f312c 100644
> --- a/libavfilter/vf_showinfo.c
> +++ b/libavfilter/vf_showinfo.c
> @@ -169,6 +169,43 @@ static void dump_content_light_metadata(AVFilterContext 
> *ctx, AVFrameSideData *s
> metadata->MaxCLL, metadata->MaxFALL);
>  }
>  
> +static int is_ascii(uint8_t ch)
> +{
> +if (ch >= 32 && ch <= 127)

Should be < 127, i think.

> +return 1;
> +else
> +return 0;
> +}
> +
> +static void dump_user_data_unregistered_metadata(AVFilterContext *ctx, 
> AVFrameSideData *sd)
> +{
> +const int uuid_size = 16;
> +uint8_t *user_data = sd->data;
> +
> +if (sd->size < uuid_size) {
> +av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))", 
> sd->size, uuid_size);
> +return;
> +}
> +
> +av_log(ctx, AV_LOG_INFO, "User Data Unregistered:\n");
> +av_log(ctx, AV_LOG_INFO, "UUID=");
> +for (int i = 0; i < uuid_size; i++)
> +av_log(ctx, AV_LOG_INFO, "%x", user_data[i]);
> +av_log(ctx, AV_LOG_INFO, "\n");
> +av_log(ctx, AV_LOG_INFO, "User Data=");
> +for (int i = uuid_size; i < sd->size; i++) {
> +/* printable ascii */
> +if (is_ascii(*(user_data + i))) {

user_data[i]
> +av_log(ctx, AV_LOG_INFO, "%c", *(user_data + i));

Ditto.

> +} else {
> +/* don't print the last byte `\0` character for ascii */
> +if ((i == sd->size - 1) && *(user_data + i) == 0)

Ditto.

> +continue;
> +av_log(ctx, AV_LOG_INFO, "%x", *(user_data + i));

Ditto.

Also, maybe print 0x%02x instead.

> +}
> +}

What if it's binary data where a few of the bytes are in the printable
range? It might be worth checking if the entire buffer is printable and
then choosing between using %s or %x for the whole thing.

Or maybe just not print anything at all. We're not doing it for closed
captions frame side data after all.

> +}
> +
>  static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
>  {
>  const char *color_range_str = 
> av_color_range_name(frame->color_range);
> @@ -319,6 +356,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> *frame)
>  av_log(ctx, AV_LOG_INFO, "GOP timecode - %s", tcbuf);
>  break;
>  }
> +case AV_FRAME_DATA_USER_DATA_UNREGISTERED:
> +dump_user_data_unregistered_metadata(ctx, sd);
> +break;
>  default:
>  av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d 
> bytes)",
> sd->type, sd->size);
> 

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/3] ffprobe: Fix fate tests for ffprobe in cases where TARGET_PATH differs from the current path

2019-12-18 Thread Martin Storsjö

On Tue, 17 Dec 2019, James Almer wrote:


On 12/17/2019 6:27 PM, Martin Storsjö wrote:

On Sun, 15 Dec 2019, Martin Storsjö wrote:


On Tue, 10 Dec 2019, Martin Storsjö wrote:


In these cases, we must pass the full path of the file to ffprobe
(as the current working dir on the remote system, e.g. when invoked
with "ssh remote ffprobe ..." isn't the wanted one).

The input filename passed to ffprobe is also included in the output,
which is part of the reference test data. Add a new option to
ffprobe to allow overriding what path is printed, to keep the
original relative path in the tests.

An alternative approach could be an option to allow requesting omitting
the file name from the dumped data, and updating the test references
accordingly.
---
fftools/ffprobe.c  | 22 ++
tests/fate/ffprobe.mak |  2 +-
2 files changed, 19 insertions(+), 5 deletions(-)


Ping


If there's no opposition to this one, I'll push it tomorrow; it's been out
for review for over a week.

// Martin


Not against it, but there have been a couple new tests since you first
sent this, so better check they don't break, or require changes.


This change still works fine, and none of the new tests seem to require 
changes, at least not with respect to the aspects of this (and the other 
remaining one).


Thus pushed this one, and the checkasm one.

// Martin
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v1 5/5] avcodec/h264: create user data unregistered side data for H.264

2019-12-18 Thread Limin Wang
On Tue, Dec 17, 2019 at 09:49:28PM +0100, Michael Niedermayer wrote:
> On Tue, Dec 17, 2019 at 06:22:17PM +0800, lance.lmw...@gmail.com wrote:
> > From: Limin Wang 
> > 
> > Below is the sample message for -vf showinfo(need to apply the patchset):
> > [Parsed_showinfo_0 @ 0x7fac7b702080]   side data - User data unregistered:
> > [Parsed_showinfo_0 @ 0x7fac7b702080] UUID=186f369370304f2c603021492feee5b8
> > [Parsed_showinfo_0 @ 0x7fac7b702080] User Data=hello
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavcodec/h264_sei.c   |  5 -
> >  libavcodec/h264_sei.h   |  3 +++
> >  libavcodec/h264_slice.c | 11 +++
> >  3 files changed, 18 insertions(+), 1 deletion(-)
> 
> seems to break 
> make: *** [fate-mov-zombie] Error 1

Fixed and update the patch.

> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Concerning the gods, I have no means of knowing whether they exist or not
> or of what sort they may be, because of the obscurity of the subject, and
> the brevity of human life -- Protagoras



> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 5/5] avcodec/h264: create user data unregistered side data for H.264

2019-12-18 Thread lance . lmwang
From: Limin Wang 

Below is the sample message for -vf showinfo(need to apply the patchset):
[Parsed_showinfo_0 @ 0x7fac7b702080]   side data - User data unregistered:
[Parsed_showinfo_0 @ 0x7fac7b702080] UUID=186f369370304f2c603021492feee5b8
[Parsed_showinfo_0 @ 0x7fac7b702080] User Data=hello

Signed-off-by: Limin Wang 
---
 libavcodec/h264_sei.c |   9 +-
 libavcodec/h264_sei.h |   1 +
 libavcodec/h264_slice.c   |  10 ++
 tests/ref/fate/mov-zombie | 195 +-
 4 files changed, 145 insertions(+), 70 deletions(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index a565feabe2..87776bdc08 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -247,24 +247,23 @@ static int 
decode_unregistered_user_data(H264SEIUnregistered *h, GetBitContext *
 uint8_t *user_data;
 int e, build, i;
 
-if (size < 16 || size >= INT_MAX - 1)
+if (size < 16)
 return AVERROR_INVALIDDATA;
 
-user_data = av_malloc(size + 1);
-if (!user_data)
+h->buf_ref = av_buffer_alloc(size);
+if (!h->buf_ref)
 return AVERROR(ENOMEM);
+user_data = h->buf_ref->data;
 
 for (i = 0; i < size; i++)
 user_data[i] = get_bits(gb, 8);
 
-user_data[i] = 0;
 e = sscanf(user_data + 16, "x264 - core %d", );
 if (e == 1 && build > 0)
 h->x264_build = build;
 if (e == 1 && build == 1 && !strncmp(user_data+16, "x264 - core ", 16))
 h->x264_build = 67;
 
-av_free(user_data);
 return 0;
 }
 
diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
index a75c3aa175..f6de55f46f 100644
--- a/libavcodec/h264_sei.h
+++ b/libavcodec/h264_sei.h
@@ -121,6 +121,7 @@ typedef struct H264SEIA53Caption {
 
 typedef struct H264SEIUnregistered {
 int x264_build;
+AVBufferRef *buf_ref;
 } H264SEIUnregistered;
 
 typedef struct H264SEIRecoveryPoint {
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index e24d41ca50..914d3fddbb 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1285,6 +1285,16 @@ static int h264_export_frame_props(H264Context *h)
 h->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 }
 
+if (h->sei.unregistered.buf_ref) {
+H264SEIUnregistered *unreg = >sei.unregistered;
+
+AVFrameSideData *sd = av_frame_new_side_data_from_buf(cur->f, 
AV_FRAME_DATA_USER_DATA_UNREGISTERED,
+unreg->buf_ref);
+if (!sd)
+av_buffer_unref(>buf_ref);
+unreg->buf_ref = NULL;
+}
+
 if (h->sei.picture_timing.timecode_cnt > 0) {
 uint32_t tc = 0;
 uint32_t *tc_sd;
diff --git a/tests/ref/fate/mov-zombie b/tests/ref/fate/mov-zombie
index f45fa59637..0888295cfc 100644
--- a/tests/ref/fate/mov-zombie
+++ b/tests/ref/fate/mov-zombie
@@ -1,133 +1,198 @@
 
packet|codec_type=video|stream_index=0|pts=0|pts_time=0.00|dts=-3004|dts_time=-0.033378|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=4133|pos=11309|flags=K_
 
packet|codec_type=video|stream_index=0|pts=5440|pts_time=0.060444|dts=-567|dts_time=-0.006300|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1077|pos=15442|flags=__
-frame|media_type=video|stream_index=0|key_frame=1|pkt_pts=0|pkt_pts_time=0.00|pkt_dts=-567|pkt_dts_time=-0.006300|best_effort_timestamp=0|best_effort_timestamp_time=0.00|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=11309|pkt_size=4133|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=tv|color_space=smpte170m|color_primaries=smpte170m|color_transfer=bt709|chroma_location=topleft
+frame|media_type=video|stream_index=0|key_frame=1|pkt_pts=0|pkt_pts_time=0.00|pkt_dts=-567|pkt_dts_time=-0.006300|best_effort_timestamp=0|best_effort_timestamp_time=0.00|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=11309|pkt_size=4133|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=tv|color_space=smpte170m|color_primaries=smpte170m|color_transfer=bt709|chroma_location=topleftside_data|side_data_type=User
 Data Unregistered
+
 
packet|codec_type=video|stream_index=0|pts=2437|pts_time=0.027078|dts=2436|dts_time=0.027067|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=355|pos=16519|flags=__

[FFmpeg-devel] [PATCH v2 4/5] avcodec/h264_sei: fix the size of user data unregistered

2019-12-18 Thread lance . lmwang
From: Limin Wang 

According to the specifications, the payloadSize includes the 16-byte size of 
UUID.

Signed-off-by: Limin Wang 
---
 libavcodec/h264_sei.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index d4eb9c0dab..a565feabe2 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -247,14 +247,14 @@ static int 
decode_unregistered_user_data(H264SEIUnregistered *h, GetBitContext *
 uint8_t *user_data;
 int e, build, i;
 
-if (size < 16 || size >= INT_MAX - 16)
+if (size < 16 || size >= INT_MAX - 1)
 return AVERROR_INVALIDDATA;
 
-user_data = av_malloc(16 + size + 1);
+user_data = av_malloc(size + 1);
 if (!user_data)
 return AVERROR(ENOMEM);
 
-for (i = 0; i < size + 16; i++)
+for (i = 0; i < size; i++)
 user_data[i] = get_bits(gb, 8);
 
 user_data[i] = 0;
-- 
2.21.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 2/5] avcodec/hevc_sei: add support for user data unregistered SEI message

2019-12-18 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavcodec/hevc_sei.c   | 22 ++
 libavcodec/hevc_sei.h   |  5 +
 libavcodec/hevcdec.c| 10 ++
 tests/ref/fate/hevc-monochrome-crop |  3 +++
 4 files changed, 40 insertions(+)

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index c59bd4321e..55d67c8e15 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -206,6 +206,24 @@ static int 
decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB
 return 0;
 }
 
+static int decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, 
GetBitContext *gb,
+  int size)
+{
+int i;
+
+if (size < 16)
+   return AVERROR(EINVAL);
+
+s->buf_ref = av_buffer_alloc(size);
+if (!s->buf_ref)
+return AVERROR(ENOMEM);
+
+for (i = 0; i < size; i++)
+s->buf_ref->data[i] = get_bits(gb, 8);
+
+return 0;
+}
+
 static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, 
GetBitContext *gb,
  int size)
 {
@@ -293,6 +311,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, void 
*logctx, HEVCSEI *s,
 return decode_nal_sei_active_parameter_sets(s, gb, logctx);
 case HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
 return decode_nal_sei_user_data_registered_itu_t_t35(s, gb, size);
+case HEVC_SEI_TYPE_USER_DATA_UNREGISTERED:
+return decode_nal_sei_user_data_unregistered(>unregistered, gb, 
size);
 case HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
 return decode_nal_sei_alternative_transfer(>alternative_transfer, 
gb);
 default:
@@ -365,4 +385,6 @@ void ff_hevc_reset_sei(HEVCSEI *s)
 {
 s->a53_caption.a53_caption_size = 0;
 av_freep(>a53_caption.a53_caption);
+
+av_buffer_unref(>unregistered.buf_ref);
 }
diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
index f6516ae982..a557ee7ab7 100644
--- a/libavcodec/hevc_sei.h
+++ b/libavcodec/hevc_sei.h
@@ -87,6 +87,10 @@ typedef struct HEVCSEIA53Caption {
 uint8_t *a53_caption;
 } HEVCSEIA53Caption;
 
+typedef struct HEVCSEIUnregistered {
+AVBufferRef *buf_ref;
+} HEVCSEIUnregistered;
+
 typedef struct HEVCSEIMasteringDisplay {
 int present;
 uint16_t display_primaries[3][2];
@@ -112,6 +116,7 @@ typedef struct HEVCSEI {
 HEVCSEIDisplayOrientation display_orientation;
 HEVCSEIPictureTiming picture_timing;
 HEVCSEIA53Caption a53_caption;
+HEVCSEIUnregistered unregistered;
 HEVCSEIMasteringDisplay mastering_display;
 HEVCSEIContentLight content_light;
 int active_seq_parameter_set_id;
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 8f1c162ace..b1c7af090e 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2789,6 +2789,16 @@ static int set_side_data(HEVCContext *s)
 s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 }
 
+if (s->sei.unregistered.buf_ref) {
+HEVCSEIUnregistered *unreg = >sei.unregistered;
+
+AVFrameSideData *sd = av_frame_new_side_data_from_buf(out, 
AV_FRAME_DATA_USER_DATA_UNREGISTERED,
+unreg->buf_ref);
+if (!sd)
+av_buffer_unref(>buf_ref);
+unreg->buf_ref = NULL;
+}
+
 return 0;
 }
 
diff --git a/tests/ref/fate/hevc-monochrome-crop 
b/tests/ref/fate/hevc-monochrome-crop
index 4e45412acf..43f0abbcfa 100644
--- a/tests/ref/fate/hevc-monochrome-crop
+++ b/tests/ref/fate/hevc-monochrome-crop
@@ -1,6 +1,9 @@
 [FRAME]
 width=384
 height=240
+[SIDE_DATA]
+side_data_type=User Data Unregistered
+[/SIDE_DATA]
 [/FRAME]
 [STREAM]
 width=384
-- 
2.21.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 3/5] avfilter/vf_showinfo: display user data unregistered message

2019-12-18 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/vf_showinfo.c | 40 +++
 1 file changed, 40 insertions(+)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 31f6b32aa4..77ee7f312c 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -169,6 +169,43 @@ static void dump_content_light_metadata(AVFilterContext 
*ctx, AVFrameSideData *s
metadata->MaxCLL, metadata->MaxFALL);
 }
 
+static int is_ascii(uint8_t ch)
+{
+if (ch >= 32 && ch <= 127)
+return 1;
+else
+return 0;
+}
+
+static void dump_user_data_unregistered_metadata(AVFilterContext *ctx, 
AVFrameSideData *sd)
+{
+const int uuid_size = 16;
+uint8_t *user_data = sd->data;
+
+if (sd->size < uuid_size) {
+av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))", 
sd->size, uuid_size);
+return;
+}
+
+av_log(ctx, AV_LOG_INFO, "User Data Unregistered:\n");
+av_log(ctx, AV_LOG_INFO, "UUID=");
+for (int i = 0; i < uuid_size; i++)
+av_log(ctx, AV_LOG_INFO, "%x", user_data[i]);
+av_log(ctx, AV_LOG_INFO, "\n");
+av_log(ctx, AV_LOG_INFO, "User Data=");
+for (int i = uuid_size; i < sd->size; i++) {
+/* printable ascii */
+if (is_ascii(*(user_data + i))) {
+av_log(ctx, AV_LOG_INFO, "%c", *(user_data + i));
+} else {
+/* don't print the last byte `\0` character for ascii */
+if ((i == sd->size - 1) && *(user_data + i) == 0)
+continue;
+av_log(ctx, AV_LOG_INFO, "%x", *(user_data + i));
+}
+}
+}
+
 static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
 {
 const char *color_range_str = av_color_range_name(frame->color_range);
@@ -319,6 +356,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 av_log(ctx, AV_LOG_INFO, "GOP timecode - %s", tcbuf);
 break;
 }
+case AV_FRAME_DATA_USER_DATA_UNREGISTERED:
+dump_user_data_unregistered_metadata(ctx, sd);
+break;
 default:
 av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d bytes)",
sd->type, sd->size);
-- 
2.21.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 1/5] avutil: add AV_FRAME_DATA_USER_DATA_UNREGISTERED side data type

2019-12-18 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 doc/APIchanges  | 3 +++
 libavutil/frame.c   | 1 +
 libavutil/frame.h   | 7 +++
 libavutil/version.h | 2 +-
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 401c65a753..7955dfa659 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2019-12-17 - xx - lavu 56.37.101 - frame.h
+  Add AV_FRAME_DATA_USER_DATA_UNREGISTERED.
+
 2019-11-17 - 1c23abc88f - lavu 56.36.100 - eval API
   Add av_expr_count_vars().
 
diff --git a/libavutil/frame.c b/libavutil/frame.c
index e4038096c2..1d0faec687 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -842,6 +842,7 @@ const char *av_frame_side_data_name(enum 
AVFrameSideDataType type)
 #endif
 case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata 
SMPTE2094-40 (HDR10+)";
 case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
+case AV_FRAME_DATA_USER_DATA_UNREGISTERED: return "User Data Unregistered";
 }
 return NULL;
 }
diff --git a/libavutil/frame.h b/libavutil/frame.h
index b5afb58634..5a9b5d5c8a 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -179,6 +179,13 @@ enum AVFrameSideDataType {
  * array element is implied by AVFrameSideData.size / 
AVRegionOfInterest.self_size.
  */
 AV_FRAME_DATA_REGIONS_OF_INTEREST,
+
+/**
+ * User data unregistered metadata associated with a video frame.
+ * This user data payload is stored as uint8_t in AVFrameSideData.data.
+ * The number of bytes of user data is AVFrameSideData.size.
+ */
+AV_FRAME_DATA_USER_DATA_UNREGISTERED,
 };
 
 enum AVActiveFormatDescription {
diff --git a/libavutil/version.h b/libavutil/version.h
index e18163388d..f45e74fb95 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  56
-#define LIBAVUTIL_VERSION_MINOR  36
+#define LIBAVUTIL_VERSION_MINOR  37
 #define LIBAVUTIL_VERSION_MICRO 101
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
2.21.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".