Re: [FFmpeg-devel] [PATCH]lavc/libvpxenc: Improve documentation for cpu-used

2016-01-09 Thread Carl Eugen Hoyos
James Zern  google.com> writes:

> On Fri, Jan 8, 2016 at 1:58 AM, Carl Eugen Hoyos wrote:
> > Attached patch fixes ticket #5140 here

> lgtm. thanks.

Patch applied.

Thank you, Carl Eugen

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


[FFmpeg-devel] [RFC/PATCH]lavf/spdifenc: Support muxing eac3 as specified by smpte

2016-01-09 Thread Carl Eugen Hoyos
Hi!

A user has provided a "spdif" file that is incompatible with my hardware 
receiver but used together with SDI and MXF as specified by SMPTE (iiuc).
See "Ingest of SMPTE-377M" on the FFmpeg user mailing list.

Attached patch allows to write such files, I cannot test.

Please review, Carl Eugen
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index b4608a1..faba9de 100644
--- a/libavformat/spdifenc.c
+++ b/libavformat/spdifenc.c
@@ -80,6 +80,7 @@ typedef struct IEC61937Context {
 int dtshd_rate;
 int dtshd_fallback;
 #define SPDIF_FLAG_BIGENDIAN0x01
+#define SPDIF_FLAG_SMPTE0x02
 int spdif_flags;
 
 /// function, which generates codec dependent header information.
@@ -90,6 +91,7 @@ typedef struct IEC61937Context {
 static const AVOption options[] = {
 { "spdif_flags", "IEC 61937 encapsulation flags", offsetof(IEC61937Context, 
spdif_flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, 0, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM, "spdif_flags" },
 { "be", "output in big-endian format (for use as s16be)", 0, 
AV_OPT_TYPE_CONST, {.i64 = SPDIF_FLAG_BIGENDIAN},  0, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM, "spdif_flags" },
+{ "smpte", "use smpte specification instead of iec", 0, AV_OPT_TYPE_CONST, 
{.i64 = SPDIF_FLAG_SMPTE},  0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 
"spdif_flags" },
 { "dtshd_rate", "mux complete DTS frames in HD mode at the specified IEC958 
rate (in Hz, default 0=disabled)", offsetof(IEC61937Context, dtshd_rate), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 768000, AV_OPT_FLAG_ENCODING_PARAM },
 { "dtshd_fallback_time", "min secs to strip HD for after an overflow (-1: till 
the end, default 60)", offsetof(IEC61937Context, dtshd_fallback), 
AV_OPT_TYPE_INT, {.i64 = 60}, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
 { NULL },
@@ -132,11 +134,17 @@ static int spdif_header_eac3(AVFormatContext *s, AVPacket 
*pkt)
 ctx->pkt_offset = 0;
 return 0;
 }
+if (ctx->spdif_flags & SPDIF_FLAG_SMPTE) {
+ctx->data_type   = 16;
+ctx->length_code =
+ctx->pkt_offset  = 6144;
+} else {
 ctx->data_type   = IEC61937_EAC3;
 ctx->pkt_offset  = 24576;
+ctx->length_code = ctx->hd_buf_filled;
+}
 ctx->out_buf = ctx->hd_buf;
 ctx->out_bytes   = ctx->hd_buf_filled;
-ctx->length_code = ctx->hd_buf_filled;
 
 ctx->hd_buf_count  = 0;
 ctx->hd_buf_filled = 0;
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v4] lavf/matroskadec: Normalize noncompliant A_QUICKTIME/V_QUICKTIME private data

2016-01-09 Thread Mats Peterson

Minor simplification of get_qt_codec(). Description follows:

This patch adds a new static function get_qt_codec() that takes care of 
the initial retrieval of the fourcc and codec ID for A_QUICKTIME and 
V_QUICKTIME. It also normalizes noncompliant private data found in some 
older files that incorrectly starts with the fourcc by 
expanding/shifting the data by 4 bytes, and storing the data size at the 
start. This is necessary in order for the rest of the code in the 
A_QUICKTIME and V_QUICKTIME blocks (and most likely other code as well) 
to correctly parse the private data.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 9448cff9c5cdd1e301da8868c8e2e189ef34c760 Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Sat, 9 Jan 2016 11:59:18 +0100
Subject: [PATCH v4] lavf/matroskadec: Normalize noncompliant A_QUICKTIME/V_QUICKTIME private data

Minor simplification of get_qt_codec(). Description follows:

This patch adds a new static function get_qt_codec() that takes care of
the initial retrieval of the fourcc and codec ID for A_QUICKTIME and
V_QUICKTIME. It also normalizes noncompliant private data found in some
older files that incorrectly starts with the fourcc by expanding/shifting
the data by 4 bytes, and storing the data size at the start. This is
necessary in order for the rest of the code in the A_QUICKTIME and
V_QUICKTIME blocks (and most likely other code as well) to correctly
parse the private data.

Mats

---
 libavformat/matroskadec.c |   47 -
 1 file changed, 34 insertions(+), 13 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index be4e300..71bf5e5 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1708,6 +1708,32 @@ static void mkv_stereo_mode_display_mul(int stereo_mode, int *h_width, int *h_he
 }
 }
 
+static int get_qt_codec(MatroskaTrack *track, uint32_t *fourcc, enum AVCodecID *codec_id)
+{
+const AVCodecTag *codec_tags;
+
+codec_tags = track->type == MATROSKA_TRACK_TYPE_VIDEO ?
+ff_codec_movvideo_tags : ff_codec_movaudio_tags;
+
+/* Normalize noncompliant private data that starts with the fourcc
+ * by expanding/shifting the data by 4 bytes and storing the data
+ * size at the start. */
+if (ff_codec_get_id(codec_tags, AV_RL32(track->codec_priv.data))) {
+if (!(track->codec_priv.data = av_realloc(track->codec_priv.data,
+track->codec_priv.size + 4)))
+return AVERROR(ENOMEM);
+memmove(track->codec_priv.data + 4, track->codec_priv.data,
+track->codec_priv.size);
+track->codec_priv.size += 4;
+AV_WB32(track->codec_priv.data, track->codec_priv.size);
+}
+
+*fourcc = AV_RL32(track->codec_priv.data + 4);
+*codec_id = ff_codec_get_id(codec_tags, *fourcc);
+
+return 0;
+}
+
 static int matroska_parse_tracks(AVFormatContext *s)
 {
 MatroskaDemuxContext *matroska = s->priv_data;
@@ -1861,14 +1887,12 @@ static int matroska_parse_tracks(AVFormatContext *s)
 fourcc   = st->codec->codec_tag;
 extradata_offset = FFMIN(track->codec_priv.size, 18);
 } else if (!strcmp(track->codec_id, "A_QUICKTIME")
-   && (track->codec_priv.size >= 36)
+   /* Normally 36, but allow noncompliant private data */
+   && (track->codec_priv.size >= 32)
&& (track->codec_priv.data)) {
-fourcc = AV_RL32(track->codec_priv.data + 4);
-codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
-if (ff_codec_get_id(ff_codec_movaudio_tags, AV_RL32(track->codec_priv.data))) {
-fourcc = AV_RL32(track->codec_priv.data);
-codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
-}
+int ret = get_qt_codec(track, , _id);
+if (ret < 0)
+return ret;
 if (fourcc == 0) {
 if (track->audio.bitdepth == 8) {
 fourcc = MKTAG('r','a','w',' ');
@@ -1881,12 +1905,9 @@ static int matroska_parse_tracks(AVFormatContext *s)
 } else if (!strcmp(track->codec_id, "V_QUICKTIME") &&
(track->codec_priv.size >= 21)  &&
(track->codec_priv.data)) {
-fourcc   = AV_RL32(track->codec_priv.data + 4);
-codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc);
-if (ff_codec_get_id(ff_codec_movvideo_tags, AV_RL32(track->codec_priv.data))) {
-fourcc   = AV_RL32(track->codec_priv.data);
-codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc);
-}
+int ret = get_qt_codec(track, , _id);
+if (ret < 0)
+return ret;
 if (codec_id == AV_CODEC_ID_NONE && AV_RL32(track->codec_priv.data+4) == AV_RL32("SMI ")) {
 fourcc = 

[FFmpeg-devel] [PATCH 2/2] lavc/WIP: allow subtitle text format to be ASS without timing

2016-01-09 Thread Clément Bœsch
From: Clément Bœsch 

---
TODO
- ass_split needs to be able to handle dialog event without "Dialogue:
  ..." so our encoding chain can handle the sane decoded subtitles
- zvbi needs testing
- option sub_text_format needs to be documented and default ready to be
  changed
- doxy ff_ass_*
- minor or micro lavc bump
---
 libavcodec/ass.c | 96 
 libavcodec/ass.h | 58 +---
 libavcodec/assdec.c  | 25 +--
 libavcodec/assenc.c  |  9 +---
 libavcodec/avcodec.h |  4 ++
 libavcodec/ccaption_dec.c| 14 --
 libavcodec/jacosubdec.c  |  5 ++-
 libavcodec/libzvbi-teletextdec.c | 38 ++--
 libavcodec/microdvddec.c | 12 ++---
 libavcodec/movtextdec.c  | 19 
 libavcodec/mpl2dec.c |  8 ++--
 libavcodec/options_table.h   |  3 ++
 libavcodec/realtextdec.c |  7 +--
 libavcodec/samidec.c | 14 --
 libavcodec/srtdec.c  | 17 +++
 libavcodec/subviewerdec.c|  7 +--
 libavcodec/textdec.c | 19 +---
 libavcodec/utils.c   | 74 +++
 libavcodec/webvttdec.c   | 11 +++--
 19 files changed, 213 insertions(+), 227 deletions(-)

diff --git a/libavcodec/ass.c b/libavcodec/ass.c
index 336c308..71c7242 100644
--- a/libavcodec/ass.c
+++ b/libavcodec/ass.c
@@ -89,101 +89,41 @@ int ff_ass_subtitle_header_default(AVCodecContext *avctx)
ASS_DEFAULT_ALIGNMENT);
 }
 
-static void insert_ts(AVBPrint *buf, int ts)
+char *ff_ass_get_dialog(int readorder, int layer, const char *style,
+const char *speaker, const char *text)
 {
-if (ts == -1) {
-av_bprintf(buf, "9:59:59.99,");
-} else {
-int h, m, s;
-
-h = ts/36;  ts -= 36*h;
-m = ts/  6000;  ts -=   6000*m;
-s = ts/   100;  ts -=100*s;
-av_bprintf(buf, "%d:%02d:%02d.%02d,", h, m, s, ts);
-}
-}
-
-int ff_ass_bprint_dialog(AVBPrint *buf, const char *dialog,
- int ts_start, int duration, int raw)
-{
-int dlen;
-
-if (!raw || raw == 2) {
-long int layer = 0;
-
-if (raw == 2) {
-/* skip ReadOrder */
-dialog = strchr(dialog, ',');
-if (!dialog)
-return AVERROR_INVALIDDATA;
-dialog++;
-
-/* extract Layer or Marked */
-layer = strtol(dialog, (char**), 10);
-if (*dialog != ',')
-return AVERROR_INVALIDDATA;
-dialog++;
-}
-av_bprintf(buf, "Dialogue: %ld,", layer);
-insert_ts(buf, ts_start);
-insert_ts(buf, duration == -1 ? -1 : ts_start + duration);
-if (raw != 2)
-av_bprintf(buf, "Default,,0,0,0,,");
-}
-
-dlen = strcspn(dialog, "\n");
-dlen += dialog[dlen] == '\n';
-
-av_bprintf(buf, "%.*s", dlen, dialog);
-if (raw == 2)
-av_bprintf(buf, "\r\n");
-
-return dlen;
+return av_asprintf("%d,%d,%s,%s,0,0,0,,%s",
+   readorder, layer, style ? style : "Default",
+   speaker ? speaker : "", text);
 }
 
 int ff_ass_add_rect(AVSubtitle *sub, const char *dialog,
-int ts_start, int duration, int raw)
+int readorder, int layer, const char *style,
+const char *speaker)
 {
-AVBPrint buf;
-int ret, dlen;
+char *ass_str;
 AVSubtitleRect **rects;
 
-av_bprint_init(, 0, AV_BPRINT_SIZE_UNLIMITED);
-if ((ret = ff_ass_bprint_dialog(, dialog, ts_start, duration, raw)) < 
0)
-goto err;
-dlen = ret;
-if (!av_bprint_is_complete())
-goto errnomem;
-
 rects = av_realloc_array(sub->rects, (sub->num_rects+1), 
sizeof(*sub->rects));
 if (!rects)
-goto errnomem;
+return AVERROR(ENOMEM);
 sub->rects = rects;
-sub->end_display_time = FFMAX(sub->end_display_time, 10 * duration);
 rects[sub->num_rects]   = av_mallocz(sizeof(*rects[0]));
 if (!rects[sub->num_rects])
-goto errnomem;
+return AVERROR(ENOMEM);
 rects[sub->num_rects]->type = SUBTITLE_ASS;
-ret = av_bprint_finalize(, [sub->num_rects]->ass);
-if (ret < 0)
-goto err;
+ass_str = ff_ass_get_dialog(readorder, layer, style, speaker, dialog);
+if (!ass_str)
+return AVERROR(ENOMEM);
+rects[sub->num_rects]->ass = ass_str;
 sub->num_rects++;
-return dlen;
-
-errnomem:
-ret = AVERROR(ENOMEM);
-err:
-av_bprint_finalize(, NULL);
-return ret;
+return 0;
 }
 
-int ff_ass_add_rect_bprint(AVSubtitle *sub, AVBPrint *buf,
-   int ts_start, int duration)
+void ff_ass_decoder_flush(AVCodecContext *avctx)
 {
-av_bprintf(buf, "\r\n");
-if (!av_bprint_is_complete(buf))
-return 

[FFmpeg-devel] [PATCH 1/2] Kill timed SSA

2016-01-09 Thread Clément Bœsch
---
 libavcodec/Makefile  |  4 ++--
 libavcodec/assdec.c  | 60 +++-
 libavcodec/assenc.c  | 14 ++--
 libavformat/assenc.c | 14 
 libavformat/nut.c|  1 -
 5 files changed, 24 insertions(+), 69 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index b9ffdb9..2b56980 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -171,9 +171,9 @@ OBJS-$(CONFIG_ANSI_DECODER)+= ansi.o cga_data.o
 OBJS-$(CONFIG_APE_DECODER) += apedec.o
 OBJS-$(CONFIG_APNG_DECODER)+= png.o pngdec.o pngdsp.o
 OBJS-$(CONFIG_APNG_ENCODER)+= png.o pngenc.o
-OBJS-$(CONFIG_SSA_DECODER) += assdec.o ass.o ass_split.o
+OBJS-$(CONFIG_SSA_DECODER) += assdec.o ass.o
 OBJS-$(CONFIG_SSA_ENCODER) += assenc.o ass.o
-OBJS-$(CONFIG_ASS_DECODER) += assdec.o ass.o ass_split.o
+OBJS-$(CONFIG_ASS_DECODER) += assdec.o ass.o
 OBJS-$(CONFIG_ASS_ENCODER) += assenc.o ass.o
 OBJS-$(CONFIG_ASV1_DECODER)+= asvdec.o asv.o mpeg12data.o
 OBJS-$(CONFIG_ASV1_ENCODER)+= asvenc.o asv.o mpeg12data.o
diff --git a/libavcodec/assdec.c b/libavcodec/assdec.c
index 11dbde0..624052e 100644
--- a/libavcodec/assdec.c
+++ b/libavcodec/assdec.c
@@ -23,7 +23,6 @@
 
 #include "avcodec.h"
 #include "ass.h"
-#include "ass_split.h"
 #include "libavutil/internal.h"
 #include "libavutil/mem.h"
 
@@ -35,55 +34,9 @@ static av_cold int ass_decode_init(AVCodecContext *avctx)
 memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size);
 avctx->subtitle_header[avctx->extradata_size] = 0;
 avctx->subtitle_header_size = avctx->extradata_size;
-avctx->priv_data = ff_ass_split(avctx->extradata);
-if(!avctx->priv_data)
-return -1;
 return 0;
 }
 
-static int ass_decode_close(AVCodecContext *avctx)
-{
-ff_ass_split_free(avctx->priv_data);
-avctx->priv_data = NULL;
-return 0;
-}
-
-#if CONFIG_SSA_DECODER
-static int ssa_decode_frame(AVCodecContext *avctx, void *data, int 
*got_sub_ptr,
-AVPacket *avpkt)
-{
-const char *ptr = avpkt->data;
-int len, size = avpkt->size;
-
-while (size > 0) {
-int duration;
-ASSDialog *dialog = ff_ass_split_dialog(avctx->priv_data, ptr, 0, 
NULL);
-if (!dialog)
-return AVERROR_INVALIDDATA;
-duration = dialog->end - dialog->start;
-len = ff_ass_add_rect(data, ptr, 0, duration, 1);
-if (len < 0)
-return len;
-ptr  += len;
-size -= len;
-}
-
-*got_sub_ptr = avpkt->size > 0;
-return avpkt->size;
-}
-
-AVCodec ff_ssa_decoder = {
-.name = "ssa",
-.long_name= NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"),
-.type = AVMEDIA_TYPE_SUBTITLE,
-.id   = AV_CODEC_ID_SSA,
-.init = ass_decode_init,
-.decode   = ssa_decode_frame,
-.close= ass_decode_close,
-};
-#endif
-
-#if CONFIG_ASS_DECODER
 static int ass_decode_frame(AVCodecContext *avctx, void *data, int 
*got_sub_ptr,
 AVPacket *avpkt)
 {
@@ -108,6 +61,18 @@ static int ass_decode_frame(AVCodecContext *avctx, void 
*data, int *got_sub_ptr,
 return avpkt->size;
 }
 
+#if CONFIG_SSA_DECODER
+AVCodec ff_ssa_decoder = {
+.name = "ssa",
+.long_name= NULL_IF_CONFIG_SMALL("ASS (Advanced SubStation Alpha) 
subtitle"),
+.type = AVMEDIA_TYPE_SUBTITLE,
+.id   = AV_CODEC_ID_ASS,
+.init = ass_decode_init,
+.decode   = ass_decode_frame,
+};
+#endif
+
+#if CONFIG_ASS_DECODER
 AVCodec ff_ass_decoder = {
 .name = "ass",
 .long_name= NULL_IF_CONFIG_SMALL("ASS (Advanced SubStation Alpha) 
subtitle"),
@@ -115,6 +80,5 @@ AVCodec ff_ass_decoder = {
 .id   = AV_CODEC_ID_ASS,
 .init = ass_decode_init,
 .decode   = ass_decode_frame,
-.close= ass_decode_close,
 };
 #endif
diff --git a/libavcodec/assenc.c b/libavcodec/assenc.c
index 5dc3b09..06aa916 100644
--- a/libavcodec/assenc.c
+++ b/libavcodec/assenc.c
@@ -22,7 +22,6 @@
 #include 
 
 #include "avcodec.h"
-#include "ass_split.h"
 #include "ass.h"
 #include "libavutil/avstring.h"
 #include "libavutil/internal.h"
@@ -53,6 +52,8 @@ static int ass_encode_frame(AVCodecContext *avctx,
 for (i=0; inum_rects; i++) {
 char ass_line[2048];
 const char *ass = sub->rects[i]->ass;
+long int layer;
+char *p;
 
 if (sub->rects[i]->type != SUBTITLE_ASS) {
 av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n");
@@ -65,10 +66,7 @@ static int ass_encode_frame(AVCodecContext *avctx,
 return AVERROR_INVALIDDATA;
 }
 
-if (avctx->codec->id == AV_CODEC_ID_ASS) {
-long int layer;
-char *p;
-
+// TODO: reindent
 if (i > 0) {
 

Re: [FFmpeg-devel] [PATCH] libvpx: Support setting color range for vp9.

2016-01-09 Thread Ronald S. Bultje
Hi,

On Fri, Jan 8, 2016 at 10:12 PM, Sasi Inguva  wrote:

> Pass through color range to vp9 encoder. Parse color range in libvpxdec.c.
>
> Signed-off-by: Sasi Inguva 
> ---
>  libavcodec/libvpxdec.c |  6 ++
>  libavcodec/libvpxenc.c | 26 ++
>  2 files changed, 32 insertions(+)
>
> diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
> index 698c546..de72be9 100644
> --- a/libavcodec/libvpxdec.c
> +++ b/libavcodec/libvpxdec.c
> @@ -69,6 +69,12 @@ static int set_pix_fmt(AVCodecContext *avctx, struct
> vpx_image *img)
>  AVCOL_SPC_SMPTE240M, AVCOL_SPC_BT2020_NCL, AVCOL_SPC_RESERVED,
> AVCOL_SPC_RGB,
>  };
>  avctx->colorspace = colorspaces[img->cs];
> +#if VPX_IMAGE_ABI_VERSION >= 4
> +static const enum AVColorRange color_ranges[] = {
> +AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG
> +};
> +avctx->color_range = color_ranges[img->range];
> +#endif
>  #endif
>  if (avctx->codec_id == AV_CODEC_ID_VP8 && img->fmt !=
> VPX_IMG_FMT_I420)
>  return AVERROR_INVALIDDATA;
> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index 9cf32bf..ef531d5 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -125,6 +125,9 @@ static const char *const ctlidstr[] = {
>  #if VPX_ENCODER_ABI_VERSION > 8
>  [VP9E_SET_COLOR_SPACE] = "VP9E_SET_COLOR_SPACE",
>  #endif
> +#if VPX_ENCODER_ABI_VERSION >= 11
> +[VP9E_SET_COLOR_RANGE] = "VP9E_SET_COLOR_RANGE",
> +#endif
>  #endif
>  };
>
> @@ -368,6 +371,26 @@ static void set_colorspace(AVCodecContext *avctx)
>  codecctl_int(avctx, VP9E_SET_COLOR_SPACE, vpx_cs);
>  }
>  #endif
> +
> +#if VPX_ENCODER_ABI_VERSION >= 11
> +static void set_color_range(AVCodecContext *avctx)
> +{
> +enum vpx_color_range vpx_cr;
> +switch (avctx->color_range) {
> +case AVCOL_RANGE_UNSPECIFIED:
> +case AVCOL_RANGE_MPEG:
> +vpx_cr = VPX_CR_STUDIO_RANGE; break;
> +case AVCOL_RANGE_JPEG:
> +vpx_cr = VPX_CR_FULL_RANGE; break;
>

Patch itself is good, but can you please put the break on a newline? I
don't think we ever put break on the same line as the statement unless it's
on the same line as the "case" also.

(Whoever commits this patch can also do it for you.)

Thanks,
Ronald
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH]lavc/x264: Add compatibility values for coder options

2016-01-09 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes ticket #5142.

Please comment, Carl Eugen
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 4dc531a..88406a3 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -953,6 +953,8 @@ static const AVOption options[] = {
 { "default",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, INT_MIN, 
INT_MAX, VE, "coder" },
 { "cavlc",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 },  INT_MIN, 
INT_MAX, VE, "coder" },
 { "cabac",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 },  INT_MIN, 
INT_MAX, VE, "coder" },
+{ "vlc",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 },  INT_MIN, 
INT_MAX, VE, "coder" },
+{ "ac",   NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 },  INT_MIN, 
INT_MAX, VE, "coder" },
 
 { "x264-params",  "Override the x264 configuration using a :-separated 
list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_STRING, { 0 }, 
0, 0, VE },
 { NULL },
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v2] libi264: Add Hardware Accelerated H.264 Encoder based on libVA

2016-01-09 Thread hamza
From: "ha...@mayartech.com" 

This commit adds a hardware accelerated H.264 encoder which utilizes
libVA (open source implementation of VA-API). Information about libva
is available at: https://en.wikipedia.org/wiki/Video_Acceleration_API
This encoder is only availbale on linux and supported hardware which
can be viewed at:
https://en.wikipedia.org/wiki/Video_Acceleration_API#Supported_hardware_and_drivers

The short name for encoder is "libi264". The encoder must be enablde at
configure time using the --enable-libi264 switch. By default it is
turned off.
---
 Changelog   |1 +
 MAINTAINERS |1 +
 configure   |5 +-
 doc/general.texi|   11 +
 libavcodec/Makefile |1 +
 libavcodec/allcodecs.c  |1 +
 libavcodec/libi264.c| 1377 +++
 libavcodec/libi264.h|  111 +++
 libavcodec/libi264_param_set.c  |  425 +++
 libavcodec/libi264_param_set.h  |   81 +++
 libavcodec/libi264_va_display.c |  113 +++
 libavcodec/libi264_va_display.h |   86 +++
 libavcodec/libi264_va_display_drm.c |   97 +++
 libavcodec/libi264_va_display_x11.c |  172 +
 libavcodec/version.h|2 +-
 15 files changed, 2482 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/libi264.c
 create mode 100644 libavcodec/libi264.h
 create mode 100644 libavcodec/libi264_param_set.c
 create mode 100644 libavcodec/libi264_param_set.h
 create mode 100644 libavcodec/libi264_va_display.c
 create mode 100644 libavcodec/libi264_va_display.h
 create mode 100644 libavcodec/libi264_va_display_drm.c
 create mode 100644 libavcodec/libi264_va_display_x11.c

diff --git a/Changelog b/Changelog
index d9c2ea8..99acb56 100644
--- a/Changelog
+++ b/Changelog
@@ -49,6 +49,7 @@ version :
 - VAAPI VP9 hwaccel
 - audio high-order multiband parametric equalizer
 - automatic bitstream filtering
+- H.264 hwaccelerated encoding through libVA
 
 
 version 2.8:
diff --git a/MAINTAINERS b/MAINTAINERS
index 9add13d..e37cb6f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -203,6 +203,7 @@ Codecs:
   libcelt_dec.c Nicolas George
   libdirac* David Conrad
   libgsm.c  Michel Bardiaux
+  libi264*  Bryan Christ
   libkvazaar.c  Arttu Yl??-Outinen
   libopenjpeg.c Jaikrishnan Menon
   libopenjpegenc.c  Michael Bradshaw
diff --git a/configure b/configure
index da74ccd..d8fe713 100755
--- a/configure
+++ b/configure
@@ -265,6 +265,7 @@ External library support:
   --enable-libwavpack  enable wavpack encoding via libwavpack [no]
   --enable-libwebp enable WebP encoding via libwebp [no]
   --enable-libx264 enable H.264 encoding via x264 [no]
+  --enable-libi264 enable H.264 encoding via libva [no]
   --enable-libx265 enable HEVC encoding via x265 [no]
   --enable-libxavs enable AVS encoding via xavs [no]
   --enable-libxcb  enable X11 grabbing using XCB [autodetect]
@@ -1454,6 +1455,7 @@ EXTERNAL_LIBRARY_LIST="
 libfribidi
 libgme
 libgsm
+libi264
 libiec61883
 libilbc
 libkvazaar
@@ -2658,7 +2660,7 @@ libwebp_anim_encoder_deps="libwebp"
 libx262_encoder_deps="libx262"
 libx264_encoder_deps="libx264"
 libx264rgb_encoder_deps="libx264"
-libx264rgb_encoder_select="libx264_encoder"
+libi264_encoder_deps="swscale"
 libx265_encoder_deps="libx265"
 libxavs_encoder_deps="libxavs"
 libxvid_encoder_deps="libxvid"
@@ -5528,6 +5530,7 @@ enabled libx264   && { use_pkg_config x264 
"stdint.h x264.h" x264_encode
die "ERROR: libx264 must be installed and 
version must be >= 0.118."; } &&
  { check_cpp_condition x264.h "X264_MPEG2" &&
enable libx262; }
+enabled libi264   && require libva va/va.h vaInitialize -lva -lX11 
-lva-x11 -lva-drm
 enabled libx265   && require_pkg_config x265 x265.h x265_api_get &&
  { check_cpp_condition x265.h "X265_BUILD >= 57" ||
die "ERROR: libx265 version must be >= 57."; }
diff --git a/doc/general.texi b/doc/general.texi
index 06933ab..bca7ca0 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -131,6 +131,17 @@ x264 is under the GNU Public License Version 2 or later
 details), you must upgrade FFmpeg's license to GPL in order to use it.
 @end float
 
+@section libva
+
+FFmpeg can make use of the libva library for H.264 encoding. libva is an 
+implementation of VA-API for Linux. libva can only be used for H.264 encoding
+on unix based systems and Intel GPUs which have support for hardware 
accelerated
+H.264 encoding.
+
+Go to @url{http://www.freedesktop.org/wiki/Software/vaapi/} and 

Re: [FFmpeg-devel] [PATCH] avf_showspectrum: Silence "deprecated pixel format" warning

2016-01-09 Thread Paul B Mahol
On 1/9/16, Timothy Gu  wrote:
> ---
>  libavfilter/avf_showspectrum.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
> index 5b26be8..a967a41 100644
> --- a/libavfilter/avf_showspectrum.c
> +++ b/libavfilter/avf_showspectrum.c
> @@ -240,7 +240,7 @@ static int query_formats(AVFilterContext *ctx)
>  AVFilterLink *inlink = ctx->inputs[0];
>  AVFilterLink *outlink = ctx->outputs[0];
>  static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP,
> AV_SAMPLE_FMT_NONE };
> -static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUVJ444P,
> AV_PIX_FMT_NONE };
> +static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV444P,
> AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_NONE };
>  int ret;
>
>  /* set input audio formats */
> @@ -365,6 +365,7 @@ static int config_output(AVFilterLink *outlink)
>  if (!outpicref)
>  return AVERROR(ENOMEM);
>  outlink->sample_aspect_ratio = (AVRational){1,1};
> +outpicref->color_range = AVCOL_RANGE_JPEG;
>  for (i = 0; i < outlink->h; i++) {
>  memset(outpicref->data[0] + i * outpicref->linesize[0],   0,
> outlink->w);
>  memset(outpicref->data[1] + i * outpicref->linesize[1], 128,
> outlink->w);
> --
> 2.1.4
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

I already set color range.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avf_showspectrum: Silence "deprecated pixel format" warning

2016-01-09 Thread Timothy Gu
---
 libavfilter/avf_showspectrum.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 5b26be8..a967a41 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -240,7 +240,7 @@ static int query_formats(AVFilterContext *ctx)
 AVFilterLink *inlink = ctx->inputs[0];
 AVFilterLink *outlink = ctx->outputs[0];
 static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, 
AV_SAMPLE_FMT_NONE };
-static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUVJ444P, 
AV_PIX_FMT_NONE };
+static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV444P, 
AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_NONE };
 int ret;
 
 /* set input audio formats */
@@ -365,6 +365,7 @@ static int config_output(AVFilterLink *outlink)
 if (!outpicref)
 return AVERROR(ENOMEM);
 outlink->sample_aspect_ratio = (AVRational){1,1};
+outpicref->color_range = AVCOL_RANGE_JPEG;
 for (i = 0; i < outlink->h; i++) {
 memset(outpicref->data[0] + i * outpicref->linesize[0],   0, 
outlink->w);
 memset(outpicref->data[1] + i * outpicref->linesize[1], 128, 
outlink->w);
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] -cmdline_from_file new paramter

2016-01-09 Thread Nicolas George
Le decadi 20 nivôse, an CCXXIV, kovacsr...@proci.hu a écrit :
> The windows shell can't comment inline, can't tagging with new line simply
> and the script file is not compatible with Linux.
> I use both operating system. This solution makes it  possible to create
> UNIVERSAL control files.

You can install the same shell on both operating systems and be done with
it.

> This parameter is similar to -filter_script parameter.
> It has only advantages, and no disadvantages. Please integrate this patch.

No, it is not similar. -filter_script just loads the file, the parsing is
the same. This patch adds dozens of lines to do the same job as a shell, in
a worse way.

> -Original Message-

Please do not top-post on this mailing-list. If you do not know what it
means, look it up.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] -cmdline_from_file new paramter

2016-01-09 Thread kovacsrobi
Hi

The windows shell can't comment inline, can't tagging with new line simply
and the script file is not compatible with Linux.
I use both operating system. This solution makes it  possible to create
UNIVERSAL control files.
Shell can't make  dynamically generated script with etc.:
http://localhost/control.txt argument without file operations.
This parameter is similar to -filter_script parameter.
It has only advantages, and no disadvantages. Please integrate this patch.
Thank you.

Regards,
Robert Kovacs

-Original Message-
From: geo...@nsup.org [mailto:geo...@nsup.org] 
Sent: Friday, January 08, 2016 2:31 PM
To: FFmpeg development discussions and patches
Cc: Procontrol Robert Kovacs
Subject: Re: [FFmpeg-devel] [PATCH] -cmdline_from_file new paramter

Le septidi 17 nivôse, an CCXXIV, Procontrol Robert Kovacs a écrit :
> ---
>  cmdutils.c   | 186
+++
>  doc/fftools-common-opts.texi |  41 ++
>  2 files changed, 227 insertions(+)

I do not think that FFmpeg needs another shell-like parser with its own
variants of escaping rules and its own limitations. This is the task of a
shell, and shells do that very well, much better than this.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] libvpx: Support setting color range for vp9.

2016-01-09 Thread James Almer
On 1/9/2016 11:43 AM, Ronald S. Bultje wrote:
> Hi,
> 
> On Fri, Jan 8, 2016 at 10:12 PM, Sasi Inguva  wrote:
> 
>> Pass through color range to vp9 encoder. Parse color range in libvpxdec.c.
>>
>> Signed-off-by: Sasi Inguva 
>> ---
>>  libavcodec/libvpxdec.c |  6 ++
>>  libavcodec/libvpxenc.c | 26 ++
>>  2 files changed, 32 insertions(+)
>>
>> diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
>> index 698c546..de72be9 100644
>> --- a/libavcodec/libvpxdec.c
>> +++ b/libavcodec/libvpxdec.c
>> @@ -69,6 +69,12 @@ static int set_pix_fmt(AVCodecContext *avctx, struct
>> vpx_image *img)
>>  AVCOL_SPC_SMPTE240M, AVCOL_SPC_BT2020_NCL, AVCOL_SPC_RESERVED,
>> AVCOL_SPC_RGB,
>>  };
>>  avctx->colorspace = colorspaces[img->cs];
>> +#if VPX_IMAGE_ABI_VERSION >= 4
>> +static const enum AVColorRange color_ranges[] = {
>> +AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG
>> +};
>> +avctx->color_range = color_ranges[img->range];
>> +#endif
>>  #endif
>>  if (avctx->codec_id == AV_CODEC_ID_VP8 && img->fmt !=
>> VPX_IMG_FMT_I420)
>>  return AVERROR_INVALIDDATA;
>> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
>> index 9cf32bf..ef531d5 100644
>> --- a/libavcodec/libvpxenc.c
>> +++ b/libavcodec/libvpxenc.c
>> @@ -125,6 +125,9 @@ static const char *const ctlidstr[] = {
>>  #if VPX_ENCODER_ABI_VERSION > 8
>>  [VP9E_SET_COLOR_SPACE] = "VP9E_SET_COLOR_SPACE",
>>  #endif
>> +#if VPX_ENCODER_ABI_VERSION >= 11
>> +[VP9E_SET_COLOR_RANGE] = "VP9E_SET_COLOR_RANGE",
>> +#endif
>>  #endif
>>  };
>>
>> @@ -368,6 +371,26 @@ static void set_colorspace(AVCodecContext *avctx)
>>  codecctl_int(avctx, VP9E_SET_COLOR_SPACE, vpx_cs);
>>  }
>>  #endif
>> +
>> +#if VPX_ENCODER_ABI_VERSION >= 11
>> +static void set_color_range(AVCodecContext *avctx)
>> +{
>> +enum vpx_color_range vpx_cr;
>> +switch (avctx->color_range) {
>> +case AVCOL_RANGE_UNSPECIFIED:
>> +case AVCOL_RANGE_MPEG:
>> +vpx_cr = VPX_CR_STUDIO_RANGE; break;
>> +case AVCOL_RANGE_JPEG:
>> +vpx_cr = VPX_CR_FULL_RANGE; break;
>>
> 
> Patch itself is good, but can you please put the break on a newline? I
> don't think we ever put break on the same line as the statement unless it's
> on the same line as the "case" also.
> 
> (Whoever commits this patch can also do it for you.)

Pushed. You could have done it yourself, though :p

> 
> Thanks,
> Ronald
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

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


Re: [FFmpeg-devel] [PATCH] rtmpdh: Initialize gcrypt before using it

2016-01-09 Thread Ricardo Constantino
Ping
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavc/x264: Add compatibility values for coder options

2016-01-09 Thread Michael Niedermayer
On Sat, Jan 09, 2016 at 12:04:27PM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes ticket #5142.
> 
> Please comment, Carl Eugen

>  libx264.c |2 ++
>  1 file changed, 2 insertions(+)
> 98178e28de0e96f9e4c9f1f1ddcc4d75055d48bd  patchx264coder.diff
> diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c

LGTM

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


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


[FFmpeg-devel] [PATCH 2/2] avformat: Add Cineform HD demuxing

2016-01-09 Thread Kieran Kunhya
---
 libavformat/riff.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/riff.c b/libavformat/riff.c
index f297dd4..faf0f86 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -377,6 +377,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_SCREENPRESSO, MKTAG('S', 'P', 'V', '1') },
 { AV_CODEC_ID_RSCC, MKTAG('R', 'S', 'C', 'C') },
 { AV_CODEC_ID_RSCC, MKTAG('I', 'S', 'C', 'C') },
+{ AV_CODEC_ID_CFHD, MKTAG('C', 'F', 'H', 'D') },
 { AV_CODEC_ID_NONE, 0 }
 };
 
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 1/2] avcodec: Add Cineform HD Decoder

2016-01-09 Thread Kieran Kunhya
---
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/cfhd.c   | 565 
 libavcodec/cfhd.h   |  99 +
 libavcodec/cfhddata.c   | 470 
 libavcodec/codec_desc.c |   6 +
 7 files changed, 1143 insertions(+)
 create mode 100644 libavcodec/cfhd.c
 create mode 100644 libavcodec/cfhd.h
 create mode 100644 libavcodec/cfhddata.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index b9ffdb9..c331a4f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -210,6 +210,7 @@ OBJS-$(CONFIG_CAVS_DECODER)+= cavs.o cavsdec.o 
cavsdsp.o \
 OBJS-$(CONFIG_CCAPTION_DECODER)+= ccaption_dec.o
 OBJS-$(CONFIG_CDGRAPHICS_DECODER)  += cdgraphics.o
 OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
+OBJS-$(CONFIG_CFHD_DECODER)+= cfhd.o cfhddata.o
 OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
 OBJS-$(CONFIG_CINEPAK_ENCODER) += cinepakenc.o elbg.o
 OBJS-$(CONFIG_CLJR_DECODER)+= cljrdec.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 2128546..1d92c8b 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -147,6 +147,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER(CAVS,  cavs);
 REGISTER_DECODER(CDGRAPHICS,cdgraphics);
 REGISTER_DECODER(CDXL,  cdxl);
+REGISTER_DECODER(CFHD,  cfhd);
 REGISTER_ENCDEC (CINEPAK,   cinepak);
 REGISTER_ENCDEC (CLJR,  cljr);
 REGISTER_DECODER(CLLC,  cllc);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index f365775..b958a6c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -315,6 +315,7 @@ enum AVCodecID {
 AV_CODEC_ID_SMVJPEG,
 AV_CODEC_ID_APNG,
 AV_CODEC_ID_DAALA,
+AV_CODEC_ID_CFHD,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
new file mode 100644
index 000..dc36889
--- /dev/null
+++ b/libavcodec/cfhd.c
@@ -0,0 +1,565 @@
+/*
+ * Copyright (c) 2015 Kieran Kunhya
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * CFHD Video Decoder
+ */
+
+#include "libavutil/buffer.h"
+#include "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
+
+#include "avcodec.h"
+#include "bswapdsp.h"
+#include "internal.h"
+#include "bytestream.h"
+#include "cfhd.h"
+
+static av_cold int cfhd_decode_init(AVCodecContext *avctx)
+{
+CFHDContext *s = avctx->priv_data;
+
+avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
+avctx->bits_per_raw_sample = 10;
+s->avctx   = avctx;
+
+return ff_cfhd_init_vlcs(s);
+}
+
+static void init_plane_defaults(CFHDContext *s)
+{
+s->subband_num= 0;
+s->level  = 0;
+s->subband_num_actual = 0;
+}
+
+static void init_frame_defaults(CFHDContext *s)
+{
+s->bpc   = 10;
+s->channel_cnt   = 4;
+s->subband_cnt   = 10;
+s->channel_num   = 0;
+s->lowpass_precision = 16;
+s->quantisation  = 1;
+s->wavelet_depth = 3;
+s->pshift= 1;
+s->codebook  = 0;
+init_plane_defaults(s);
+}
+
+static inline int dequant_and_decompand(int level, int quantisation)
+{
+int abslevel = abs(level);
+return (abslevel + ((768 * abslevel * abslevel * abslevel) / (255 * 255 * 
255))) * FFSIGN(level) * quantisation;
+}
+
+static inline void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, 
ptrdiff_t low_stride,
+  int16_t *high, ptrdiff_t high_stride, int len)
+{
+int32_t tmp;
+
+int i;
+for (i = 0; i < len; i++) {
+if( i == 0 )
+{
+tmp = (11*low[0*low_stride] - 4*low[1*low_stride] + 
low[2*low_stride] + 4) >> 3;
+output[(2*i+0)*out_stride] = (tmp + high[0*high_stride]) >> 1;
+tmp = ( 5*low[0*low_stride] + 4*low[1*low_stride] - 
low[2*low_stride] + 4) >> 3;
+output[(2*i+1)*out_stride] = (tmp - 

[FFmpeg-devel] [PATCH 1/2] lavc/ccaption_dec: flush context on seek

2016-01-09 Thread Aman Gupta
From: Aman Gupta 

---
 libavcodec/ccaption_dec.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index fc6431b..8bef771 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -165,6 +165,24 @@ static av_cold int close_decoder(AVCodecContext *avctx)
 return 0;
 }
 
+static void flush_decoder(AVCodecContext *avctx)
+{
+CCaptionSubContext *ctx = avctx->priv_data;
+ctx->screen[0].row_used = 0;
+ctx->screen[1].row_used = 0;
+ctx->prev_cmd[0] = 0;
+ctx->prev_cmd[1] = 0;
+ctx->mode = CCMODE_ROLLUP;
+ctx->rollup = 2;
+ctx->cursor_row = 0;
+ctx->cursor_column = 0;
+ctx->cursor_font = 0;
+ctx->cursor_color = 0;
+ctx->active_screen = 0;
+av_bprint_clear(>buffer);
+ctx->buffer_changed = 0;
+}
+
 /**
  * @param ctx closed caption context just to print log
  */
@@ -570,6 +588,7 @@ AVCodec ff_ccaption_decoder = {
 .priv_data_size = sizeof(CCaptionSubContext),
 .init   = init_decoder,
 .close  = close_decoder,
+.flush  = flush_decoder,
 .decode = decode,
 .priv_class = _dec_class,
 };
-- 
2.5.3

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


[FFmpeg-devel] [PATCH 2/2] lavc/ccaption_dec: implement real_time option

2016-01-09 Thread Aman Gupta
From: Aman Gupta 

This new mode is useful for realtime decoding of closed captions so they
can be display along with mpeg2 frames.

Closed caption streams contain two major types of captions:

- POPON captions, which are buffered off-screen and displayed
  only after EOC (end of caption, aka display buffer)

- PAINTON/ROLLUP captions, which are written to the display as soon as
  they arrive.

In a typical real-time eia608 decoder, commands like EOC (end of
caption; display buffer), EDM (erase display memory) and EBM (erase
buffered memory) perform their expected functions as soon as the
commands are processed. This is implemented in the real_time branches
added in this commit.

Before this commit, and in the !real_time branches after this commit,
the decoder cleverly implements its own version of the decoder which is
specifically geared towards buffered decoding. It does so by actively
ignoring commands like EBM (erase buffered memory), and then re-using
the non-display buffer to hold the previous caption while the new one is
received. This is the opposite of the real-time decoder, which uses the
non-display buffer to hold the new caption while the display buffer is
still showing the current caption.

In addition to ignoring EBM, the buffered decoder also has custom
implementations for EDM and EOC. An EDM (erase display memory) command
flushes the existing contents before clearing the screen, and EOC
similarly always flushes the active buffer (the previous subtitle)
before flipping buffers.
---
 libavcodec/ccaption_dec.c  | 85 +-
 tests/fate/subtitles.mak   |  3 ++
 tests/ref/fate/sub-cc-realtime | 42 +
 3 files changed, 121 insertions(+), 9 deletions(-)
 create mode 100644 tests/ref/fate/sub-cc-realtime

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index 8bef771..8c26fcc 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -116,6 +116,7 @@ struct Screen {
 
 typedef struct CCaptionSubContext {
 AVClass *class;
+int real_time;
 struct Screen screen[2];
 int active_screen;
 uint8_t cursor_row;
@@ -130,6 +131,8 @@ typedef struct CCaptionSubContext {
 /* visible screen time */
 int64_t startv_time;
 int64_t end_time;
+int screen_touched;
+int64_t last_real_time;
 char prev_cmd[2];
 /* buffer to store pkt data */
 AVBufferRef *pktbuf;
@@ -180,7 +183,10 @@ static void flush_decoder(AVCodecContext *avctx)
 ctx->cursor_color = 0;
 ctx->active_screen = 0;
 av_bprint_clear(>buffer);
-ctx->buffer_changed = 0;
+ctx->last_real_time = 0;
+ctx->screen_touched = 0;
+/* emit empty subtitle on seek in realtime mode */
+ctx->buffer_changed = ctx->real_time ? 1 : 0;
 }
 
 /**
@@ -418,15 +424,33 @@ static void handle_edm(CCaptionSubContext *ctx, int64_t 
pts)
 {
 struct Screen *screen = ctx->screen + ctx->active_screen;
 
-reap_screen(ctx, pts);
+// In buffered mode, keep writing to screen until it is wiped.
+// Before wiping the display, capture contents to emit subtitle.
+if (!ctx->real_time)
+reap_screen(ctx, pts);
+
 screen->row_used = 0;
+
+// In realtime mode, emit an empty caption so the last one doesn't
+// stay on the screen.
+if (ctx->real_time)
+reap_screen(ctx, pts);
 }
 
 static void handle_eoc(CCaptionSubContext *ctx, int64_t pts)
 {
-handle_edm(ctx,pts);
+// In buffered mode, we wait til the *next* EOC and
+// reap what was already on the screen since the last EOC.
+if (!ctx->real_time)
+handle_edm(ctx,pts);
+
 ctx->active_screen = !ctx->active_screen;
 ctx->cursor_column = 0;
+
+// In realtime mode, we display the buffered contents (after
+// flipping the buffer to active above) as soon as EOC arrives.
+if (ctx->real_time)
+reap_screen(ctx, pts);
 }
 
 static void handle_delete_end_of_row(CCaptionSubContext *ctx, char hi, char lo)
@@ -448,6 +472,9 @@ static void handle_char(CCaptionSubContext *ctx, char hi, 
char lo, int64_t pts)
 }
 write_char(ctx, screen, 0);
 
+if (ctx->mode != CCMODE_POPON)
+ctx->screen_touched = 1;
+
 /* reset prev command since character can repeat */
 ctx->prev_cmd[0] = 0;
 ctx->prev_cmd[1] = 0;
@@ -497,10 +524,20 @@ static void process_cc608(CCaptionSubContext *ctx, 
int64_t pts, uint8_t hi, uint
 case 0x2d:
 /* carriage return */
 ff_dlog(ctx, "carriage return\n");
-reap_screen(ctx, pts);
+if (!ctx->real_time)
+reap_screen(ctx, pts);
 roll_up(ctx);
 ctx->cursor_column = 0;
 break;
+case 0x2e:
+/* erase buffered (non displayed) memory */
+// Only in realtime mode. In buffered mode, we re-use the inactive 
screen
+// for our own buffering.
+if (ctx->real_time) {
+

Re: [FFmpeg-devel] [PATCH] rtmpdh: Initialize gcrypt before using it

2016-01-09 Thread Ricardo Constantino
On 10 January 2016 at 00:17, Ricardo Constantino  wrote:

> On 9 January 2016 at 23:32, Michael Niedermayer 
> wrote:
>
>>
>> we should pass the version number we need i think
>> see
>>
>> https://quickgit.kde.org/?p=libktorrent.git=commit=a23bafe9191e0dcbd5ae75335fd5d8e49bfda9ed
>>
>>
> I wouldn't know the minimum version FFmpeg needs.
> Wouldn't it be better to leave as NULL then?
>
On a glance of libgcrypt's NEWS I can't find any mention of most functions
used in rtmpdh.c, except for gcry_mpi_{print,scan} which just had:
>gcry_mpi_scanCHANGED: New argument to separate in/out args.
>gcry_mpi_printCHANGED: Ditto.
in 1.1.42 (2003)
and added support for negative numbers in 1.6.0.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] rtmpdh: Initialize gcrypt before using it

2016-01-09 Thread Michael Niedermayer
On Mon, Jan 04, 2016 at 02:39:41AM +, Ricardo Constantino wrote:
> On 3 January 2016 at 23:13, Jan Ekstrom  wrote:
> 
> > Hi,
> >
> > In general looks good, although it might look a bit weird for someone
> > as usually libraries have initialization functions called like that.
> > That said, this is what
> >
> > https://gnupg.org/documentation/manuals/gcrypt/Initializing-the-library.html
> > recommends.
> >
> > My only comment would be that we might want to set the parameter to
> > GCRYPT_VERSION instead of NULL, as we most probably care if the
> > library loaded matches our version (unless these versions change even
> > if API doesn't change).
> >
> 
> This is where it shows my ignorance but I don't know which of these is the
> best way of dealing with that.
> I tested all three and they all work with the linked sample.

we should pass the version number we need i think
see
https://quickgit.kde.org/?p=libktorrent.git=commit=a23bafe9191e0dcbd5ae75335fd5d8e49bfda9ed

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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


Re: [FFmpeg-devel] [PATCH] avf_showspectrum: Silence "deprecated pixel format" warning

2016-01-09 Thread Timothy Gu
On Sat, Jan 09, 2016 at 09:23:43PM +, Paul B Mahol wrote:
> 
> I already set color range.

Fixed and pushed.

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


Re: [FFmpeg-devel] [PATCH] rtmpdh: Initialize gcrypt before using it

2016-01-09 Thread Ricardo Constantino
On 9 January 2016 at 23:32, Michael Niedermayer 
wrote:

>
> we should pass the version number we need i think
> see
>
> https://quickgit.kde.org/?p=libktorrent.git=commit=a23bafe9191e0dcbd5ae75335fd5d8e49bfda9ed
>
>
I wouldn't know the minimum version FFmpeg needs.
Wouldn't it be better to leave as NULL then?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v4] lavf/matroskadec: Normalize noncompliant A_QUICKTIME/V_QUICKTIME private data

2016-01-09 Thread Michael Niedermayer
On Sat, Jan 09, 2016 at 12:02:19PM +0100, Mats Peterson wrote:
> Minor simplification of get_qt_codec(). Description follows:
> 
> This patch adds a new static function get_qt_codec() that takes care
> of the initial retrieval of the fourcc and codec ID for A_QUICKTIME
> and V_QUICKTIME. It also normalizes noncompliant private data found
> in some older files that incorrectly starts with the fourcc by
> expanding/shifting the data by 4 bytes, and storing the data size at
> the start. This is necessary in order for the rest of the code in
> the A_QUICKTIME and V_QUICKTIME blocks (and most likely other code
> as well) to correctly parse the private data.
> 
> Mats
> 
> -- 
> Mats Peterson
> http://matsp888.no-ip.org/~mats/

>  matroskadec.c |   47 ++-
>  1 file changed, 34 insertions(+), 13 deletions(-)
> 714309bb2cd9614cb58dfdaa5c05574d53386bb5  
> 0001-lavf-matroskadec-Normalize-noncompliant-A_QUICKTIME-.patch
> From 9448cff9c5cdd1e301da8868c8e2e189ef34c760 Mon Sep 17 00:00:00 2001
> From: Mats Peterson 
> Date: Sat, 9 Jan 2016 11:59:18 +0100
> Subject: [PATCH v4] lavf/matroskadec: Normalize noncompliant 
> A_QUICKTIME/V_QUICKTIME private data
> 
> Minor simplification of get_qt_codec(). Description follows:
> 
> This patch adds a new static function get_qt_codec() that takes care of
> the initial retrieval of the fourcc and codec ID for A_QUICKTIME and
> V_QUICKTIME. It also normalizes noncompliant private data found in some
> older files that incorrectly starts with the fourcc by expanding/shifting
> the data by 4 bytes, and storing the data size at the start. This is
> necessary in order for the rest of the code in the A_QUICKTIME and
> V_QUICKTIME blocks (and most likely other code as well) to correctly
> parse the private data.
> 
> Mats
> 
> ---
>  libavformat/matroskadec.c |   47 
> -
>  1 file changed, 34 insertions(+), 13 deletions(-)
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index be4e300..71bf5e5 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -1708,6 +1708,32 @@ static void mkv_stereo_mode_display_mul(int 
> stereo_mode, int *h_width, int *h_he
>  }
>  }
>  
> +static int get_qt_codec(MatroskaTrack *track, uint32_t *fourcc, enum 
> AVCodecID *codec_id)
> +{
> +const AVCodecTag *codec_tags;
> +
> +codec_tags = track->type == MATROSKA_TRACK_TYPE_VIDEO ?
> +ff_codec_movvideo_tags : ff_codec_movaudio_tags;
> +
> +/* Normalize noncompliant private data that starts with the fourcc
> + * by expanding/shifting the data by 4 bytes and storing the data
> + * size at the start. */
> +if (ff_codec_get_id(codec_tags, AV_RL32(track->codec_priv.data))) {

> +if (!(track->codec_priv.data = av_realloc(track->codec_priv.data,
> +track->codec_priv.size + 4)))
> +return AVERROR(ENOMEM);

in case of this failing the memory is not freed and leaks

see av_reallocp() if you want it to be freed, alternatively the code
could continue without the move/update

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


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


Re: [FFmpeg-devel] [PATCH v4] lavf/matroskadec: Normalize noncompliant A_QUICKTIME/V_QUICKTIME private data

2016-01-09 Thread Mats Peterson

On 01/10/2016 02:20 AM, Michael Niedermayer wrote:


+if (!(track->codec_priv.data = av_realloc(track->codec_priv.data,
+track->codec_priv.size + 4)))
+return AVERROR(ENOMEM);


in case of this failing the memory is not freed and leaks

see av_reallocp() if you want it to be freed, alternatively the code
could continue without the move/update



OK, but I thought an AVERROR(ENOMEM) eventually causes FFmpeg to exit?

And another thing: I notice the following regarding both av_realloc() 
and av_reallocp():


"Pointers originating from the av_malloc() family of functions must not 
be passed to av_realloc(). The former can be implemented using 
memalign() (or other functions), and there is no guarantee that pointers 
from such functions can be passed to realloc() at all. The situation is 
undefined according to POSIX and may crash with some libc implementations."


I suppose that ebml_read_binary() in matroskadec.c is the function used 
to read the private data, and it allocates memory using 
av_fast_padded_malloc() for this. Is it safe to reallocate a pointer 
from this function then? So far I've had no problems, but of course I 
want to be absolutely sure.


Mats

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


[FFmpeg-devel] [PATCH v5] lavf/matroskadec: Normalize noncompliant A_QUICKTIME/V_QUICKTIME private data

2016-01-09 Thread Mats Peterson
How about this one, Michael? Rather than using the obviously dangerous 
av_realloc() it uses av_malloc() to allocate new memory for the private 
data, then copies the private data to it, frees the pointer to the 
original private data, and finally sets track->codec->priv_data to the 
newly allocated memory.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From a0aef3427e91adb46de2bc119f2367f4764d601a Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Sun, 10 Jan 2016 03:59:21 +0100
Subject: [PATCH v5] lavf/matroskadec: Normalize noncompliant A_QUICKTIME/V_QUICKTIME private data

This patch adds a new static function get_qt_codec() that takes care of
the initial retrieval of the fourcc and codec ID for A_QUICKTIME and
V_QUICKTIME. It also normalizes noncompliant private data found in some
older files that incorrectly starts with the fourcc by expanding/shifting
the data by 4 bytes, and storing the data size at the start. This is
necessary in order for the rest of the code in the A_QUICKTIME and
V_QUICKTIME blocks (and most likely other code as well) to correctly
parse the private data.

---
 libavformat/matroskadec.c |   48 +
 1 file changed, 35 insertions(+), 13 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index be4e300..9e9e074 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1708,6 +1708,33 @@ static void mkv_stereo_mode_display_mul(int stereo_mode, int *h_width, int *h_he
 }
 }
 
+static int get_qt_codec(MatroskaTrack *track, uint32_t *fourcc, enum AVCodecID *codec_id)
+{
+const AVCodecTag *codec_tags;
+
+codec_tags = track->type == MATROSKA_TRACK_TYPE_VIDEO ?
+ff_codec_movvideo_tags : ff_codec_movaudio_tags;
+
+/* Normalize noncompliant private data that starts with the fourcc
+ * by expanding/shifting the data by 4 bytes and storing the data
+ * size at the start. */
+if (ff_codec_get_id(codec_tags, AV_RL32(track->codec_priv.data))) {
+uint8_t *p = av_malloc(track->codec_priv.size + 4);
+if (!p)
+return AVERROR(ENOMEM);
+memcpy(p + 4, track->codec_priv.data, track->codec_priv.size);
+av_free(track->codec_priv.data);
+track->codec_priv.data = p;
+track->codec_priv.size += 4;
+AV_WB32(track->codec_priv.data, track->codec_priv.size);
+}
+
+*fourcc = AV_RL32(track->codec_priv.data + 4);
+*codec_id = ff_codec_get_id(codec_tags, *fourcc);
+
+return 0;
+}
+
 static int matroska_parse_tracks(AVFormatContext *s)
 {
 MatroskaDemuxContext *matroska = s->priv_data;
@@ -1861,14 +1888,12 @@ static int matroska_parse_tracks(AVFormatContext *s)
 fourcc   = st->codec->codec_tag;
 extradata_offset = FFMIN(track->codec_priv.size, 18);
 } else if (!strcmp(track->codec_id, "A_QUICKTIME")
-   && (track->codec_priv.size >= 36)
+   /* Normally 36, but allow noncompliant private data */
+   && (track->codec_priv.size >= 32)
&& (track->codec_priv.data)) {
-fourcc = AV_RL32(track->codec_priv.data + 4);
-codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
-if (ff_codec_get_id(ff_codec_movaudio_tags, AV_RL32(track->codec_priv.data))) {
-fourcc = AV_RL32(track->codec_priv.data);
-codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
-}
+int ret = get_qt_codec(track, , _id);
+if (ret < 0)
+return ret;
 if (fourcc == 0) {
 if (track->audio.bitdepth == 8) {
 fourcc = MKTAG('r','a','w',' ');
@@ -1881,12 +1906,9 @@ static int matroska_parse_tracks(AVFormatContext *s)
 } else if (!strcmp(track->codec_id, "V_QUICKTIME") &&
(track->codec_priv.size >= 21)  &&
(track->codec_priv.data)) {
-fourcc   = AV_RL32(track->codec_priv.data + 4);
-codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc);
-if (ff_codec_get_id(ff_codec_movvideo_tags, AV_RL32(track->codec_priv.data))) {
-fourcc   = AV_RL32(track->codec_priv.data);
-codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc);
-}
+int ret = get_qt_codec(track, , _id);
+if (ret < 0)
+return ret;
 if (codec_id == AV_CODEC_ID_NONE && AV_RL32(track->codec_priv.data+4) == AV_RL32("SMI ")) {
 fourcc = MKTAG('S','V','Q','3');
 codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc);
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH v5] lavf/matroskadec: Normalize noncompliant A_QUICKTIME/V_QUICKTIME private data

2016-01-09 Thread Mats Peterson

On 01/10/2016 04:04 AM, Mats Peterson wrote:

original private data, and finally sets track->codec->priv_data to the

Should be track->codec_priv.data of course.

Mats

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


Re: [FFmpeg-devel] [PATCH] avcodec/codec_desc: Add ff_aac_profiles to aac_latm

2016-01-09 Thread Michael Niedermayer
On Fri, Jan 01, 2016 at 06:23:57PM +0100, Michael Niedermayer wrote:
> From: Michael Niedermayer 
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/codec_desc.c |1 +
>  1 file changed, 1 insertion(+)

applied

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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec: Add Cineform HD Decoder

2016-01-09 Thread James Almer
On 1/9/2016 9:28 PM, Kieran Kunhya wrote:
> ---
>  libavcodec/Makefile |   1 +
>  libavcodec/allcodecs.c  |   1 +
>  libavcodec/avcodec.h|   1 +
>  libavcodec/cfhd.c   | 565 
> 
>  libavcodec/cfhd.h   |  99 +
>  libavcodec/cfhddata.c   | 470 
>  libavcodec/codec_desc.c |   6 +
>  7 files changed, 1143 insertions(+)
>  create mode 100644 libavcodec/cfhd.c
>  create mode 100644 libavcodec/cfhd.h
>  create mode 100644 libavcodec/cfhddata.c
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index b9ffdb9..c331a4f 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -210,6 +210,7 @@ OBJS-$(CONFIG_CAVS_DECODER)+= cavs.o 
> cavsdec.o cavsdsp.o \
>  OBJS-$(CONFIG_CCAPTION_DECODER)+= ccaption_dec.o
>  OBJS-$(CONFIG_CDGRAPHICS_DECODER)  += cdgraphics.o
>  OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
> +OBJS-$(CONFIG_CFHD_DECODER)+= cfhd.o cfhddata.o
>  OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
>  OBJS-$(CONFIG_CINEPAK_ENCODER) += cinepakenc.o elbg.o
>  OBJS-$(CONFIG_CLJR_DECODER)+= cljrdec.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index 2128546..1d92c8b 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -147,6 +147,7 @@ void avcodec_register_all(void)
>  REGISTER_DECODER(CAVS,  cavs);
>  REGISTER_DECODER(CDGRAPHICS,cdgraphics);
>  REGISTER_DECODER(CDXL,  cdxl);
> +REGISTER_DECODER(CFHD,  cfhd);
>  REGISTER_ENCDEC (CINEPAK,   cinepak);
>  REGISTER_ENCDEC (CLJR,  cljr);
>  REGISTER_DECODER(CLLC,  cllc);
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index f365775..b958a6c 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -315,6 +315,7 @@ enum AVCodecID {
>  AV_CODEC_ID_SMVJPEG,
>  AV_CODEC_ID_APNG,
>  AV_CODEC_ID_DAALA,
> +AV_CODEC_ID_CFHD,
>  
>  /* various PCM "codecs" */
>  AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
> start of audio codecs
> diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
> new file mode 100644
> index 000..dc36889
> --- /dev/null
> +++ b/libavcodec/cfhd.c
> @@ -0,0 +1,565 @@
> +/*
> + * Copyright (c) 2015 Kieran Kunhya

2015-2016?

> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +/**
> + * @file
> + * CFHD Video Decoder
> + */
> +
> +#include "libavutil/buffer.h"
> +#include "libavutil/common.h"
> +#include "libavutil/intreadwrite.h"
> +#include "libavutil/imgutils.h"
> +#include "libavutil/opt.h"
> +
> +#include "avcodec.h"
> +#include "bswapdsp.h"

You're not using this. And if you were you'd need to add the relevant dependency
to configure.

> +#include "internal.h"
> +#include "bytestream.h"
> +#include "cfhd.h"
[...]

> +if (abs_tag8 >= 0x60 && abs_tag8 <= 0x6f) {
> +av_log(avctx, AV_LOG_DEBUG, "large len %x \n", ((tagu & 0xff) << 
> 16) | data);
> +} else if (tag == 20) {
> +av_log(avctx, AV_LOG_DEBUG, "Width %"PRIu16" \n", data);
> +avctx->width = data;
> +} else if (tag == 21) {
> +av_log(avctx, AV_LOG_DEBUG, "Height %"PRIu16" \n", data);
> +avctx->height = data;
> +} else if (tag == 101) {
> +av_log(avctx, AV_LOG_DEBUG, "Bits per component: %"PRIu16" \n", 
> data);
> +s->bpc = data;
> +} else if (tag == 12) {
> +av_log(avctx, AV_LOG_DEBUG, "Channel Count: %"PRIu16" \n", data);
> +s->channel_cnt = data;
> +if (data != 3) {
> +av_log(avctx, AV_LOG_ERROR, "Channel Count of %"PRIu16" is 
> unsupported\n", data);
> +ret = AVERROR_PATCHWELCOME;
> +break;
> +}
> +} else if (tag == 14) {
> +av_log(avctx, AV_LOG_DEBUG, "Subband Count: %"PRIu16" \n", data);
> +if (data != 10) {
> +av_log(avctx, AV_LOG_ERROR, "Subband Count of %"PRIu16" is 
> unsupported\n", data);
> +ret = AVERROR_PATCHWELCOME;
> +

Re: [FFmpeg-devel] [PATCH v4] lavf/matroskadec: Normalize noncompliant A_QUICKTIME/V_QUICKTIME private data

2016-01-09 Thread Mats Peterson

On 01/10/2016 03:05 AM, Mats Peterson wrote:


I suppose that ebml_read_binary() in matroskadec.c is the function used
to read the private data, and it allocates memory using
av_fast_padded_malloc() for this. Is it safe to reallocate a pointer
from this function then? So far I've had no problems, but of course I
want to be absolutely sure.


Probably not, since it eventually uses av_malloc() as well... sigh.

Mats

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


Re: [FFmpeg-devel] [PATCH v4] lavf/matroskadec: Normalize noncompliant A_QUICKTIME/V_QUICKTIME private data

2016-01-09 Thread Mats Peterson

On 01/10/2016 03:24 AM, Mats Peterson wrote:

I suppose that ebml_read_binary() in matroskadec.c is the function used
to read the private data, and it allocates memory using
av_fast_padded_malloc() for this. Is it safe to reallocate a pointer
from this function then? So far I've had no problems, but of course I
want to be absolutely sure.


Probably not, since it eventually uses av_malloc() as well... sigh.


Perhaps the best way is to use av_malloc() to allocate new memory, then 
copy the old private data to it, and finally free the pointer to the old 
memory?


Mats

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


Re: [FFmpeg-devel] [PATCH] avutil/mem: remove av_realloc / av_malloc incompatibility warning

2016-01-09 Thread Michael Niedermayer
On Tue, Apr 21, 2015 at 03:12:36PM +0200, Michael Niedermayer wrote:
> memalign() is not guranteed to be compatible with free() or realloc()
> and for platforms in this category we have --enable-memalign-hack
> (which should be enabled automatically if such system is detected)
> Trying to somehow half support systems that can free() memalign memory
> but not reallocate it seems not worth the amount of work needed to
> keep 2 then incompatible allocation systems and ensure their
> seperation. That is unless this would affect a major platform
> on which we want to avoid the memalign hack code
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavutil/mem.h |   24 
>  1 file changed, 24 deletions(-)

is anyone against this patch ?

people replace av_realloc by av_malloc, memcpy, av_free due to this
text
(example: [FFmpeg-devel] [PATCH v5] lavf/matroskadec: Normalize noncompliant 
A_QUICKTIME/V_QUICKTIME private data)

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire


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