[FFmpeg-devel] [PATCH 1/3] imgutils: Use designated initializers for AVClass

2015-11-20 Thread Timothy Gu
More readable and less breakable.
---
 libavutil/imgutils.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index 8956ae3..a189a50 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -236,11 +236,21 @@ typedef struct ImgUtils {
 void *log_ctx;
 } ImgUtils;
 
-static const AVClass imgutils_class = { "IMGUTILS", av_default_item_name, 
NULL, LIBAVUTIL_VERSION_INT, offsetof(ImgUtils, log_offset), offsetof(ImgUtils, 
log_ctx) };
+static const AVClass imgutils_class = {
+.class_name = "IMGUTILS",
+.item_name  = av_default_item_name,
+.version= LIBAVUTIL_VERSION_INT,
+.log_level_offset_offset   = offsetof(ImgUtils, log_offset),
+.parent_log_context_offset = offsetof(ImgUtils, log_ctx)
+};
 
 int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void 
*log_ctx)
 {
-ImgUtils imgutils = { &imgutils_class, log_offset, log_ctx };
+ImgUtils imgutils = {
+.class  = &imgutils_class,
+.log_offset = log_offset,
+.log_ctx= log_ctx
+};
 
 if ((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)
 return 0;
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] fate: fix concat demuxer extended test portability

2015-11-16 Thread Timothy Gu
tr -d '\r' ?

Timothy

El El lun, 16 de nov de 2015 a las 4:26 AM, Marton Balint 
escribió:

> Sed \r is not portable, it does not work on freebsd, hopefully awk will.
>
> Signed-off-by: Marton Balint 
> ---
>  tests/fate-run.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/fate-run.sh b/tests/fate-run.sh
> index 966cbe2..a23f1e3 100755
> --- a/tests/fate-run.sh
> +++ b/tests/fate-run.sh
> @@ -262,7 +262,7 @@ concat(){
>  awk "{gsub(/%SRCFILE%/, \"$sample\"); print}" $template > $concatfile
>
>  if [ "$mode" = "md5" ]; then
> -  run ffprobe${PROGSUF} -show_streams -show_packets -v 0 -fflags
> keepside -safe 0 $extra_args $concatfile | sed 's/\r//g' > $packetfile
> +  run ffprobe${PROGSUF} -show_streams -show_packets -v 0 -fflags
> keepside -safe 0 $extra_args $concatfile | awk '{gsub(/\r$/,""); print;}' >
> $packetfile
>do_md5sum $packetfile
>  else
>run ffprobe${PROGSUF} -show_streams -show_packets -v 0 -of
> compact=p=0:nk=1 -fflags keepside -safe 0 $extra_args $concatfile
> --
> 2.6.2
>
> ___
> 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] avformat: Add v210 demuxer

2015-11-09 Thread Timothy Gu
On Sun, Nov 8, 2015 at 7:24 AM Kieran Kunhya  wrote:

> On 8 November 2015 at 00:30, Timothy Gu  wrote:
> > Allows one to do:
> >
> > ffmpeg -s 1920x1080  -i blah.v210 ...
> > ffmpeg -s 1920x1080 -f v210x -i blah.yuv10 ...
> >
> > Fixes #1869.
>
> Looks good


Thanks for reviewing; applied.


> - I wonder if it can be merged with rawvideo though.
>

Technically it could be, but the code is simple enough to make any benefits
of sharing the code virtually nonexistent. IMO anyway.

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


Re: [FFmpeg-devel] [PATCH] avformat: Add v210 demuxer

2015-11-09 Thread Timothy Gu
On Mon, Nov 9, 2015 at 10:26 AM Calvin Walton 
wrote:

> The ffmpeg command-line tool actually maps the "-s" and "-r" input
> options to "video_size" and "framerate" respectively on the input
> format. This will work automatically.
>

Thanks for the clarification :)

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


Re: [FFmpeg-devel] [PATCH 1/2] aaccoder_twoloop: Mark sfdiff as av_unused

2015-11-09 Thread Timothy Gu
On Sun, Nov 8, 2015 at 9:28 AM Claudio Freire 
wrote:

> This particular piece of code is going to disappear soon, so not sure
> it's worth applying the patch.
>

Oh, okay then.


> Is the warning causing any troubles?
>

No, other than the minor annoyance it causes when compiling.

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


[FFmpeg-devel] [PATCH 2/2] genh: Removed unused variable coef_splitted

2015-11-07 Thread Timothy Gu
---
 libavformat/genh.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavformat/genh.c b/libavformat/genh.c
index 260e320..44862b3 100644
--- a/libavformat/genh.c
+++ b/libavformat/genh.c
@@ -40,7 +40,6 @@ static int genh_read_header(AVFormatContext *s)
 {
 unsigned start_offset, header_size, codec, coef_type, coef[2];
 GENHDemuxContext *c = s->priv_data;
-unsigned coef_splitted[2];
 int align, ch, ret;
 AVStream *st;
 
@@ -112,8 +111,7 @@ static int genh_read_header(AVFormatContext *s)
 coef[1]  = avio_rl32(s->pb);
 c->dsp_int_type  = avio_rl32(s->pb);
 coef_type= avio_rl32(s->pb);
-coef_splitted[0] = avio_rl32(s->pb);
-coef_splitted[1] = avio_rl32(s->pb);
+avio_rl64(s->pb); /* coef_splitted */
 
 if (st->codec->codec_id == AV_CODEC_ID_ADPCM_THP) {
 if (st->codec->channels > 2) {
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 1/2] aaccoder_twoloop: Mark sfdiff as av_unused

2015-11-07 Thread Timothy Gu
---
 libavcodec/aaccoder_twoloop.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aaccoder_twoloop.h b/libavcodec/aaccoder_twoloop.h
index e53257f..328d7c8 100644
--- a/libavcodec/aaccoder_twoloop.h
+++ b/libavcodec/aaccoder_twoloop.h
@@ -691,7 +691,7 @@ static void search_for_quantizers_twoloop(AVCodecContext 
*avctx,
 /** Check that there's no SF delta range violations */
 if (!sce->zeroes[w*16+g]) {
 if (prev != -1) {
-int sfdiff = sce->sf_idx[w*16+g] - prev + SCALE_DIFF_ZERO;
+av_unused int sfdiff = sce->sf_idx[w*16+g] - prev + 
SCALE_DIFF_ZERO;
 av_assert1(sfdiff >= 0 && sfdiff <= 2*SCALE_MAX_DIFF);
 }
 prev = sce->sf_idx[w*16+g];
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] Add pixblockdsp checkasm tests

2015-11-07 Thread Timothy Gu
On Sun, Nov 08, 2015 at 03:04:21AM +0100, Michael Niedermayer wrote:
> On Sat, Nov 07, 2015 at 03:58:28PM -0800, Timothy Gu wrote:
> > ---
> > 
> > Consolidates BUF_SIZE macros
> > 
> > ---
> >  tests/checkasm/Makefile  |   1 +
> >  tests/checkasm/checkasm.c|   3 ++
> >  tests/checkasm/checkasm.h|   1 +
> >  tests/checkasm/pixblockdsp.c | 107 
> > +++
> >  4 files changed, 112 insertions(+)
> >  create mode 100644 tests/checkasm/pixblockdsp.c
> 
> tested on linux32, linux64, qemu-mips, mingw
> works fine

Pushed. Thanks for testing.

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


Re: [FFmpeg-devel] [PATCH] avformat: Add v210 demuxer

2015-11-07 Thread Timothy Gu
On Sat, Nov 07, 2015 at 10:22:34PM -0300, James Almer wrote:
> On 11/7/2015 9:45 PM, Timothy Gu wrote:
> > +#define OFFSET(x) offsetof(V210DemuxerContext, x)
> > +#define DEC AV_OPT_FLAG_DECODING_PARAM
> > +static const AVOption v210_options[] = {
> > +{ "video_size", "set frame size", OFFSET(width), 
> > AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, DEC },
> 
> Isn't this what -s is for?
> 
> ffmpeg -s 1280x720 -f v210 -i INPUT

Well -s is only available for ffmpeg.c, unless I'm mistaken.

> 
> Also, in any case you're missing height.

AV_OPT_TYPE_IMAGE_SIZE works in an unorthodox way: it fills *(&width) with
the width and *(&width + 1) with the height. See
https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/opt.c#L269

In the struct an `int height;` follows `int width;`, so this should work
fine.

> 
> > +{ "framerate", "set frame rate", OFFSET(framerate), 
> > AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, DEC },
> 
> Same here, -r. Assuming it works for the input stream.

Ditto.

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


[FFmpeg-devel] [PATCH] avformat: Add v210 demuxer

2015-11-07 Thread Timothy Gu
Allows one to do:

ffmpeg -s 1920x1080  -i blah.v210 ...
ffmpeg -s 1920x1080 -f v210x -i blah.yuv10 ...

Fixes #1869.
---

Remove .yuv from the list of extensions.

---
 libavformat/Makefile |   2 +
 libavformat/allformats.c |   2 +
 libavformat/v210.c   | 133 +++
 3 files changed, 137 insertions(+)
 create mode 100644 libavformat/v210.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index f2326df..1a03e0c 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -447,6 +447,8 @@ OBJS-$(CONFIG_TTA_DEMUXER)   += tta.o apetag.o 
img2.o
 OBJS-$(CONFIG_TTY_DEMUXER)   += tty.o sauce.o
 OBJS-$(CONFIG_TXD_DEMUXER)   += txd.o
 OBJS-$(CONFIG_UNCODEDFRAMECRC_MUXER) += uncodedframecrcenc.o framehash.o
+OBJS-$(CONFIG_V210_DEMUXER)  += v210.o
+OBJS-$(CONFIG_V210X_DEMUXER) += v210.o
 OBJS-$(CONFIG_VAG_DEMUXER)   += vag.o
 OBJS-$(CONFIG_VC1_DEMUXER)   += rawdec.o vc1dec.o
 OBJS-$(CONFIG_VC1_MUXER) += rawenc.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 92e321c..8b8d9f2 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -314,6 +314,8 @@ void av_register_all(void)
 REGISTER_DEMUXER (TXD,  txd);
 REGISTER_DEMUXER (TTY,  tty);
 REGISTER_MUXER   (UNCODEDFRAMECRC,  uncodedframecrc);
+REGISTER_DEMUXER (V210, v210);
+REGISTER_DEMUXER (V210X,v210x);
 REGISTER_DEMUXER (VAG,  vag);
 REGISTER_MUXDEMUX(VC1,  vc1);
 REGISTER_MUXDEMUX(VC1T, vc1t);
diff --git a/libavformat/v210.c b/libavformat/v210.c
new file mode 100644
index 000..ab29171
--- /dev/null
+++ b/libavformat/v210.c
@@ -0,0 +1,133 @@
+/*
+ * Raw v210 video demuxer
+ * Copyright (c) 2015 Tiancheng "Timothy" Gu
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/imgutils.h"
+#include "libavutil/parseutils.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/opt.h"
+#include "internal.h"
+#include "avformat.h"
+
+typedef struct V210DemuxerContext {
+const AVClass *class; /**< Class for private options. */
+int width, height;/**< Integers describing video size, set by a 
private option. */
+AVRational framerate; /**< AVRational describing framerate, set by a 
private option. */
+} V210DemuxerContext;
+
+// v210 frame width is padded to multiples of 48
+#define GET_PACKET_SIZE(w, h) (((w + 47) / 48) * 48 * h * 8 / 3)
+
+static int v210_read_header(AVFormatContext *ctx)
+{
+V210DemuxerContext *s = ctx->priv_data;
+AVStream *st;
+
+st = avformat_new_stream(ctx, NULL);
+if (!st)
+return AVERROR(ENOMEM);
+
+st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+
+st->codec->codec_id = ctx->iformat->raw_codec_id;
+
+avpriv_set_pts_info(st, 64, s->framerate.den, s->framerate.num);
+
+st->codec->width= s->width;
+st->codec->height   = s->height;
+st->codec->pix_fmt  = ctx->iformat->raw_codec_id == AV_CODEC_ID_V210 ?
+  AV_PIX_FMT_YUV422P10 : AV_PIX_FMT_YUV422P16;
+st->codec->bit_rate = av_rescale_q(GET_PACKET_SIZE(s->width, s->height),
+   (AVRational){8,1}, st->time_base);
+
+return 0;
+}
+
+
+static int v210_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+int packet_size, ret, width, height;
+AVStream *st = s->streams[0];
+
+width = st->codec->width;
+height = st->codec->height;
+
+packet_size = GET_PACKET_SIZE(width, height);
+if (packet_size < 0)
+return -1;
+
+ret = av_get_packet(s->pb, pkt, packet_size);
+pkt->pts = pkt->dts = pkt->pos / packet_size;
+
+pkt->stream_index = 0;
+if (ret < 0)
+return ret;
+return 0;
+}
+
+#define OFFSET(x) offsetof(V210DemuxerContext, x)
+#define DEC AV_OPT_FLAG_DECODING_PARAM
+static const AVOption v210_options[] = {
+{ "video_size", "set frame size&quo

[FFmpeg-devel] [PATCH] avformat: Add v210 demuxer

2015-11-07 Thread Timothy Gu
Allows one to do:

ffmpeg -s 1920x1080  -i blah.v210 ...
ffmpeg -s 1920x1080 -f v210x -i blah.yuv10 ...

Fixes #1869.
---
 libavformat/Makefile |   2 +
 libavformat/allformats.c |   2 +
 libavformat/v210.c   | 133 +++
 3 files changed, 137 insertions(+)
 create mode 100644 libavformat/v210.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index f2326df..1a03e0c 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -447,6 +447,8 @@ OBJS-$(CONFIG_TTA_DEMUXER)   += tta.o apetag.o 
img2.o
 OBJS-$(CONFIG_TTY_DEMUXER)   += tty.o sauce.o
 OBJS-$(CONFIG_TXD_DEMUXER)   += txd.o
 OBJS-$(CONFIG_UNCODEDFRAMECRC_MUXER) += uncodedframecrcenc.o framehash.o
+OBJS-$(CONFIG_V210_DEMUXER)  += v210.o
+OBJS-$(CONFIG_V210X_DEMUXER) += v210.o
 OBJS-$(CONFIG_VAG_DEMUXER)   += vag.o
 OBJS-$(CONFIG_VC1_DEMUXER)   += rawdec.o vc1dec.o
 OBJS-$(CONFIG_VC1_MUXER) += rawenc.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 92e321c..8b8d9f2 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -314,6 +314,8 @@ void av_register_all(void)
 REGISTER_DEMUXER (TXD,  txd);
 REGISTER_DEMUXER (TTY,  tty);
 REGISTER_MUXER   (UNCODEDFRAMECRC,  uncodedframecrc);
+REGISTER_DEMUXER (V210, v210);
+REGISTER_DEMUXER (V210X,v210x);
 REGISTER_DEMUXER (VAG,  vag);
 REGISTER_MUXDEMUX(VC1,  vc1);
 REGISTER_MUXDEMUX(VC1T, vc1t);
diff --git a/libavformat/v210.c b/libavformat/v210.c
new file mode 100644
index 000..ab29171
--- /dev/null
+++ b/libavformat/v210.c
@@ -0,0 +1,133 @@
+/*
+ * Raw v210 video demuxer
+ * Copyright (c) 2015 Tiancheng "Timothy" Gu
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/imgutils.h"
+#include "libavutil/parseutils.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/opt.h"
+#include "internal.h"
+#include "avformat.h"
+
+typedef struct V210DemuxerContext {
+const AVClass *class; /**< Class for private options. */
+int width, height;/**< Integers describing video size, set by a 
private option. */
+AVRational framerate; /**< AVRational describing framerate, set by a 
private option. */
+} V210DemuxerContext;
+
+// v210 frame width is padded to multiples of 48
+#define GET_PACKET_SIZE(w, h) (((w + 47) / 48) * 48 * h * 8 / 3)
+
+static int v210_read_header(AVFormatContext *ctx)
+{
+V210DemuxerContext *s = ctx->priv_data;
+AVStream *st;
+
+st = avformat_new_stream(ctx, NULL);
+if (!st)
+return AVERROR(ENOMEM);
+
+st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+
+st->codec->codec_id = ctx->iformat->raw_codec_id;
+
+avpriv_set_pts_info(st, 64, s->framerate.den, s->framerate.num);
+
+st->codec->width= s->width;
+st->codec->height   = s->height;
+st->codec->pix_fmt  = ctx->iformat->raw_codec_id == AV_CODEC_ID_V210 ?
+  AV_PIX_FMT_YUV422P10 : AV_PIX_FMT_YUV422P16;
+st->codec->bit_rate = av_rescale_q(GET_PACKET_SIZE(s->width, s->height),
+   (AVRational){8,1}, st->time_base);
+
+return 0;
+}
+
+
+static int v210_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+int packet_size, ret, width, height;
+AVStream *st = s->streams[0];
+
+width = st->codec->width;
+height = st->codec->height;
+
+packet_size = GET_PACKET_SIZE(width, height);
+if (packet_size < 0)
+return -1;
+
+ret = av_get_packet(s->pb, pkt, packet_size);
+pkt->pts = pkt->dts = pkt->pos / packet_size;
+
+pkt->stream_index = 0;
+if (ret < 0)
+return ret;
+return 0;
+}
+
+#define OFFSET(x) offsetof(V210DemuxerContext, x)
+#define DEC AV_OPT_FLAG_DECODING_PARAM
+static const AVOption v210_options[] = {
+{ "video_size", "set frame size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE,

[FFmpeg-devel] [PATCH] avformat: Add v210 demuxer

2015-11-07 Thread Timothy Gu
Allows one to do:

ffmpeg -s 1920x1080  -i blah.v210 ...
ffmpeg -s 1920x1080 -f v210x -i blah.yuv10 ...

Fixes #1869.
---
 libavformat/Makefile |   2 +
 libavformat/allformats.c |   2 +
 libavformat/v210.c   | 133 +++
 3 files changed, 137 insertions(+)
 create mode 100644 libavformat/v210.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index f2326df..1a03e0c 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -447,6 +447,8 @@ OBJS-$(CONFIG_TTA_DEMUXER)   += tta.o apetag.o 
img2.o
 OBJS-$(CONFIG_TTY_DEMUXER)   += tty.o sauce.o
 OBJS-$(CONFIG_TXD_DEMUXER)   += txd.o
 OBJS-$(CONFIG_UNCODEDFRAMECRC_MUXER) += uncodedframecrcenc.o framehash.o
+OBJS-$(CONFIG_V210_DEMUXER)  += v210.o
+OBJS-$(CONFIG_V210X_DEMUXER) += v210.o
 OBJS-$(CONFIG_VAG_DEMUXER)   += vag.o
 OBJS-$(CONFIG_VC1_DEMUXER)   += rawdec.o vc1dec.o
 OBJS-$(CONFIG_VC1_MUXER) += rawenc.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 92e321c..8b8d9f2 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -314,6 +314,8 @@ void av_register_all(void)
 REGISTER_DEMUXER (TXD,  txd);
 REGISTER_DEMUXER (TTY,  tty);
 REGISTER_MUXER   (UNCODEDFRAMECRC,  uncodedframecrc);
+REGISTER_DEMUXER (V210, v210);
+REGISTER_DEMUXER (V210X,v210x);
 REGISTER_DEMUXER (VAG,  vag);
 REGISTER_MUXDEMUX(VC1,  vc1);
 REGISTER_MUXDEMUX(VC1T, vc1t);
diff --git a/libavformat/v210.c b/libavformat/v210.c
new file mode 100644
index 000..c506d5b
--- /dev/null
+++ b/libavformat/v210.c
@@ -0,0 +1,133 @@
+/*
+ * Raw v210 video demuxer
+ * Copyright (c) 2015 Tiancheng "Timothy" Gu
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/imgutils.h"
+#include "libavutil/parseutils.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/opt.h"
+#include "internal.h"
+#include "avformat.h"
+
+typedef struct V210DemuxerContext {
+const AVClass *class; /**< Class for private options. */
+int width, height;/**< Integers describing video size, set by a 
private option. */
+AVRational framerate; /**< AVRational describing framerate, set by a 
private option. */
+} V210DemuxerContext;
+
+// v210 frame width is padded to multiples of 48
+#define GET_PACKET_SIZE(w, h) (((w + 47) / 48) * 48 * h * 8 / 3)
+
+static int v210_read_header(AVFormatContext *ctx)
+{
+V210DemuxerContext *s = ctx->priv_data;
+AVStream *st;
+
+st = avformat_new_stream(ctx, NULL);
+if (!st)
+return AVERROR(ENOMEM);
+
+st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+
+st->codec->codec_id = ctx->iformat->raw_codec_id;
+
+avpriv_set_pts_info(st, 64, s->framerate.den, s->framerate.num);
+
+st->codec->width= s->width;
+st->codec->height   = s->height;
+st->codec->pix_fmt  = ctx->iformat->raw_codec_id == AV_CODEC_ID_V210 ?
+  AV_PIX_FMT_YUV422P10 : AV_PIX_FMT_YUV422P16;
+st->codec->bit_rate = av_rescale_q(GET_PACKET_SIZE(s->width, s->height),
+   (AVRational){8,1}, st->time_base);
+
+return 0;
+}
+
+
+static int v210_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+int packet_size, ret, width, height;
+AVStream *st = s->streams[0];
+
+width = st->codec->width;
+height = st->codec->height;
+
+packet_size = GET_PACKET_SIZE(width, height);
+if (packet_size < 0)
+return -1;
+
+ret = av_get_packet(s->pb, pkt, packet_size);
+pkt->pts = pkt->dts = pkt->pos / packet_size;
+
+pkt->stream_index = 0;
+if (ret < 0)
+return ret;
+return 0;
+}
+
+#define OFFSET(x) offsetof(V210DemuxerContext, x)
+#define DEC AV_OPT_FLAG_DECODING_PARAM
+static const AVOption v210_options[] = {
+{ "video_size", "set frame size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE,

[FFmpeg-devel] [PATCH] Add pixblockdsp checkasm tests

2015-11-07 Thread Timothy Gu
---

Consolidates BUF_SIZE macros

---
 tests/checkasm/Makefile  |   1 +
 tests/checkasm/checkasm.c|   3 ++
 tests/checkasm/checkasm.h|   1 +
 tests/checkasm/pixblockdsp.c | 107 +++
 4 files changed, 112 insertions(+)
 create mode 100644 tests/checkasm/pixblockdsp.c

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index c29ceef..1c0290b 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -5,6 +5,7 @@ AVCODECOBJS-$(CONFIG_FLACDSP)  += flacdsp.o
 AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o
 AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o
 AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o
+AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o
 AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o
 AVCODECOBJS-$(CONFIG_VP9_DECODER) += vp9dsp.o
 
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index e875120..3548bb3 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -76,6 +76,9 @@ static const struct {
 #if CONFIG_JPEG2000_DECODER
 { "jpeg2000dsp", checkasm_check_jpeg2000dsp },
 #endif
+#if CONFIG_PIXBLOCKDSP
+{ "pixblockdsp", checkasm_check_pixblockdsp },
+#endif
 #if CONFIG_V210_ENCODER
 { "v210enc", checkasm_check_v210enc },
 #endif
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 1775a25..73b7e42 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -35,6 +35,7 @@ void checkasm_check_flacdsp(void);
 void checkasm_check_h264pred(void);
 void checkasm_check_h264qpel(void);
 void checkasm_check_jpeg2000dsp(void);
+void checkasm_check_pixblockdsp(void);
 void checkasm_check_v210enc(void);
 void checkasm_check_vp9dsp(void);
 
diff --git a/tests/checkasm/pixblockdsp.c b/tests/checkasm/pixblockdsp.c
new file mode 100644
index 000..70e7f74
--- /dev/null
+++ b/tests/checkasm/pixblockdsp.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2015 Tiancheng "Timothy" Gu
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include 
+#include "checkasm.h"
+#include "libavcodec/pixblockdsp.h"
+#include "libavutil/common.h"
+#include "libavutil/internal.h"
+#include "libavutil/intreadwrite.h"
+
+#define BUF_UNITS 8
+#define BUF_SIZE (BUF_UNITS * 128 + BUF_UNITS)
+
+#define randomize_buffers() \
+do {\
+int i;  \
+for (i = 0; i < BUF_SIZE; i += 4) { \
+uint32_t r = rnd(); \
+AV_WN32A(src10 + i, r); \
+AV_WN32A(src11 + i, r); \
+r = rnd();  \
+AV_WN32A(src20 + i, r); \
+AV_WN32A(src21 + i, r); \
+r = rnd();  \
+AV_WN32A(dst0_ + i, r); \
+AV_WN32A(dst1_ + i, r); \
+}   \
+} while (0)
+
+#define check_get_pixels(type) 
\
+do {   
\
+int i; 
\
+declare_func(void, int16_t *block, const uint8_t *pixels, ptrdiff_t 
line_size);\
+   
\
+for (i = 0; i < BUF_UNITS; i++) {  
\
+int src_offset = i * 64 * sizeof(type) + i; /* Test various 
alignments */  \
+int dst_offset = i * 64; /* dst must be aligned */ 
\
+randomize_buffers();   
\
+call_ref(dst0 + dst_offset, src10 + src_offset, 8);
\
+call_new(dst1 + dst_offset, src11 + src_offset, 8);
\
+if (memcmp(src10, src11, BUF_SIZE)|| memcmp(dst0, dst1, BUF_SIZE)) 
\
+fail();  

Re: [FFmpeg-devel] [PATCH] jvdec: avoid unsized overflow in comparison

2015-11-06 Thread Timothy Gu
On Fri, Nov 06, 2015 at 09:11:40PM +0100, Andreas Cadhalpun wrote:
> Subject: [FFmpeg-devel] [PATCH] jvdec: avoid unsized overflow in comparison

*unsigned

[...]

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


Re: [FFmpeg-devel] [PATCH] web/download: point to the official Debian/Ubuntu packages

2015-11-06 Thread Timothy Gu
On Fri, Nov 06, 2015 at 08:18:39PM +0100, Andreas Cadhalpun wrote:
[...]
> diff --git a/src/download b/src/download
> index 5691fbd..6d3517e 100644
> --- a/src/download
> +++ b/src/download
> @@ -53,13 +53,22 @@
>  
>  Linux Packages
>  
> +   href="https://tracker.debian.org/pkg/ffmpeg";>
> +Debian ??? Official packages for 
> Stable-Backports, Testing, Unstable
> +(amd64, arm64, armel, armhf, i386, kfreebsd-amd64, 
> kfreebsd-i386, mips, mipsel, powerpc, ppc64el, s390x)

What do you think of removing the architecture list? It's not very
helpful for most people reading this page, and feels out-of-place.

[...]

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


Re: [FFmpeg-devel] [PATCH 1/2] pixblockdsp: x86: Condense diff_pixels_* to a shared macro

2015-11-06 Thread Timothy Gu
On Sun, Nov 1, 2015 at 8:59 AM Timothy Gu  wrote:

> ---
>  libavcodec/x86/pixblockdsp.asm | 66
> --
>  1 file changed, 31 insertions(+), 35 deletions(-)
>

Ping set.

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


Re: [FFmpeg-devel] [PATCH] swresample/resample: improve bessel function accuracy

2015-11-03 Thread Timothy Gu
On Tue, Nov 3, 2015 at 4:47 AM Ganesh Ajjanagadde > - GCC vectorization
slows down compilation A LOT in all versions. The newer

> > the worse.
>
> A ~ 20% slowdown on a build for a ~ 20% improvement in an overall FATE
> bench - sounds like a win to me especially with ccache.


Of course, but unfortunately the FATE improvement is on the order of 1-2%,
i.e. near negligible, rather than ~20%.


>
> > - If you are developing, use clang, and DON'T use GCC 5 with
> vectorization.
>
> This is an opinion, so I will state mine here: if you are developing
> use ccache + GCC > ccache + clang > clang = gcc. Reason for the first
> is due to the terrible interaction ccache has with clang. I still will
> use GCC 5.2 + ccache (with vectorization) for my builds, and will
> inform Arch packagers once we have finalized configure in this respect
> :).
>

Personally ccache has proved itself to be more of a trouble than its worth
in my experiences, but if you have a fast enough machine or ccache working
that it doesn't matter.


>
> > - For release builds, an option to turn it on (or rather to not turn it
> > off) would be helpful; but if you really care about performance _that_
> much
> > then you should probably use some other compilers instead.
>
> No, not true at all. Why do we bother with asm? Many times for such
> "last mile" optimizations. A 20% improvement in FATE across board is
> nothing to sneeze at given what I have seen in FFmpeg.


Again, the improvement is more like 2%.

Furthermore, barring ICC (for Intel), Clang and GCC are among the best
> quality compilers today. I don't know about what "other compilers" you
> are referring to.
>

I meant ICC, which has a much more mature vectorizer.

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


Re: [FFmpeg-devel] [PATCH] swresample/resample: improve bessel function accuracy

2015-11-02 Thread Timothy Gu
On Mon, Nov 2, 2015 at 8:23 PM Rostislav Pehlivanov 
wrote:

> >if one removes the crippling
> >-fno-tree-vectorize
> Yes, I think a config option to turn this flag on (like the unsafe
> bitstream reader) would be good. Defaulting to off by default if it doesn't
> break anything for at least a few people (and compilers) who test it. It's
> not a big performance impact but every little bit counts nowadays.
>

FWIW, I recently (i.e. 2 days ago) did some tests with auto-vectorization
and a few compilers. Fortunately, none of the compilers I tested caused any
miscompilation, when purely measured by FATE:

compiling:
clang3.7 4m3.034s
gcc5vectorize 5m50.637s (1.14x gcc5)
gcc5 5m7.262s
gcc4.9vectorize 5m29.669s (1.11x gcc4.9)
gcc4.9 4m54.602s
gcc4.8vectorize 5m18.848s (1.09x gcc4.8)
gcc4.8 4m53.940s

FATE:
clang3.7 3m13.923s
gcc5vectorize 3m5.988s (0.980x gcc5)
gcc5 3m9.618s
gcc4.9vectorize 3m12.880s (0.983x gcc4.9)
gcc4.9 3m16.563s
gcc4.8vectorize 3m10.321s (0.993x gcc4.8)
gcc4.8 3m11.608s

Tested with:
- Debian jessie/stable/8.2
- Dual-core Haswell i7 ultra low voltage
- clang-3.7 3.7.0-svn251177-1~exp1 (from the offical clang apt repo)
- gcc-5 (Debian 5.2.1-22) 5.2.1 20151010 (Debian testing stock)
- gcc-4.9 (Debian 4.9.2-10) 4.9.2 (Debian stable stock)
- gcc-4.8 (Debian 4.8.4-1) 4.8.4 (Debian stable stock)

Note that FATE is probably the worst benchmark one can find, but it does
show something.

Some observations:

- GCC vectorization slows down compilation A LOT in all versions. The newer
the worse.
- If you are developing, use clang, and DON'T use GCC 5 with vectorization.
- For release builds, an option to turn it on (or rather to not turn it
off) would be helpful; but if you really care about performance _that_ much
then you should probably use some other compilers instead.

FYI, as I have told Ganesh so in our private exchanges, I did also test
vectorization on GCC 4.6 on a Ubuntu 12.04/Precise box, which miscompiled
the code hilariously, _and_ made the code slower, just as illustrated in
Mans's commit message.

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


Re: [FFmpeg-devel] [PATCH] boxblur: Templatize blur{8,16}

2015-11-01 Thread Timothy Gu
On Sun, Nov 1, 2015 at 4:45 PM Michael Niedermayer 
wrote:

> On Sun, Nov 01, 2015 at 10:40:03AM -0800, Timothy Gu wrote:
> > ---
> >  libavfilter/vf_boxblur.c | 110
> +++
> >  1 file changed, 44 insertions(+), 66 deletions(-)
>
> LGTM
> thx
>

Pushed, thanks for the review.

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


Re: [FFmpeg-devel] [PATCH] boxblur: Templatize blur{8,16}

2015-11-01 Thread Timothy Gu
On Sun, Nov 1, 2015 at 11:10 AM Ganesh Ajjanagadde  wrote:

> Have not tested, but just a general comment. Personally, I follow the
> twice repition is ok, thrice means it is good to factor out. I would
> have been happier if the diff-stat was better than 44+/66- in terms of
> deletions.


The most significant reason why the addition is as high as it is is the
comment describing the algorithm. Without taking into account the 14-line
comment, the diffstat would be 30+/52-, i.e. 1.73x.

The only part of the function that is different is the prototype, which I
believe is small enough to warrant a refactoring.

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


[FFmpeg-devel] [PATCH] boxblur: Templatize blur{8,16}

2015-11-01 Thread Timothy Gu
---
 libavfilter/vf_boxblur.c | 110 +++
 1 file changed, 44 insertions(+), 66 deletions(-)

diff --git a/libavfilter/vf_boxblur.c b/libavfilter/vf_boxblur.c
index ef01cf9..6934076 100644
--- a/libavfilter/vf_boxblur.c
+++ b/libavfilter/vf_boxblur.c
@@ -204,75 +204,53 @@ static int config_input(AVFilterLink *inlink)
 return 0;
 }
 
-static inline void blur8(uint8_t *dst, int dst_step, const uint8_t *src, int 
src_step,
-int len, int radius)
-{
-/* Naive boxblur would sum source pixels from x-radius .. x+radius
- * for destination pixel x. That would be O(radius*width).
- * If you now look at what source pixels represent 2 consecutive
- * output pixels, then you see they are almost identical and only
- * differ by 2 pixels, like:
- * src0   1
- * dst0   1
- * src11
- * dst11
- * src0-src1  1   -1
- * so when you know one output pixel you can find the next by just adding
- * and subtracting 1 input pixel.
- * The following code adopts this faster variant.
- */
-const int length = radius*2 + 1;
-const int inv = ((1<<16) + length/2)/length;
-int x, sum = src[radius*src_step];
-
-for (x = 0; x < radius; x++)
-sum += src[x*src_step]<<1;
-
-sum = sum*inv + (1<<15);
-
-for (x = 0; x <= radius; x++) {
-sum += (src[(radius+x)*src_step] - src[(radius-x)*src_step])*inv;
-dst[x*dst_step] = sum>>16;
-}
-
-for (; x < len-radius; x++) {
-sum += (src[(radius+x)*src_step] - src[(x-radius-1)*src_step])*inv;
-dst[x*dst_step] = sum >>16;
-}
-
-for (; x < len; x++) {
-sum += (src[(2*len-radius-x-1)*src_step] - 
src[(x-radius-1)*src_step])*inv;
-dst[x*dst_step] = sum>>16;
-}
+/* Naive boxblur would sum source pixels from x-radius .. x+radius
+ * for destination pixel x. That would be O(radius*width).
+ * If you now look at what source pixels represent 2 consecutive
+ * output pixels, then you see they are almost identical and only
+ * differ by 2 pixels, like:
+ * src0   1
+ * dst0   1
+ * src11
+ * dst11
+ * src0-src1  1   -1
+ * so when you know one output pixel you can find the next by just adding
+ * and subtracting 1 input pixel.
+ * The following code adopts this faster variant.
+ */
+#define BLUR(type, depth)   \
+static inline void blur ## depth(type *dst, int dst_step, const type *src,  \
+ int src_step, int len, int radius) \
+{   \
+const int length = radius*2 + 1;\
+const int inv = ((1<<16) + length/2)/length;\
+int x, sum = src[radius*src_step];  \
+\
+for (x = 0; x < radius; x++)\
+sum += src[x*src_step]<<1;  \
+\
+sum = sum*inv + (1<<15);\
+\
+for (x = 0; x <= radius; x++) { \
+sum += (src[(radius+x)*src_step] - src[(radius-x)*src_step])*inv;   \
+dst[x*dst_step] = sum>>16;  \
+}   \
+\
+for (; x < len-radius; x++) {   \
+sum += (src[(radius+x)*src_step] - src[(x-radius-1)*src_step])*inv; \
+dst[x*dst_step] = sum >>16; \
+}   \
+\
+for (; x < len; x++) {  \
+sum += (src[(2*len-radius-x-1)*src_step] - 
src[(x-radius-1)*src_step])*inv; \
+dst[x*dst_step] = sum>>16;  \
+}   \
 }
 
-static inline void blur16(uint16_t *dst, int dst_step, const uint16_t *src, 
int src_step,
-  int len, int radius)
-{
-const int length = radius*2 + 1;
-const int inv = ((1<<16) + length/2)/length;
-int x, sum = src[radius*src_step];
-
-for (x = 0; x < radius; x++)
-sum += src[x*src_step]<<1;
-
-sum = sum*inv + (1<<15);
-
-for (x = 0; x <= radius; x++) {
-  

[FFmpeg-devel] [PATCH 2/2] Add pixblockdsp checkasm tests

2015-11-01 Thread Timothy Gu
---
 tests/checkasm/Makefile  |   1 +
 tests/checkasm/checkasm.c|   3 ++
 tests/checkasm/checkasm.h|   1 +
 tests/checkasm/pixblockdsp.c | 107 +++
 4 files changed, 112 insertions(+)
 create mode 100644 tests/checkasm/pixblockdsp.c

diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile
index c29ceef..1c0290b 100644
--- a/tests/checkasm/Makefile
+++ b/tests/checkasm/Makefile
@@ -5,6 +5,7 @@ AVCODECOBJS-$(CONFIG_FLACDSP)  += flacdsp.o
 AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o
 AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o
 AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o
+AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o
 AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o
 AVCODECOBJS-$(CONFIG_VP9_DECODER) += vp9dsp.o
 
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index e875120..3548bb3 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -76,6 +76,9 @@ static const struct {
 #if CONFIG_JPEG2000_DECODER
 { "jpeg2000dsp", checkasm_check_jpeg2000dsp },
 #endif
+#if CONFIG_PIXBLOCKDSP
+{ "pixblockdsp", checkasm_check_pixblockdsp },
+#endif
 #if CONFIG_V210_ENCODER
 { "v210enc", checkasm_check_v210enc },
 #endif
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 1775a25..73b7e42 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -35,6 +35,7 @@ void checkasm_check_flacdsp(void);
 void checkasm_check_h264pred(void);
 void checkasm_check_h264qpel(void);
 void checkasm_check_jpeg2000dsp(void);
+void checkasm_check_pixblockdsp(void);
 void checkasm_check_v210enc(void);
 void checkasm_check_vp9dsp(void);
 
diff --git a/tests/checkasm/pixblockdsp.c b/tests/checkasm/pixblockdsp.c
new file mode 100644
index 000..d59d162
--- /dev/null
+++ b/tests/checkasm/pixblockdsp.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2015 Tiancheng "Timothy" Gu
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include 
+#include "checkasm.h"
+#include "libavcodec/pixblockdsp.h"
+#include "libavutil/common.h"
+#include "libavutil/internal.h"
+#include "libavutil/intreadwrite.h"
+
+#define BUF_SIZE 512
+#define TOTAL_BUF_SIZE FFALIGN(BUF_SIZE * 2 + BUF_SIZE / 64, 4)
+
+#define randomize_buffers() \
+do {\
+int i;  \
+for (i = 0; i < TOTAL_BUF_SIZE; i += 4) { \
+uint32_t r = rnd(); \
+AV_WN32A(src10 + i, r); \
+AV_WN32A(src11 + i, r); \
+r = rnd();  \
+AV_WN32A(src20 + i, r); \
+AV_WN32A(src21 + i, r); \
+r = rnd();  \
+AV_WN32A(dst0_ + i, r); \
+AV_WN32A(dst1_ + i, r); \
+}   \
+} while (0)
+
+#define check_get_pixels(type) 
\
+do {   
\
+int i; 
\
+declare_func(void, int16_t *block, const uint8_t *pixels, ptrdiff_t 
line_size);\
+   
\
+for (i = 0; i < BUF_SIZE / 64; i++) {  
\
+int src_offset = i * 64 * sizeof(type) + i; /* Test various 
alignments */  \
+int dst_offset = i * 64; /* dst must be aligned */ 
\
+randomize_buffers();   
\
+call_ref(dst0 + dst_offset, src10 + src_offset, 8);
\
+call_new(dst1 + dst_offset, src11 + src_offset, 8);
\
+if (memcmp(src10, src11, TOTAL_BUF_SIZE)|| memcmp(dst0, dst1, 
TOTAL_BUF_SIZE)) \
+fail();  

[FFmpeg-devel] [PATCH 1/2] pixblockdsp: x86: Condense diff_pixels_* to a shared macro

2015-11-01 Thread Timothy Gu
---
 libavcodec/x86/pixblockdsp.asm | 66 --
 1 file changed, 31 insertions(+), 35 deletions(-)

diff --git a/libavcodec/x86/pixblockdsp.asm b/libavcodec/x86/pixblockdsp.asm
index 7c5377b..a7d9816 100644
--- a/libavcodec/x86/pixblockdsp.asm
+++ b/libavcodec/x86/pixblockdsp.asm
@@ -80,54 +80,50 @@ cglobal get_pixels, 3, 4, 5
 mova  [r0+0x70], m3
 RET
 
-INIT_MMX mmx
 ; void ff_diff_pixels_mmx(int16_t *block, const uint8_t *s1, const uint8_t *s2,
 ; int stride);
-cglobal diff_pixels, 4,5
-movsxdifnidn r3, r3d
-pxor m7, m7
-add  r0,  128
-mov  r4, -128
-.loop:
-mova m0, [r1]
-mova m2, [r2]
-mova m1, m0
-mova m3, m2
-punpcklbwm0, m7
-punpckhbwm1, m7
-punpcklbwm2, m7
-punpckhbwm3, m7
-psubwm0, m2
-psubwm1, m3
-mova  [r0+r4+0], m0
-mova  [r0+r4+8], m1
-add  r1, r3
-add  r2, r3
-add  r4, 16
-jne .loop
-REP_RET
-
-INIT_XMM sse2
-cglobal diff_pixels, 4, 5, 5
+%macro DIFF_PIXELS 0
+cglobal diff_pixels, 4,5,5
 movsxdifnidn r3, r3d
 pxor m4, m4
 add  r0,  128
 mov  r4, -128
 .loop:
-movh m0, [r1]
-movh m2, [r2]
-movh m1, [r1+r3]
-movh m3, [r2+r3]
+movq m0, [r1]
+movq m2, [r2]
+%if mmsize == 8
+movq m1, m0
+movq m3, m2
+punpcklbwm0, m4
+punpckhbwm1, m4
+punpcklbwm2, m4
+punpckhbwm3, m4
+%else
+movq m1, [r1+r3]
+movq m3, [r2+r3]
 punpcklbwm0, m4
 punpcklbwm1, m4
 punpcklbwm2, m4
 punpcklbwm3, m4
+%endif
 psubwm0, m2
 psubwm1, m3
-mova [r0+r4+0 ], m0
-mova [r0+r4+16], m1
+mova  [r0+r4+0], m0
+mova  [r0+r4+mmsize], m1
+%if mmsize == 8
+add  r1, r3
+add  r2, r3
+%else
 lea  r1, [r1+r3*2]
 lea  r2, [r2+r3*2]
-add  r4, 32
+%endif
+add  r4, 2 * mmsize
 jne .loop
-RET
+REP_RET
+%endmacro
+
+INIT_MMX mmx
+DIFF_PIXELS
+
+INIT_XMM sse2
+DIFF_PIXELS
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] pixblockdsp: Use memcpy for get_pixels_16_c

2015-10-31 Thread Timothy Gu
On Tue, Oct 20, 2015 at 11:29 PM Michael Niedermayer 
wrote:

> > diff --git a/libavcodec/pixblockdsp.c b/libavcodec/pixblockdsp.c
> > index 322e1dd..0f23d8a 100644
> > --- a/libavcodec/pixblockdsp.c
> > +++ b/libavcodec/pixblockdsp.c
> > @@ -23,12 +23,38 @@
> >  #include "avcodec.h"
> >  #include "pixblockdsp.h"
> >
> > -#define BIT_DEPTH 16
> > -#include "pixblockdsp_template.c"
> > -#undef BIT_DEPTH
> > +static void get_pixels_16_c(int16_t *av_restrict block, const uint8_t
> *pixels,
> > +ptrdiff_t line_size)
> > +{
> > +memcpy(block + 0 * 8, pixels + 0 * line_size, sizeof(int16_t) * 8);
> > +memcpy(block + 1 * 8, pixels + 1 * line_size, sizeof(int16_t) * 8);
> > +memcpy(block + 2 * 8, pixels + 2 * line_size, sizeof(int16_t) * 8);
> > +memcpy(block + 3 * 8, pixels + 3 * line_size, sizeof(int16_t) * 8);
> > +memcpy(block + 4 * 8, pixels + 4 * line_size, sizeof(int16_t) * 8);
> > +memcpy(block + 5 * 8, pixels + 5 * line_size, sizeof(int16_t) * 8);
> > +memcpy(block + 6 * 8, pixels + 6 * line_size, sizeof(int16_t) * 8);
> > +memcpy(block + 7 * 8, pixels + 7 * line_size, sizeof(int16_t) * 8);
>
> AV_COPY128(U)
>
Changed.

>
>
> > +}
> > +
> > +static void get_pixels_8_c(int16_t *av_restrict block, const uint8_t
> *pixels,
> > +   ptrdiff_t line_size)
> > +{
> > +int i;
> >
> > -#define BIT_DEPTH 8
> > -#include "pixblockdsp_template.c"
> > +/* read the pixels */
> > +for (i = 0; i < 8; i++) {
> > +block[0] = pixels[0];
> > +block[1] = pixels[1];
> > +block[2] = pixels[2];
> > +block[3] = pixels[3];
> > +block[4] = pixels[4];
> > +block[5] = pixels[5];
> > +block[6] = pixels[6];
> > +block[7] = pixels[7];
>
> AV_COPY64(U)

They are not equivalent.

Pushed.

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


Re: [FFmpeg-devel] Can we drop OpenJPEG 1.5 in favor of 2.x?

2015-10-24 Thread Timothy Gu
On Sat, Oct 24, 2015 at 11:03 AM James Almer  wrote:

> Gentoo and Debian both seem to ship it. Arch does as well but on their
> Community repository (ffmpeg adopting it may be incentive enough for them
> to move it to Extra).
>
In fact, at least two of the reverse dependencies (out of 8, not counting
duplicates) of the Arch openjpeg package already support openjpeg2 (poppler
and gst-plugins-bad).

I would prefer if we keep compat for both since Ubuntu 14.04 LTS doesn't
have openjpeg2 yet, and that's unfortunately not going away any time soon.

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


Re: [FFmpeg-devel] [PATCH] avcodec/huffman: replace qsort with AV_QSORT

2015-10-22 Thread Timothy Gu
On Thu, Oct 22, 2015 at 5:01 PM Ganesh Ajjanagadde 
wrote:

> Sample benchmark (x86-64, Haswell, GNU/Linux), fraps-v2 from FATE:
> new:
> 280110 decicycles in qsort,   1 runs,  0 skips
> 268260 decicycles in qsort,   2 runs,  0 skips
>
> old:
> 1469910 decicycles in qsort,   1 runs,  0 skips
>  952950 decicycles in qsort,   2 runs,  0 skips
>

Usually it takes more than 2 runs to make sure something is faster than the
other (try -stream_loop 1 on the input).

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


Re: [FFmpeg-devel] [PATCH] vc1dsp: Port ff_vc1_put_ver_16b_shift2_mmx to yasm

2015-10-21 Thread Timothy Gu
On Wed, Oct 21, 2015 at 10:46 AM Christophe Gisquet <
christophe.gisq...@gmail.com> wrote:

> 2015-10-18 2:47 GMT+02:00 Timothy Gu :
> > This function is only used within other inline asm functions, hence the
> > HAVE_MMX_INLINE guard. Per recent discussions, we should not worry about
> > the performance of inline asm-only builds.
>
> On a quick glance, looks good.
>

FATE passes on Linux, both 64-bit and 32-bit, so pushed. Will find out
about WIN64 soon enough.

[...]

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


Re: [FFmpeg-devel] [PATCH] huffyuvencdsp: Add ff_diff_bytes_{sse2, avx2}

2015-10-21 Thread Timothy Gu
On Wed, Oct 21, 2015 at 10:32 AM Timothy Gu  wrote:

> On Tue, Oct 20, 2015 at 7:36 PM James Almer  wrote:
>
>> On 10/20/2015 10:32 PM, Timothy Gu wrote:
>>
> > +; mov type used for src1q, dstq, first reg, second reg
>> > +%macro DIFF_BYTES_LOOP_CORE 4
>> > +%if regsize != 16
>>
>> %if mmsize != 16
>>
>> By checking regsize you're using the SSE2 version in the AVX2 xmm loop.
>> Check
>> for mmsize instead, which it's always 32 since you used INIT_YMM.
>>
>
> Fixed locally.
>

Reviewed by Henrik on IRC and pushed.

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


Re: [FFmpeg-devel] [PATCH] huffyuvencdsp: Add ff_diff_bytes_{sse2, avx2}

2015-10-21 Thread Timothy Gu
On Tue, Oct 20, 2015 at 7:36 PM James Almer  wrote:

> On 10/20/2015 10:32 PM, Timothy Gu wrote:
> > +; mov type used for src1q, dstq, first reg, second reg
> > +%macro DIFF_BYTES_LOOP_CORE 4
> > +%if regsize != 16
>
> %if mmsize != 16
>
> By checking regsize you're using the SSE2 version in the AVX2 xmm loop.
> Check
> for mmsize instead, which it's always 32 since you used INIT_YMM.
>

Fixed locally.

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


Re: [FFmpeg-devel] forcing ints to be 64 bits, possible new FATE client idea

2015-10-20 Thread Timothy Gu
On Tue, Oct 20, 2015 at 7:09 PM Ganesh Ajjanagadde  wrote:

> Hi all,
>
> It is known that there exist at least certain parts of the codebase
> that do not work correctly if ints are 64 bits. One of them I noticed
> was in avutil/intmath.h: ff_ctz_c does not compute the right thing if
> int is 64 bits. This is true both before and after the De-Bruijn
> optimization.
>
> A more interesting (and serious) question is whether FATE is broken if
> int's are 64 bits. I did some digging, and found the following from
> "The Definitive Guide to GCC" - On GCC prior to 4.x, there was a flag
> -mint64, documented as follows (see e.g
> https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc.pdf):
> "Force int and long types to be 64 bits wide. See -mlong32 for an
> explanation of the default and the way that the pointer size is
> determined".
>
> This should be helpful in setting up a FATE client to test (and
> possibly fix) bad code that assumed int = 32 bits. I myself can't
> easily run such an outdated GCC, but I noticed a bunch of clients
> running GCC < 4.0 where this may be set up.
>

For lack of milder wording, this is a terrible idea.

FATE is set up, not to test every single possible combination of compiler,
compiler flags, and operating system, but to make sure FFmpeg works on the
ones people actually use. There are already not many people using GCC 3,
and the addition of a flag that completely changes the API is nowhere near
realistic.

Sometimes it's necessary to draw a line between "what's written in ISO/IEC
9899" and "real world."

Plus Mark's point on technical possibility of it (thank GOD GCC didn't do
something as crazy as this on other platforms).

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


[FFmpeg-devel] [PATCH] huffyuvencdsp: Add ff_diff_bytes_{sse2, avx2}

2015-10-20 Thread Timothy Gu
SSE2 version 4%-35% faster than MMX depending on the width.
AVX2 version 1%-13% faster than SSE2 depending on the width.
---

Addressed James's and Henrik's advices. Removed heuristics based on width.
Made available both aligned and unaligned versions. For AVX2 version,
gracefully fall back on SSE2.

---
 libavcodec/huffyuvenc.c|   4 +-
 libavcodec/x86/huffyuvencdsp.asm   | 110 +++--
 libavcodec/x86/huffyuvencdsp_mmx.c |  14 -
 3 files changed, 107 insertions(+), 21 deletions(-)

diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index 49d711a..e080cd9 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -60,12 +60,12 @@ static inline int sub_left_prediction(HYuvContext *s, 
uint8_t *dst,
 }
 return left;
 } else {
-for (i = 0; i < 16; i++) {
+for (i = 0; i < 32; i++) {
 const int temp = src[i];
 dst[i] = temp - left;
 left   = temp;
 }
-s->hencdsp.diff_bytes(dst + 16, src + 16, src + 15, w - 16);
+s->hencdsp.diff_bytes(dst + 32, src + 32, src + 31, w - 32);
 return src[w-1];
 }
 } else {
diff --git a/libavcodec/x86/huffyuvencdsp.asm b/libavcodec/x86/huffyuvencdsp.asm
index e001906..699fd38 100644
--- a/libavcodec/x86/huffyuvencdsp.asm
+++ b/libavcodec/x86/huffyuvencdsp.asm
@@ -27,9 +27,9 @@
 
 section .text
 
-INIT_MMX mmx
 ; void ff_diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, const uint8_t 
*src2,
 ;intptr_t w);
+%macro DIFF_BYTES_PROLOGUE 0
 %if ARCH_X86_32
 cglobal diff_bytes, 3,5,2, dst, src1, src2
 %define wq r4q
@@ -40,34 +40,108 @@ cglobal diff_bytes, 4,5,2, dst, src1, src2, w
 DECLARE_REG_TMP 4
 %endif ; ARCH_X86_32
 %define i t0q
+%endmacro
+
+; label to jump to if w < regsize
+%macro DIFF_BYTES_LOOP_PREP 1
 movi, wq
-andi, -2 * mmsize
-jz  .setup_loop2
+andi, -2 * regsize
+jz%1
 add dstq, i
 addsrc1q, i
 addsrc2q, i
 negi
-.loop:
-mova  m0, [src1q + i]
-mova  m1, [src1q + i + mmsize]
-psubb m0, [src2q + i]
-psubb m1, [src2q + i + mmsize]
-mova  [dstq + i], m0
-mova [mmsize + dstq + i], m1
-addi, 2 * mmsize
-jl .loop
-.setup_loop2:
-and   wq, 2 * mmsize - 1
-jz  .end
+%endmacro
+
+; mov type used for src1q, dstq, first reg, second reg
+%macro DIFF_BYTES_LOOP_CORE 4
+%if regsize != 16
+mov%1 %3, [src1q + i]
+mov%1 %4, [src1q + i + regsize]
+psubb %3, [src2q + i]
+psubb %4, [src2q + i + regsize]
+mov%2   [dstq + i], %3
+mov%2 [regsize + dstq + i], %4
+%else
+; SSE enforces alignment of psubb operand
+mov%1 %3, [src1q + i]
+movu  %4, [src2q + i]
+psubb %3, %4
+mov%2 [dstq + i], %3
+mov%1 %3, [src1q + i + regsize]
+movu  %4, [src2q + i + regsize]
+psubb %3, %4
+mov%2 [regsize + dstq + i], %3
+%endif
+%endmacro
+
+%macro DIFF_BYTES_BODY 2 ; mov type used for src1q, for dstq
+%define regsize mmsize
+.loop_%1%2:
+DIFF_BYTES_LOOP_CORE %1, %2, m0, m1
+addi, 2 * regsize
+jl.loop_%1%2
+.skip_main_%1%2:
+and   wq, 2 * regsize - 1
+jz .end_%1%2
+%if mmsize > 16
+; fall back to narrower xmm
+%define regsize mmsize / 2
+DIFF_BYTES_LOOP_PREP .setup_loop_gpr_aa
+.loop2_%1%2:
+DIFF_BYTES_LOOP_CORE %1, %2, xm0, xm1
+addi, 2 * regsize
+jl   .loop2_%1%2
+.setup_loop_gpr_%1%2:
+and   wq, 2 * regsize - 1
+jz .end_%1%2
+%endif
 add dstq, wq
 addsrc1q, wq
 addsrc2q, wq
 neg   wq
-.loop2:
+.loop_gpr_%1%2:
 mov  t0b, [src1q + wq]
 sub  t0b, [src2q + wq]
 mov  [dstq + wq], t0b
 inc   wq
-jl.loop2
-.end:
+jl .loop_gpr_%1%2
+.end_%1%2:
 REP_RET
+%endmacro
+
+%if ARCH_X86_32
+INIT_MMX mmx
+DIFF_BYTES_PROLOGUE
+%define regsize mmsize
+DIFF_BYTES_LOOP_PREP .skip_main_aa
+DIFF_BYTES_BODYa, a
+%endif
+
+INIT_XMM sse2
+DIFF_BYTES_PROLOGUE
+%define regsize mmsize
+DIFF_BYTES_LOOP_PREP .skip_main_aa
+testdstq, regsize - 1
+jnz .loop_uu
+test   src1q, regsize - 1
+jnz .loop_ua
+DIFF_BYTES_BODYa, a
+DIFF_BYTES_BODYu, a
+DIFF_BYTES_BODYu, u
+
+%if HAVE_AVX2_EXTERNAL
+INIT_YMM avx2
+DIFF_BYTES_PROLOGUE
+%define regsize mmsize
+; Directly using unaligned SSE2 version is marginally faster than
+

Re: [FFmpeg-devel] [PATCH] huffyuvencdsp: Convert ff_diff_bytes_mmx to yasm

2015-10-20 Thread Timothy Gu
On Tue, Oct 20, 2015 at 2:18 PM James Almer  wrote:

> Removing this will make the INLINE_MMXEXT if statement below fail to
> compile on
> builds with inline asm disabled (msvc, etc). Even with dead code
> elimination in
> mind you'd need at least a prototype for the relevant functions.
> Just move this line below to keep the INLINE_MMXEXT if statement wrapped
> with it.
>

Good catch!


> Fate passes, so aside from the above it LGTM.
>

Pushed, thanks for the review.

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


[FFmpeg-devel] [PATCH] pixblockdsp: Use memcpy for get_pixels_16_c

2015-10-20 Thread Timothy Gu
Before:
  15543 decicycles in get_pixels, 4193214 runs,   1090 skips
After:
   5713 decicycles in get_pixels, 8387564 runs,   1044 skips
---
 libavcodec/pixblockdsp.c  | 36 ++-
 libavcodec/pixblockdsp_template.c | 40 ---
 2 files changed, 31 insertions(+), 45 deletions(-)
 delete mode 100644 libavcodec/pixblockdsp_template.c

diff --git a/libavcodec/pixblockdsp.c b/libavcodec/pixblockdsp.c
index 322e1dd..0f23d8a 100644
--- a/libavcodec/pixblockdsp.c
+++ b/libavcodec/pixblockdsp.c
@@ -23,12 +23,38 @@
 #include "avcodec.h"
 #include "pixblockdsp.h"
 
-#define BIT_DEPTH 16
-#include "pixblockdsp_template.c"
-#undef BIT_DEPTH
+static void get_pixels_16_c(int16_t *av_restrict block, const uint8_t *pixels,
+ptrdiff_t line_size)
+{
+memcpy(block + 0 * 8, pixels + 0 * line_size, sizeof(int16_t) * 8);
+memcpy(block + 1 * 8, pixels + 1 * line_size, sizeof(int16_t) * 8);
+memcpy(block + 2 * 8, pixels + 2 * line_size, sizeof(int16_t) * 8);
+memcpy(block + 3 * 8, pixels + 3 * line_size, sizeof(int16_t) * 8);
+memcpy(block + 4 * 8, pixels + 4 * line_size, sizeof(int16_t) * 8);
+memcpy(block + 5 * 8, pixels + 5 * line_size, sizeof(int16_t) * 8);
+memcpy(block + 6 * 8, pixels + 6 * line_size, sizeof(int16_t) * 8);
+memcpy(block + 7 * 8, pixels + 7 * line_size, sizeof(int16_t) * 8);
+}
+
+static void get_pixels_8_c(int16_t *av_restrict block, const uint8_t *pixels,
+   ptrdiff_t line_size)
+{
+int i;
 
-#define BIT_DEPTH 8
-#include "pixblockdsp_template.c"
+/* read the pixels */
+for (i = 0; i < 8; i++) {
+block[0] = pixels[0];
+block[1] = pixels[1];
+block[2] = pixels[2];
+block[3] = pixels[3];
+block[4] = pixels[4];
+block[5] = pixels[5];
+block[6] = pixels[6];
+block[7] = pixels[7];
+pixels  += line_size;
+block   += 8;
+}
+}
 
 static void diff_pixels_c(int16_t *av_restrict block, const uint8_t *s1,
   const uint8_t *s2, int stride)
diff --git a/libavcodec/pixblockdsp_template.c 
b/libavcodec/pixblockdsp_template.c
deleted file mode 100644
index d1e9102..000
--- a/libavcodec/pixblockdsp_template.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "bit_depth_template.c"
-
-static void FUNCC(get_pixels)(int16_t *av_restrict block, const uint8_t 
*_pixels,
-  ptrdiff_t line_size)
-{
-const pixel *pixels = (const pixel *) _pixels;
-int i;
-
-/* read the pixels */
-for (i = 0; i < 8; i++) {
-block[0] = pixels[0];
-block[1] = pixels[1];
-block[2] = pixels[2];
-block[3] = pixels[3];
-block[4] = pixels[4];
-block[5] = pixels[5];
-block[6] = pixels[6];
-block[7] = pixels[7];
-pixels  += line_size / sizeof(pixel);
-block   += 8;
-}
-}
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 1/2] dnxhdenc: Optimize get_pixels_8x4_sym for 10-bit

2015-10-20 Thread Timothy Gu
On Tue, Oct 20, 2015 at 9:30 AM Michael Niedermayer 
wrote:

> On Sat, Oct 17, 2015 at 06:05:45PM -0700, Timothy Gu wrote:
> > This reverts commit 628e6d0164febc8e69b0f10dfa487e8a2dd1a28a and uses
> > a better fix.
> >
> > Before:
> > 4483 decicycles in get_pixels_8x4_sym,  131032 runs, 40 skips
> >
> > After:
> > 2569 decicycles in get_pixels_8x4_sym,  131054 runs, 18 skips
> > ---
> >  libavcodec/dnxhdenc.c | 24 
> >  1 file changed, 8 insertions(+), 16 deletions(-)
>
> LGTM
>

Applied.

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


[FFmpeg-devel] [PATCH] huffyuvencdsp: Convert ff_diff_bytes_mmx to yasm

2015-10-19 Thread Timothy Gu
Heavily based upon ff_add_bytes by Christophe Gisquet.
---

Taken into account James' comment, and fixed x86_32. Also saves one additional
GPR.

---
 libavcodec/x86/Makefile|  1 +
 libavcodec/x86/huffyuvencdsp.asm   | 73 ++
 libavcodec/x86/huffyuvencdsp_mmx.c | 37 ---
 3 files changed, 80 insertions(+), 31 deletions(-)
 create mode 100644 libavcodec/x86/huffyuvencdsp.asm

diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index 4591e4b..e1b1f0c 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -115,6 +115,7 @@ YASM-OBJS-$(CONFIG_H264QPEL)   += 
x86/h264_qpel_8bit.o  \
 YASM-OBJS-$(CONFIG_HPELDSP)+= x86/fpel.o\
   x86/hpeldsp.o
 YASM-OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp.o
+YASM-OBJS-$(CONFIG_HUFFYUVENCDSP)  += x86/huffyuvencdsp.o
 YASM-OBJS-$(CONFIG_IDCTDSP)+= x86/idctdsp.o
 YASM-OBJS-$(CONFIG_LLAUDDSP)   += x86/lossless_audiodsp.o
 YASM-OBJS-$(CONFIG_LLVIDDSP)   += x86/lossless_videodsp.o
diff --git a/libavcodec/x86/huffyuvencdsp.asm b/libavcodec/x86/huffyuvencdsp.asm
new file mode 100644
index 000..e001906
--- /dev/null
+++ b/libavcodec/x86/huffyuvencdsp.asm
@@ -0,0 +1,73 @@
+;
+;* SIMD-optimized HuffYUV encoding functions
+;* Copyright (c) 2000, 2001 Fabrice Bellard
+;* Copyright (c) 2002-2004 Michael Niedermayer 
+;*
+;* MMX optimization by Nick Kurshev 
+;* Conversion to NASM format by Tiancheng "Timothy" Gu 
+;*
+;* 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
+;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+;**
+
+%include "libavutil/x86/x86util.asm"
+
+section .text
+
+INIT_MMX mmx
+; void ff_diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, const uint8_t 
*src2,
+;intptr_t w);
+%if ARCH_X86_32
+cglobal diff_bytes, 3,5,2, dst, src1, src2
+%define wq r4q
+DECLARE_REG_TMP 3
+mov   wq, r3mp
+%else
+cglobal diff_bytes, 4,5,2, dst, src1, src2, w
+DECLARE_REG_TMP 4
+%endif ; ARCH_X86_32
+%define i t0q
+movi, wq
+andi, -2 * mmsize
+jz  .setup_loop2
+add dstq, i
+addsrc1q, i
+addsrc2q, i
+negi
+.loop:
+mova  m0, [src1q + i]
+mova  m1, [src1q + i + mmsize]
+psubb m0, [src2q + i]
+psubb m1, [src2q + i + mmsize]
+mova  [dstq + i], m0
+mova [mmsize + dstq + i], m1
+addi, 2 * mmsize
+jl .loop
+.setup_loop2:
+and   wq, 2 * mmsize - 1
+jz  .end
+add dstq, wq
+addsrc1q, wq
+addsrc2q, wq
+neg   wq
+.loop2:
+mov  t0b, [src1q + wq]
+sub  t0b, [src2q + wq]
+mov  [dstq + wq], t0b
+inc   wq
+jl.loop2
+.end:
+REP_RET
diff --git a/libavcodec/x86/huffyuvencdsp_mmx.c 
b/libavcodec/x86/huffyuvencdsp_mmx.c
index ee60f4c..c5f81c8 100644
--- a/libavcodec/x86/huffyuvencdsp_mmx.c
+++ b/libavcodec/x86/huffyuvencdsp_mmx.c
@@ -29,33 +29,10 @@
 #include "libavcodec/huffyuvencdsp.h"
 #include "libavcodec/mathops.h"
 
-#if HAVE_INLINE_ASM
-
-static void diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, const uint8_t 
*src2,
-   intptr_t w)
-{
-x86_reg i = 0;
-
-if (w >= 16)
-__asm__ volatile (
-"1: \n\t"
-"movq  (%2, %0), %%mm0  \n\t"
-"movq  (%1, %0), %%mm1  \n\t"
-"psubb %%mm0, %%mm1 \n\t"
-"movq %%mm1, (%3, %0)   \n\t"
-"movq 8(%2, %0), %%mm0  \n\t"
-"movq 8(%1, %0), %%mm1  \n\t"
-"psubb %%mm0, %%mm1 \n\t"
-"movq %%mm1, 8(%3, %0)  \n\t"
-"add $16, %0\n\t"
-"

Re: [FFmpeg-devel] [PATCH 1/4] huffyuvencdsp: Use intptr_t for width

2015-10-19 Thread Timothy Gu
On Mon, Oct 19, 2015 at 3:53 PM Michael Niedermayer 
wrote:

> On Mon, Oct 19, 2015 at 01:00:43PM -0700, Timothy Gu wrote:
> > It is done this way in huffyuvdsp as well.
> > ---
> >  libavcodec/huffyuvencdsp.c | 4 ++--
> >  libavcodec/huffyuvencdsp.h | 4 ++--
> >  libavcodec/x86/huffyuvencdsp_mmx.c | 5 +++--
> >  3 files changed, 7 insertions(+), 6 deletions(-)
>
> LGTM
>

Pushed, thanks.

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


Re: [FFmpeg-devel] [PATCH 3/4] x86: vc1dsp_mmx: Move yasm initiation steps to vc1dsp_init

2015-10-19 Thread Timothy Gu
On Sat, Oct 17, 2015 at 4:49 PM Timothy Gu  wrote:

> That's where all yasm initiation steps are. Also removes the overlap
> between the two files.
> ---
>  libavcodec/x86/vc1dsp_init.c | 36 +---
>  libavcodec/x86/vc1dsp_mmx.c  | 27 ---
>  2 files changed, 25 insertions(+), 38 deletions(-)
>

Pushed.

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


Re: [FFmpeg-devel] [PATCH 2/4] x86: fpel: Remove erroneous ff_put_pixels8_mmxext prototype

2015-10-19 Thread Timothy Gu
On Sat, Oct 17, 2015 at 6:31 PM Michael Niedermayer 
wrote:

> On Sat, Oct 17, 2015 at 04:48:59PM -0700, Timothy Gu wrote:
> > This function does not exist.
> > ---
> >  libavcodec/x86/fpel.h | 2 --
> >  1 file changed, 2 deletions(-)
>
> LGTM
>
> thx
>

Pushed.

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


Re: [FFmpeg-devel] [PATCH 1/4] x86: fpel: Move prototypes for 4-px block functions

2015-10-19 Thread Timothy Gu
On Sat, Oct 17, 2015 at 4:49 PM Timothy Gu  wrote:

> ---
>  libavcodec/x86/fpel.h  | 6 ++
>  libavcodec/x86/h264_qpel.c | 4 
>  2 files changed, 6 insertions(+), 4 deletions(-)
>

Pushed.

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


Re: [FFmpeg-devel] [PATCH 4/4] huffyuvencdsp: Add ff_diff_bytes_avx2

2015-10-19 Thread Timothy Gu
On Mon, Oct 19, 2015 at 1:44 PM Ganesh Ajjanagadde  wrote:

> On Mon, Oct 19, 2015 at 4:41 PM, Hendrik Leppkes 
> wrote:
> > On Mon, Oct 19, 2015 at 10:36 PM, Ganesh Ajjanagadde 
> wrote:
> >> On Mon, Oct 19, 2015 at 4:00 PM, Timothy Gu 
> wrote:
> >>> About 16% faster on large clips (>1200px width), more than 2x slower
> on small clips
> >>> (352px). So using a heuristic to select with one to use.
> >>
> >> What system, what compiler, etc? Without any such information, numbers
> >> are meaningless. Please either give them in full, or not at all -
> >> particularly here since there is this "voodoo" threshold that needs to
> >> be picked.
> >
> > It assembly, compiler is meaningless.
>
> system and cpu still is - my point still remains.
>

On a Haswell Xeon. It's on Linux, although it shouldn't matter.

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


[FFmpeg-devel] [PATCH 4/4] huffyuvencdsp: Add ff_diff_bytes_avx2

2015-10-19 Thread Timothy Gu
About 16% faster on large clips (>1200px width), more than 2x slower on small 
clips
(352px). So using a heuristic to select with one to use.
---
 libavcodec/huffyuvenc.c| 6 +++---
 libavcodec/huffyuvencdsp.c | 4 ++--
 libavcodec/huffyuvencdsp.h | 4 ++--
 libavcodec/pngenc.c| 2 +-
 libavcodec/utvideoenc.c| 2 +-
 libavcodec/x86/huffyuvencdsp.asm   | 5 +
 libavcodec/x86/huffyuvencdsp_mmx.c | 9 -
 7 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index 49d711a..7e133b5 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -60,12 +60,12 @@ static inline int sub_left_prediction(HYuvContext *s, 
uint8_t *dst,
 }
 return left;
 } else {
-for (i = 0; i < 16; i++) {
+for (i = 0; i < 32; i++) {
 const int temp = src[i];
 dst[i] = temp - left;
 left   = temp;
 }
-s->hencdsp.diff_bytes(dst + 16, src + 16, src + 15, w - 16);
+s->hencdsp.diff_bytes(dst + 32, src + 32, src + 31, w - 32);
 return src[w-1];
 }
 } else {
@@ -217,7 +217,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
 
 ff_huffyuv_common_init(avctx);
-ff_huffyuvencdsp_init(&s->hencdsp);
+ff_huffyuvencdsp_init(&s->hencdsp, s->width);
 
 avctx->extradata = av_mallocz(3*MAX_N + 4);
 if (s->flags&AV_CODEC_FLAG_PASS1) {
diff --git a/libavcodec/huffyuvencdsp.c b/libavcodec/huffyuvencdsp.c
index fdcd0b0..08bfd63 100644
--- a/libavcodec/huffyuvencdsp.c
+++ b/libavcodec/huffyuvencdsp.c
@@ -74,11 +74,11 @@ static void sub_hfyu_median_pred_c(uint8_t *dst, const 
uint8_t *src1,
 *left_top = lt;
 }
 
-av_cold void ff_huffyuvencdsp_init(HuffYUVEncDSPContext *c)
+av_cold void ff_huffyuvencdsp_init(HuffYUVEncDSPContext *c, int w)
 {
 c->diff_bytes   = diff_bytes_c;
 c->sub_hfyu_median_pred = sub_hfyu_median_pred_c;
 
 if (ARCH_X86)
-ff_huffyuvencdsp_init_x86(c);
+ff_huffyuvencdsp_init_x86(c, w);
 }
diff --git a/libavcodec/huffyuvencdsp.h b/libavcodec/huffyuvencdsp.h
index 9d09095..d66590b 100644
--- a/libavcodec/huffyuvencdsp.h
+++ b/libavcodec/huffyuvencdsp.h
@@ -35,7 +35,7 @@ typedef struct HuffYUVEncDSPContext {
  int *left, int *left_top);
 } HuffYUVEncDSPContext;
 
-void ff_huffyuvencdsp_init(HuffYUVEncDSPContext *c);
-void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c);
+void ff_huffyuvencdsp_init(HuffYUVEncDSPContext *c, int w);
+void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c, int w);
 
 #endif /* AVCODEC_HUFFYUVENCDSP_H */
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index 4204df2..26cde92 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -981,7 +981,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 
-ff_huffyuvencdsp_init(&s->hdsp);
+ff_huffyuvencdsp_init(&s->hdsp, avctx->width);
 
 s->filter_type = av_clip(avctx->prediction_method,
  PNG_FILTER_VALUE_NONE,
diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c
index b8e1cc3..4753cfa 100644
--- a/libavcodec/utvideoenc.c
+++ b/libavcodec/utvideoenc.c
@@ -109,7 +109,7 @@ static av_cold int utvideo_encode_init(AVCodecContext 
*avctx)
 }
 
 ff_bswapdsp_init(&c->bdsp);
-ff_huffyuvencdsp_init(&c->hdsp);
+ff_huffyuvencdsp_init(&c->hdsp, avctx->width);
 
 /* Check the prediction method, and error out if unsupported */
 if (avctx->prediction_method < 0 || avctx->prediction_method > 4) {
diff --git a/libavcodec/x86/huffyuvencdsp.asm b/libavcodec/x86/huffyuvencdsp.asm
index 9625fbe..85a6616 100644
--- a/libavcodec/x86/huffyuvencdsp.asm
+++ b/libavcodec/x86/huffyuvencdsp.asm
@@ -65,3 +65,8 @@ DIFF_BYTES
 
 INIT_XMM sse2
 DIFF_BYTES
+
+%if HAVE_AVX2_EXTERNAL
+INIT_YMM avx2
+DIFF_BYTES
+%endif
diff --git a/libavcodec/x86/huffyuvencdsp_mmx.c 
b/libavcodec/x86/huffyuvencdsp_mmx.c
index 9af5305..3eda0ba 100644
--- a/libavcodec/x86/huffyuvencdsp_mmx.c
+++ b/libavcodec/x86/huffyuvencdsp_mmx.c
@@ -33,6 +33,8 @@ void ff_diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, 
const uint8_t *src2,
intptr_t w);
 void ff_diff_bytes_sse2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
 intptr_t w);
+void ff_diff_bytes_avx2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
+intptr_t w);
 
 #if HAVE_INLINE_ASM
 
@@ -78,7 +80,7 @@ static void sub_hfyu_median_pred_mmxext(uint8_t *dst, const 
uint8_t *src1,
 
 #endif /* HAVE_INLINE_ASM */
 
-av_cold void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c)
+av_cold void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c, int w)
 {
 av_unused int cpu_flags = av_get_cpu_flags();
 
@@ -93,4 +95,9 @@ av_co

[FFmpeg-devel] [PATCH 3/4] huffyuvencdsp: Add ff_diff_bytes_sse2

2015-10-19 Thread Timothy Gu
4% to 35% faster depending on the width.
---
 libavcodec/x86/huffyuvencdsp.asm   | 31 ---
 libavcodec/x86/huffyuvencdsp_mmx.c |  8 +++-
 2 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/libavcodec/x86/huffyuvencdsp.asm b/libavcodec/x86/huffyuvencdsp.asm
index 97de7e9..9625fbe 100644
--- a/libavcodec/x86/huffyuvencdsp.asm
+++ b/libavcodec/x86/huffyuvencdsp.asm
@@ -27,27 +27,27 @@
 
 section .text
 
-INIT_MMX mmx
 ; void ff_diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, const uint8_t 
*src2,
 ;intptr_t w);
-cglobal diff_bytes, 4,6,0, dst, src1, src2, w, i
+%macro DIFF_BYTES 0
+cglobal diff_bytes, 4,6,2, dst, src1, src2, w, i
 xor   iq, iq
-cmp   wq, 16
+cmp   wq, mmsize * 2
 jb.loop2
-sub   wq, 15
+sub   wq, mmsize * 2 - 1
 .loop:
-mova  m0, [src2q + iq]
-mova  m1, [src1q + iq]
+movu  m0, [src2q + iq]
+movu  m1, [src1q + iq]
 psubb m1, m0
 mova [iq + dstq], m1
-mova  m0, [src2q + iq + 8]
-mova  m1, [src1q + iq + 8]
+movu  m0, [src2q + iq + mmsize]
+movu  m1, [src1q + iq + mmsize]
 psubb m1, m0
-mova [8 + iq + dstq], m1
-add   iq, 16
+mova [mmsize + iq + dstq], m1
+add   iq, mmsize * 2
 cmp   iq, wq
 jb .loop
-add   wq, 15
+add   wq, mmsize * 2 - 1
 .loop2:
 mov  r6b, byte [src1q + iq]
 sub  r6b, byte [src2q + iq]
@@ -56,3 +56,12 @@ cglobal diff_bytes, 4,6,0, dst, src1, src2, w, i
 cmp   iq, wq
 jb.loop2
 REP_RET
+%endmacro
+
+%if ARCH_X86_32
+INIT_MMX mmx
+DIFF_BYTES
+%endif
+
+INIT_XMM sse2
+DIFF_BYTES
diff --git a/libavcodec/x86/huffyuvencdsp_mmx.c 
b/libavcodec/x86/huffyuvencdsp_mmx.c
index c5f81c8..9af5305 100644
--- a/libavcodec/x86/huffyuvencdsp_mmx.c
+++ b/libavcodec/x86/huffyuvencdsp_mmx.c
@@ -31,6 +31,8 @@
 
 void ff_diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
intptr_t w);
+void ff_diff_bytes_sse2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
+intptr_t w);
 
 #if HAVE_INLINE_ASM
 
@@ -80,11 +82,15 @@ av_cold void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext 
*c)
 {
 av_unused int cpu_flags = av_get_cpu_flags();
 
-if (EXTERNAL_MMX(cpu_flags)) {
+if (ARCH_X86_32 && EXTERNAL_MMX(cpu_flags)) {
 c->diff_bytes = ff_diff_bytes_mmx;
 }
 
 if (INLINE_MMXEXT(cpu_flags)) {
 c->sub_hfyu_median_pred = sub_hfyu_median_pred_mmxext;
 }
+
+if (EXTERNAL_SSE2(cpu_flags)) {
+c->diff_bytes = ff_diff_bytes_sse2;
+}
 }
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 2/4] huffyuvencdsp: Convert ff_diff_bytes_mmx to yasm

2015-10-19 Thread Timothy Gu
---
 libavcodec/x86/Makefile|  1 +
 libavcodec/x86/huffyuvencdsp.asm   | 58 ++
 libavcodec/x86/huffyuvencdsp_mmx.c | 37 
 3 files changed, 65 insertions(+), 31 deletions(-)
 create mode 100644 libavcodec/x86/huffyuvencdsp.asm

diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index 4591e4b..e1b1f0c 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -115,6 +115,7 @@ YASM-OBJS-$(CONFIG_H264QPEL)   += 
x86/h264_qpel_8bit.o  \
 YASM-OBJS-$(CONFIG_HPELDSP)+= x86/fpel.o\
   x86/hpeldsp.o
 YASM-OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp.o
+YASM-OBJS-$(CONFIG_HUFFYUVENCDSP)  += x86/huffyuvencdsp.o
 YASM-OBJS-$(CONFIG_IDCTDSP)+= x86/idctdsp.o
 YASM-OBJS-$(CONFIG_LLAUDDSP)   += x86/lossless_audiodsp.o
 YASM-OBJS-$(CONFIG_LLVIDDSP)   += x86/lossless_videodsp.o
diff --git a/libavcodec/x86/huffyuvencdsp.asm b/libavcodec/x86/huffyuvencdsp.asm
new file mode 100644
index 000..97de7e9
--- /dev/null
+++ b/libavcodec/x86/huffyuvencdsp.asm
@@ -0,0 +1,58 @@
+;
+;* SIMD-optimized HuffYUV encoding functions
+;* Copyright (c) 2000, 2001 Fabrice Bellard
+;* Copyright (c) 2002-2004 Michael Niedermayer 
+;*
+;* MMX optimization by Nick Kurshev 
+;* Conversion to NASM format by Tiancheng "Timothy" Gu 
+;*
+;* 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
+;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+;**
+
+%include "libavutil/x86/x86util.asm"
+
+section .text
+
+INIT_MMX mmx
+; void ff_diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, const uint8_t 
*src2,
+;intptr_t w);
+cglobal diff_bytes, 4,6,0, dst, src1, src2, w, i
+xor   iq, iq
+cmp   wq, 16
+jb.loop2
+sub   wq, 15
+.loop:
+mova  m0, [src2q + iq]
+mova  m1, [src1q + iq]
+psubb m1, m0
+mova [iq + dstq], m1
+mova  m0, [src2q + iq + 8]
+mova  m1, [src1q + iq + 8]
+psubb m1, m0
+mova [8 + iq + dstq], m1
+add   iq, 16
+cmp   iq, wq
+jb .loop
+add   wq, 15
+.loop2:
+mov  r6b, byte [src1q + iq]
+sub  r6b, byte [src2q + iq]
+mov byte [dstq + iq], r6b
+inc   iq
+cmp   iq, wq
+jb.loop2
+REP_RET
diff --git a/libavcodec/x86/huffyuvencdsp_mmx.c 
b/libavcodec/x86/huffyuvencdsp_mmx.c
index ee60f4c..c5f81c8 100644
--- a/libavcodec/x86/huffyuvencdsp_mmx.c
+++ b/libavcodec/x86/huffyuvencdsp_mmx.c
@@ -29,33 +29,10 @@
 #include "libavcodec/huffyuvencdsp.h"
 #include "libavcodec/mathops.h"
 
-#if HAVE_INLINE_ASM
-
-static void diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, const uint8_t 
*src2,
-   intptr_t w)
-{
-x86_reg i = 0;
-
-if (w >= 16)
-__asm__ volatile (
-"1: \n\t"
-"movq  (%2, %0), %%mm0  \n\t"
-"movq  (%1, %0), %%mm1  \n\t"
-"psubb %%mm0, %%mm1 \n\t"
-"movq %%mm1, (%3, %0)   \n\t"
-"movq 8(%2, %0), %%mm0  \n\t"
-"movq 8(%1, %0), %%mm1  \n\t"
-"psubb %%mm0, %%mm1 \n\t"
-"movq %%mm1, 8(%3, %0)  \n\t"
-"add $16, %0\n\t"
-"cmp %4, %0 \n\t"
-" jb 1b \n\t"
-: "+r" (i)
-: "r" (src1), "r" (src2), "r" (dst), "r" ((x86_reg) w - 15));
+void ff_diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
+   intptr_t w);
 
-for (; i < w; i++)
-dst[i + 0] = src1[i + 0] - src2[i + 0];
-}
+#if HAVE_INLINE_ASM
 
 static void sub_hfyu_median_pred_mmxext(uint8

[FFmpeg-devel] [PATCH 1/4] huffyuvencdsp: Use intptr_t for width

2015-10-19 Thread Timothy Gu
It is done this way in huffyuvdsp as well.
---
 libavcodec/huffyuvencdsp.c | 4 ++--
 libavcodec/huffyuvencdsp.h | 4 ++--
 libavcodec/x86/huffyuvencdsp_mmx.c | 5 +++--
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/libavcodec/huffyuvencdsp.c b/libavcodec/huffyuvencdsp.c
index 95fcc19..fdcd0b0 100644
--- a/libavcodec/huffyuvencdsp.c
+++ b/libavcodec/huffyuvencdsp.c
@@ -25,7 +25,7 @@
 #define pb_7f (~0UL / 255 * 0x7f)
 #define pb_80 (~0UL / 255 * 0x80)
 
-static void diff_bytes_c(uint8_t *dst, const uint8_t *src1, const uint8_t 
*src2, int w)
+static void diff_bytes_c(uint8_t *dst, const uint8_t *src1, const uint8_t 
*src2, intptr_t w)
 {
 long i;
 
@@ -54,7 +54,7 @@ static void diff_bytes_c(uint8_t *dst, const uint8_t *src1, 
const uint8_t *src2,
 }
 
 static void sub_hfyu_median_pred_c(uint8_t *dst, const uint8_t *src1,
-   const uint8_t *src2, int w,
+   const uint8_t *src2, intptr_t w,
int *left, int *left_top)
 {
 int i;
diff --git a/libavcodec/huffyuvencdsp.h b/libavcodec/huffyuvencdsp.h
index 3a49b4a..9d09095 100644
--- a/libavcodec/huffyuvencdsp.h
+++ b/libavcodec/huffyuvencdsp.h
@@ -25,13 +25,13 @@ typedef struct HuffYUVEncDSPContext {
 void (*diff_bytes)(uint8_t *dst /* align 16 */,
const uint8_t *src1 /* align 16 */,
const uint8_t *src2 /* align 1 */,
-   int w);
+   intptr_t w);
 /**
  * Subtract HuffYUV's variant of median prediction.
  * Note, this might read from src1[-1], src2[-1].
  */
 void (*sub_hfyu_median_pred)(uint8_t *dst, const uint8_t *src1,
- const uint8_t *src2, int w,
+ const uint8_t *src2, intptr_t w,
  int *left, int *left_top);
 } HuffYUVEncDSPContext;
 
diff --git a/libavcodec/x86/huffyuvencdsp_mmx.c 
b/libavcodec/x86/huffyuvencdsp_mmx.c
index 63d8e3c..ee60f4c 100644
--- a/libavcodec/x86/huffyuvencdsp_mmx.c
+++ b/libavcodec/x86/huffyuvencdsp_mmx.c
@@ -31,7 +31,8 @@
 
 #if HAVE_INLINE_ASM
 
-static void diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, const uint8_t 
*src2, int w)
+static void diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, const uint8_t 
*src2,
+   intptr_t w)
 {
 x86_reg i = 0;
 
@@ -57,7 +58,7 @@ static void diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, 
const uint8_t *src
 }
 
 static void sub_hfyu_median_pred_mmxext(uint8_t *dst, const uint8_t *src1,
-const uint8_t *src2, int w,
+const uint8_t *src2, intptr_t w,
 int *left, int *left_top)
 {
 x86_reg i = 0;
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 2/2] pixblockdsp: Use memcpy for get_pixels_16_c

2015-10-17 Thread Timothy Gu
Before:
  15543 decicycles in get_pixels, 4193214 runs,   1090 skips
After:
   5713 decicycles in get_pixels, 8387564 runs,   1044 skips
---
 libavcodec/pixblockdsp.c  | 38 -
 libavcodec/pixblockdsp_template.c | 40 ---
 2 files changed, 33 insertions(+), 45 deletions(-)
 delete mode 100644 libavcodec/pixblockdsp_template.c

diff --git a/libavcodec/pixblockdsp.c b/libavcodec/pixblockdsp.c
index 322e1dd..fc21ea4 100644
--- a/libavcodec/pixblockdsp.c
+++ b/libavcodec/pixblockdsp.c
@@ -23,12 +23,40 @@
 #include "avcodec.h"
 #include "pixblockdsp.h"
 
-#define BIT_DEPTH 16
-#include "pixblockdsp_template.c"
-#undef BIT_DEPTH
+static void get_pixels_16_c(int16_t *av_restrict block, const uint8_t *pixels,
+ptrdiff_t line_size)
+{
+line_size /= 2;
+
+memcpy(block, pixels, 2 * 8);
+memcpy(block + 1 * 8, pixels + 1 * line_size, 2 * 8);
+memcpy(block + 2 * 8, pixels + 2 * line_size, 2 * 8);
+memcpy(block + 3 * 8, pixels + 3 * line_size, 2 * 8);
+memcpy(block + 4 * 8, pixels + 4 * line_size, 2 * 8);
+memcpy(block + 5 * 8, pixels + 5 * line_size, 2 * 8);
+memcpy(block + 6 * 8, pixels + 6 * line_size, 2 * 8);
+memcpy(block + 7 * 8, pixels + 7 * line_size, 2 * 8);
+}
+
+static void get_pixels_8_c(int16_t *av_restrict block, const uint8_t *pixels,
+   ptrdiff_t line_size)
+{
+int i;
 
-#define BIT_DEPTH 8
-#include "pixblockdsp_template.c"
+/* read the pixels */
+for (i = 0; i < 8; i++) {
+block[0] = pixels[0];
+block[1] = pixels[1];
+block[2] = pixels[2];
+block[3] = pixels[3];
+block[4] = pixels[4];
+block[5] = pixels[5];
+block[6] = pixels[6];
+block[7] = pixels[7];
+pixels  += line_size;
+block   += 8;
+}
+}
 
 static void diff_pixels_c(int16_t *av_restrict block, const uint8_t *s1,
   const uint8_t *s2, int stride)
diff --git a/libavcodec/pixblockdsp_template.c 
b/libavcodec/pixblockdsp_template.c
deleted file mode 100644
index d1e9102..000
--- a/libavcodec/pixblockdsp_template.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "bit_depth_template.c"
-
-static void FUNCC(get_pixels)(int16_t *av_restrict block, const uint8_t 
*_pixels,
-  ptrdiff_t line_size)
-{
-const pixel *pixels = (const pixel *) _pixels;
-int i;
-
-/* read the pixels */
-for (i = 0; i < 8; i++) {
-block[0] = pixels[0];
-block[1] = pixels[1];
-block[2] = pixels[2];
-block[3] = pixels[3];
-block[4] = pixels[4];
-block[5] = pixels[5];
-block[6] = pixels[6];
-block[7] = pixels[7];
-pixels  += line_size / sizeof(pixel);
-block   += 8;
-}
-}
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 1/2] dnxhdenc: Optimize get_pixels_8x4_sym for 10-bit

2015-10-17 Thread Timothy Gu
This reverts commit 628e6d0164febc8e69b0f10dfa487e8a2dd1a28a and uses
a better fix.

Before:
4483 decicycles in get_pixels_8x4_sym,  131032 runs, 40 skips

After:
2569 decicycles in get_pixels_8x4_sym,  131054 runs, 18 skips
---
 libavcodec/dnxhdenc.c | 24 
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 36154ac..04eb5d5 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -87,22 +87,14 @@ void dnxhd_10bit_get_pixels_8x4_sym(int16_t *av_restrict 
block,
 const uint8_t *pixels,
 ptrdiff_t line_size)
 {
-int i;
-const uint16_t* pixels16 = (const uint16_t*)pixels;
-line_size >>= 1;
-
-for (i = 0; i < 4; i++) {
-block[0] = pixels16[0]; block[1] = pixels16[1];
-block[2] = pixels16[2]; block[3] = pixels16[3];
-block[4] = pixels16[4]; block[5] = pixels16[5];
-block[6] = pixels16[6]; block[7] = pixels16[7];
-pixels16 += line_size;
-block += 8;
-}
-memcpy(block,  block -  8, sizeof(*block) * 8);
-memcpy(block +  8, block - 16, sizeof(*block) * 8);
-memcpy(block + 16, block - 24, sizeof(*block) * 8);
-memcpy(block + 24, block - 32, sizeof(*block) * 8);
+memcpy(block + 0 * 8, pixels, 8 * sizeof(*block));
+memcpy(block + 7 * 8, pixels, 8 * sizeof(*block));
+memcpy(block + 1 * 8, pixels + 1 * line_size, 8 * sizeof(*block));
+memcpy(block + 6 * 8, pixels + 1 * line_size, 8 * sizeof(*block));
+memcpy(block + 2 * 8, pixels + 2 * line_size, 8 * sizeof(*block));
+memcpy(block + 5 * 8, pixels + 2 * line_size, 8 * sizeof(*block));
+memcpy(block + 3 * 8, pixels + 3 * line_size, 8 * sizeof(*block));
+memcpy(block + 4 * 8, pixels + 3 * line_size, 8 * sizeof(*block));
 }
 
 static int dnxhd_10bit_dct_quantize(MpegEncContext *ctx, int16_t *block,
-- 
1.9.1

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


[FFmpeg-devel] [PATCH] vc1dsp: Port ff_vc1_put_ver_16b_shift2_mmx to yasm

2015-10-17 Thread Timothy Gu
This function is only used within other inline asm functions, hence the
HAVE_MMX_INLINE guard. Per recent discussions, we should not worry about
the performance of inline asm-only builds.
---

The conversion process has to start _somewhere_...

Difference from previous version: use mova/h, correct typo, and fix %if guard
position.

---
 libavcodec/x86/vc1dsp.asm   | 89 -
 libavcodec/x86/vc1dsp_mmx.c | 59 --
 2 files changed, 95 insertions(+), 53 deletions(-)

diff --git a/libavcodec/x86/vc1dsp.asm b/libavcodec/x86/vc1dsp.asm
index 546688c..729bce7 100644
--- a/libavcodec/x86/vc1dsp.asm
+++ b/libavcodec/x86/vc1dsp.asm
@@ -1,5 +1,6 @@
 ;**
-;* VC1 deblocking optimizations
+;* VC1 DSP optimizations
+;* Copyright (c) 2007 Christophe GISQUET 
 ;* Copyright (c) 2009 David Conrad
 ;*
 ;* This file is part of FFmpeg.
@@ -23,6 +24,7 @@
 
 cextern pw_4
 cextern pw_5
+cextern pw_9
 
 section .text
 
@@ -315,3 +317,88 @@ cglobal vc1_h_loop_filter8, 3,5,8
 START_H_FILTER 8
 VC1_H_LOOP_FILTER 8
 RET
+
+%if HAVE_MMX_INLINE
+%macro NORMALIZE_MMX 1 ; shift
+paddw m3, m7 ; +bias-r
+paddw m4, m7 ; +bias-r
+psraw m3, %1
+psraw m4, %1
+%endmacro
+
+; Compute the rounder 32-r or 8-r and unpacks it to m7
+%macro LOAD_ROUNDER_MMX 1 ; round
+movd  m7, %1
+punpcklwd m7, m7
+punpckldq m7, m7
+%endmacro
+
+%macro SHIFT2_LINE 5 ; off, r0, r1, r2, r3
+paddw  m%3, m%4
+movh   m%2, [srcq + stride_neg2]
+pmullw m%3, m6
+punpcklbw  m%2, m0
+movh   m%5, [srcq + strideq]
+psubw  m%3, m%2
+punpcklbw  m%5, m0
+paddw  m%3, m7
+psubw  m%3, m%5
+psraw  m%3, shift
+movu   [dstq + %1], m%3
+add   srcq, strideq
+%endmacro
+
+INIT_MMX mmx
+; void ff_vc1_put_ver_16b_shift2_mmx(int16_t *dst, const uint8_t *src,
+;x86_reg stride, int rnd, int64_t shift)
+; Sacrificing m6 makes it possible to pipeline loads from src
+%if ARCH_X86_32
+cglobal vc1_put_ver_16b_shift2, 3,6,0, dst, src, stride
+DECLARE_REG_TMP 3, 4, 5
+%define rnd r3mp
+%define shift qword r4m
+%else ; X86_64
+cglobal vc1_put_ver_16b_shift2, 4,7,0, dst, src, stride
+DECLARE_REG_TMP 4, 5, 6
+%define   rnd r3d
+; We need shift either in memory or in a mm reg as it's used in psraw
+; On Windows, the arg is already on the stack
+; On SysV, m5 doesn't seem to be used
+%if WIN64
+%define shift r4mp
+%else ; UNIX64
+%define shift m5
+mova shift, r4q
+%endif ; WIN64
+%endif ; X86_32
+%define stride_neg2 t0q
+%define stride_9minus4 t1q
+%define i t2q
+mov   stride_neg2, strideq
+neg   stride_neg2
+add   stride_neg2, stride_neg2
+leastride_9minus4, [strideq * 9 - 4]
+mov i, 3
+LOAD_ROUNDER_MMX  rnd
+mova   m6, [pw_9]
+pxor   m0, m0
+.loop:
+movh   m2, [srcq]
+add  srcq, strideq
+movh   m3, [srcq]
+punpcklbw  m2, m0
+punpcklbw  m3, m0
+SHIFT2_LINE 0, 1, 2, 3, 4
+SHIFT2_LINE24, 2, 3, 4, 1
+SHIFT2_LINE48, 3, 4, 1, 2
+SHIFT2_LINE72, 4, 1, 2, 3
+SHIFT2_LINE96, 1, 2, 3, 4
+SHIFT2_LINE   120, 2, 3, 4, 1
+SHIFT2_LINE   144, 3, 4, 1, 2
+SHIFT2_LINE   168, 4, 1, 2, 3
+sub  srcq, stride_9minus4
+add  dstq, 8
+dec i
+jnz .loop
+REP_RET
+%endif ; HAVE_MMX_INLINE
diff --git a/libavcodec/x86/vc1dsp_mmx.c b/libavcodec/x86/vc1dsp_mmx.c
index e42099b..c268cc6 100644
--- a/libavcodec/x86/vc1dsp_mmx.c
+++ b/libavcodec/x86/vc1dsp_mmx.c
@@ -33,7 +33,11 @@
 #include "fpel.h"
 #include "vc1dsp.h"
 
-#if HAVE_6REGS && HAVE_INLINE_ASM
+#if HAVE_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL
+
+void ff_vc1_put_ver_16b_shift2_mmx(int16_t *dst,
+   const uint8_t *src, x86_reg stride,
+   int rnd, int64_t shift);
 
 #define OP_PUT(S,D)
 #define OP_AVG(S,D) "pavgb " #S ", " #D " \n\t"
@@ -66,55 +70,6 @@
  "punpcklwd %%mm7, %%mm7   \n\t"\
  "punpckldq %%mm7, %%mm7   \n\t"
 
-#define SHIFT2_LINE(OFF, R0,R1,R2,R3)   \
-"paddw %%mm"#R2", %%mm"#R1"\n\t"\
-"movd  (%0,%3), %%mm"#R0"  \n\t"\
-"pmullw%%mm6, %%mm"#R1"\n\t"\
-"punpcklbw %%mm0, %%mm"#R0"\n\t"\
-"movd  (%0,%2), %%mm"#R3"  \n\t"\
-"psubw %%mm"#R0", %%mm"#R1"\n\t"\
-"punpcklbw %%mm0, %%mm"#R3"\n\t"\
-"paddw %%mm7, %%mm"#R1"\n\t"\
-"psubw %%mm"#R3", %%mm"#R1"\n\t"\
-"psraw %4, %%mm"#R1"   \n\t"\
-"movq

[FFmpeg-devel] [PATCH 4/4] vc1dsp: Port ff_vc1_put_ver_16b_shift2_mmx to yasm

2015-10-17 Thread Timothy Gu
This function is only used within other inline asm functions, hence the
HAVE_MMX_INLINE guard. Per recent discussions, we should not worry about
the performance of inline asm-only builds.
---
 libavcodec/x86/vc1dsp.asm   | 89 -
 libavcodec/x86/vc1dsp_mmx.c | 59 --
 2 files changed, 95 insertions(+), 53 deletions(-)

diff --git a/libavcodec/x86/vc1dsp.asm b/libavcodec/x86/vc1dsp.asm
index 546688c..87c9191 100644
--- a/libavcodec/x86/vc1dsp.asm
+++ b/libavcodec/x86/vc1dsp.asm
@@ -1,5 +1,6 @@
 ;**
-;* VC1 deblocking optimizations
+;* VC1 DSP optimizations
+;* Copyright (c) 2007 Christophe GISQUET 
 ;* Copyright (c) 2009 David Conrad
 ;*
 ;* This file is part of FFmpeg.
@@ -23,6 +24,7 @@
 
 cextern pw_4
 cextern pw_5
+cextern pw_9
 
 section .text
 
@@ -315,3 +317,88 @@ cglobal vc1_h_loop_filter8, 3,5,8
 START_H_FILTER 8
 VC1_H_LOOP_FILTER 8
 RET
+
+%macro NORMALIZE_MMX 1 ; shift
+paddw m3, m7 ; +bias-r
+paddw m4, m7 ; +bias-r
+psraw m3, %1
+psraw m4, %1
+%endmacro
+
+; Compute the rounder 32-r or 8-r and unpacks it to m7
+%macro LOAD_ROUNDER_MMX 1 ; round
+movd  m7, %1
+punpcklwd m7, m7
+punpckldq m7, m7
+%endmacro
+
+%macro SHIFT2_LINE 5 ; off, r0, r1, r2, r3
+paddw  m%3, m%4
+movd   m%2, [srcq + stride_neg2]
+pmullw m%3, m6
+punpcklbw  m%2, m0
+movd   m%5, [srcq + strideq]
+psubw  m%3, m%2
+punpcklbw  m%5, m0
+paddw  m%3, m7
+psubw  m%3, m%5
+psraw  m%3, shift
+movq   [dstq + %1], m%3
+add   srcq, strideq
+%endmacro
+
+%if HAVE_MMX_INLINE
+INIT_MMX mmx
+; void ff_vc1_put_ver_16b_shift2_mmx(int16_t *dst, const uint8_t *src,
+;x86_reg stride, int rnd, int64_t shift)
+; Sacrificing m6 makes it possible to pipeline loads from src
+%if ARCH_X86_32
+cglobal vc1_put_ver_16b_shift2, 3,6,0, dst, src, stride
+DECLARE_REG_TMP 3, 4, 5
+%define rnd r3mp
+%define shift qword r4m
+%else ; X86_64
+cglobal vc1_put_ver_16b_shift2, 4,7,0, dst, src, stride
+DECLARE_REG_TMP 4, 5, 6
+%define   rnd r3d
+; We need shift either in memory or in a mm reg as it's used in psraw
+; On Windows, the arg is already on the stack
+; On SysV, m5 doesn't seem to be used
+%if WIN64
+%define shift r4mp
+%else ; UNIX64
+%define shift m5
+mova shift, r4q
+%endif ; WIN64
+%endif ; X86_32
+%define stride_neg2 t0q
+%define stride_9minus4 t1q
+%define i t2q
+mov   stride_neg2, strideq
+neg   stride_neg2
+add   stride_neg2, stride_neg2
+leastride_9minus4, [strideq * 9 - 4]
+mov i, 3
+LOAD_ROUNDER_MMX  rnd
+mova   m6, [pw_9]
+pxor   m0, m0
+.loop:
+movh   m2, [srcq]
+add  srcq, strideq
+movh   m3, [srcq]
+punpcklbw  m2, m0
+punpcklbw  m3, m0
+SHIFT2_LINE 0, 1, 2, 3, 4
+SHIFT2_LINE24, 2, 3, 4, 1
+SHIFT2_LINE48, 3, 4, 1, 2
+SHIFT2_LINE72, 4, 1, 2, 3
+SHIFT2_LINE96, 1, 2, 3, 4
+SHIFT2_LINE   120, 2, 3, 4, 1
+SHIFT2_LINE   144, 3, 4, 1, 2
+SHIFT2_LINE   168, 4, 1, 2, 3
+sub  srcq, stride_9minus4
+add  dstq, 8
+dec i
+jnz .loop
+REP_RET
+%endif ; HAVE_MMX_INLINE
diff --git a/libavcodec/x86/vc1dsp_mmx.c b/libavcodec/x86/vc1dsp_mmx.c
index e42099b..f647e33 100644
--- a/libavcodec/x86/vc1dsp_mmx.c
+++ b/libavcodec/x86/vc1dsp_mmx.c
@@ -33,7 +33,11 @@
 #include "fpel.h"
 #include "vc1dsp.h"
 
-#if HAVE_6REGS && HAVE_INLINE_ASM
+#if HAVE_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL
+
+void ff_vc1_put_ver_16b_shift2_mmx(int16_t *dst,
+   const uint8_t *src, x86_reg stride,
+   int rnd, int64_t shift);
 
 #define OP_PUT(S,D)
 #define OP_AVG(S,D) "pavgb " #S ", " #D " \n\t"
@@ -66,55 +70,6 @@
  "punpcklwd %%mm7, %%mm7   \n\t"\
  "punpckldq %%mm7, %%mm7   \n\t"
 
-#define SHIFT2_LINE(OFF, R0,R1,R2,R3)   \
-"paddw %%mm"#R2", %%mm"#R1"\n\t"\
-"movd  (%0,%3), %%mm"#R0"  \n\t"\
-"pmullw%%mm6, %%mm"#R1"\n\t"\
-"punpcklbw %%mm0, %%mm"#R0"\n\t"\
-"movd  (%0,%2), %%mm"#R3"  \n\t"\
-"psubw %%mm"#R0", %%mm"#R1"\n\t"\
-"punpcklbw %%mm0, %%mm"#R3"\n\t"\
-"paddw %%mm7, %%mm"#R1"\n\t"\
-"psubw %%mm"#R3", %%mm"#R1"\n\t"\
-"psraw %4, %%mm"#R1"   \n\t"\
-"movq  %%mm"#R1", "#OFF"(%1)   \n\t"\
-"add   %2, %0  \n\t"
-
-/** Sacrificing mm6 makes it possible to pipeline loads 

[FFmpeg-devel] [PATCH 3/4] x86: vc1dsp_mmx: Move yasm initiation steps to vc1dsp_init

2015-10-17 Thread Timothy Gu
That's where all yasm initiation steps are. Also removes the overlap
between the two files.
---
 libavcodec/x86/vc1dsp_init.c | 36 +---
 libavcodec/x86/vc1dsp_mmx.c  | 27 ---
 2 files changed, 25 insertions(+), 38 deletions(-)

diff --git a/libavcodec/x86/vc1dsp_init.c b/libavcodec/x86/vc1dsp_init.c
index 2bef5f5..8c5fc20 100644
--- a/libavcodec/x86/vc1dsp_init.c
+++ b/libavcodec/x86/vc1dsp_init.c
@@ -63,16 +63,22 @@ static void vc1_h_loop_filter16_sse4(uint8_t *src, int 
stride, int pq)
 ff_vc1_h_loop_filter8_sse4(src,  stride, pq);
 ff_vc1_h_loop_filter8_sse4(src+8*stride, stride, pq);
 }
-static void avg_vc1_mspel_mc00_mmxext(uint8_t *dst, const uint8_t *src,
-  ptrdiff_t stride, int rnd)
-{
-ff_avg_pixels8_mmxext(dst, src, stride, 8);
-}
-static void avg_vc1_mspel_mc00_16_sse2(uint8_t *dst, const uint8_t *src,
-   ptrdiff_t stride, int rnd)
-{
-ff_avg_pixels16_sse2(dst, src, stride, 16);
-}
+
+#define DECLARE_FUNCTION(OP, DEPTH, INSN)   \
+static void OP##vc1_mspel_mc00_##DEPTH##INSN(uint8_t *dst,  \
+ const uint8_t *src, ptrdiff_t stride, int rnd) \
+{   \
+ff_ ## OP ## pixels ## DEPTH ## INSN(dst, src, stride, DEPTH); \
+}
+
+DECLARE_FUNCTION(put_,  8, _mmx)
+DECLARE_FUNCTION(put_, 16, _mmx)
+DECLARE_FUNCTION(avg_,  8, _mmx)
+DECLARE_FUNCTION(avg_, 16, _mmx)
+DECLARE_FUNCTION(avg_,  8, _mmxext)
+DECLARE_FUNCTION(avg_, 16, _mmxext)
+DECLARE_FUNCTION(put_, 16, _sse2)
+DECLARE_FUNCTION(avg_, 16, _sse2)
 
 #endif /* HAVE_YASM */
 
@@ -109,6 +115,11 @@ av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
 #if HAVE_YASM
 if (EXTERNAL_MMX(cpu_flags)) {
 dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = 
ff_put_vc1_chroma_mc8_nornd_mmx;
+
+dsp->put_vc1_mspel_pixels_tab[1][0]  = put_vc1_mspel_mc00_8_mmx;
+dsp->put_vc1_mspel_pixels_tab[0][0]  = put_vc1_mspel_mc00_16_mmx;
+dsp->avg_vc1_mspel_pixels_tab[1][0]  = avg_vc1_mspel_mc00_8_mmx;
+dsp->avg_vc1_mspel_pixels_tab[0][0]  = avg_vc1_mspel_mc00_16_mmx;
 }
 if (EXTERNAL_AMD3DNOW(cpu_flags)) {
 dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = 
ff_avg_vc1_chroma_mc8_nornd_3dnow;
@@ -117,13 +128,16 @@ av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
 ASSIGN_LF(mmxext);
 dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = 
ff_avg_vc1_chroma_mc8_nornd_mmxext;
 
-dsp->avg_vc1_mspel_pixels_tab[1][0]  = avg_vc1_mspel_mc00_mmxext;
+dsp->avg_vc1_mspel_pixels_tab[1][0]  = avg_vc1_mspel_mc00_8_mmxext;
+dsp->avg_vc1_mspel_pixels_tab[0][0]  = 
avg_vc1_mspel_mc00_16_mmxext;
 }
 if (EXTERNAL_SSE2(cpu_flags)) {
 dsp->vc1_v_loop_filter8  = ff_vc1_v_loop_filter8_sse2;
 dsp->vc1_h_loop_filter8  = ff_vc1_h_loop_filter8_sse2;
 dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_sse2;
 dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse2;
+
+dsp->put_vc1_mspel_pixels_tab[0][0]  = put_vc1_mspel_mc00_16_sse2;
 dsp->avg_vc1_mspel_pixels_tab[0][0]  = avg_vc1_mspel_mc00_16_sse2;
 }
 if (EXTERNAL_SSSE3(cpu_flags)) {
diff --git a/libavcodec/x86/vc1dsp_mmx.c b/libavcodec/x86/vc1dsp_mmx.c
index a7eb59d..e42099b 100644
--- a/libavcodec/x86/vc1dsp_mmx.c
+++ b/libavcodec/x86/vc1dsp_mmx.c
@@ -728,39 +728,12 @@ static void vc1_inv_trans_8x8_dc_mmxext(uint8_t *dest, 
int linesize,
 );
 }
 
-#if HAVE_MMX_EXTERNAL
-static void put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src,
-   ptrdiff_t stride, int rnd)
-{
-ff_put_pixels8_mmx(dst, src, stride, 8);
-}
-static void put_vc1_mspel_mc00_16_mmx(uint8_t *dst, const uint8_t *src,
-  ptrdiff_t stride, int rnd)
-{
-ff_put_pixels16_mmx(dst, src, stride, 16);
-}
-static void avg_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src,
-   ptrdiff_t stride, int rnd)
-{
-ff_avg_pixels8_mmx(dst, src, stride, 8);
-}
-static void avg_vc1_mspel_mc00_16_mmx(uint8_t *dst, const uint8_t *src,
-  ptrdiff_t stride, int rnd)
-{
-ff_avg_pixels16_mmx(dst, src, stride, 16);
-}
-#endif
-
 #define FN_ASSIGN(OP, X, Y, INSN) \
 dsp->OP##vc1_mspel_pixels_tab[1][X+4*Y] = OP##vc1_mspel_mc##X##Y##INSN; \
 dsp->OP##vc1_mspel_pixels_tab[0][X+4*Y] = OP##vc1_mspel_mc##X##Y##_16##INSN
 
 av_cold void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
 {
-#if HAVE_MMX_EXTERNAL
-FN_ASSIGN(put_, 0, 0, _mmx);
-FN_ASSIGN(avg_, 0, 0, _mmx);
-#endif
 FN_ASSIGN(put_, 0, 1, _mmx);
 FN_ASSIGN(put_, 0, 2, _mmx);
 FN_ASSIGN(put_, 0, 3, _mmx);
-- 
2.1.4

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

[FFmpeg-devel] [PATCH 1/4] x86: fpel: Move prototypes for 4-px block functions

2015-10-17 Thread Timothy Gu
---
 libavcodec/x86/fpel.h  | 6 ++
 libavcodec/x86/h264_qpel.c | 4 
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/x86/fpel.h b/libavcodec/x86/fpel.h
index 4d93959..625c47d 100644
--- a/libavcodec/x86/fpel.h
+++ b/libavcodec/x86/fpel.h
@@ -22,6 +22,10 @@
 #include 
 #include 
 
+void ff_avg_pixels4_mmx(uint8_t *block, const uint8_t *pixels,
+ptrdiff_t line_size, int h);
+void ff_avg_pixels4_mmxext(uint8_t *block, const uint8_t *pixels,
+   ptrdiff_t line_size, int h);
 void ff_avg_pixels8_mmx(uint8_t *block, const uint8_t *pixels,
 ptrdiff_t line_size, int h);
 void ff_avg_pixels8_mmxext(uint8_t *block, const uint8_t *pixels,
@@ -32,6 +36,8 @@ void ff_avg_pixels16_mmxext(uint8_t *block, const uint8_t 
*pixels,
 ptrdiff_t line_size, int h);
 void ff_avg_pixels16_sse2(uint8_t *block, const uint8_t *pixels,
   ptrdiff_t line_size, int h);
+void ff_put_pixels4_mmx(uint8_t *block, const uint8_t *pixels,
+ptrdiff_t line_size, int h);
 void ff_put_pixels8_mmx(uint8_t *block, const uint8_t *pixels,
 ptrdiff_t line_size, int h);
 void ff_put_pixels8_mmxext(uint8_t *block, const uint8_t *pixels,
diff --git a/libavcodec/x86/h264_qpel.c b/libavcodec/x86/h264_qpel.c
index d9cb5f2..d759e88 100644
--- a/libavcodec/x86/h264_qpel.c
+++ b/libavcodec/x86/h264_qpel.c
@@ -29,10 +29,6 @@
 #include "fpel.h"
 
 #if HAVE_YASM
-void ff_put_pixels4_mmx(uint8_t *block, const uint8_t *pixels,
-ptrdiff_t line_size, int h);
-void ff_avg_pixels4_mmxext(uint8_t *block, const uint8_t *pixels,
-   ptrdiff_t line_size, int h);
 void ff_put_pixels4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t 
*src2,
   int dstStride, int src1Stride, int h);
 void ff_avg_pixels4_l2_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t 
*src2,
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 2/4] x86: fpel: Remove erroneous ff_put_pixels8_mmxext prototype

2015-10-17 Thread Timothy Gu
This function does not exist.
---
 libavcodec/x86/fpel.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/x86/fpel.h b/libavcodec/x86/fpel.h
index 625c47d..4e83cf7 100644
--- a/libavcodec/x86/fpel.h
+++ b/libavcodec/x86/fpel.h
@@ -40,8 +40,6 @@ void ff_put_pixels4_mmx(uint8_t *block, const uint8_t *pixels,
 ptrdiff_t line_size, int h);
 void ff_put_pixels8_mmx(uint8_t *block, const uint8_t *pixels,
 ptrdiff_t line_size, int h);
-void ff_put_pixels8_mmxext(uint8_t *block, const uint8_t *pixels,
-   ptrdiff_t line_size, int h);
 void ff_put_pixels16_mmx(uint8_t *block, const uint8_t *pixels,
  ptrdiff_t line_size, int h);
 void ff_put_pixels16_sse2(uint8_t *block, const uint8_t *pixels,
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH 1/2] avfilter/internal: Doxygen for ff_fmt_is_in

2015-10-17 Thread Timothy Gu
On Sat, Oct 17, 2015 at 7:59 AM Ganesh Ajjanagadde 
wrote:

> On Thu, Oct 15, 2015 at 6:26 AM, Ganesh Ajjanagadde
>  wrote:
> > On Thu, Oct 15, 2015 at 1:45 AM, Timothy Gu 
> wrote:
> >> On Wed, Oct 14, 2015 at 8:05 PM Ganesh Ajjanagadde <
> gajjanaga...@gmail.com>
> >> wrote:
> >>> This clarifies and Doxygen's the comment for ff_fmt_is_in.
> >>
> >>  ^
> >> gajjanag.c:1:23: error: unexpected token ‘adjective’
> >
> > sorry, missing something - does "This clarifies and adds Doxygen for
> > ff_fmt_is_in" fix it?
>

Yes.


> Alternatively, can you tell me what tool
> you used so that I can check locally?
>

I'm pretty sure you already have the tool I used. It's something *very*
local to you, especially to the part of you that is reading this sentence ;)

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


Re: [FFmpeg-devel] [PATCH] chromakey: Use the pixel descriptor API for chroma subsampling info

2015-10-17 Thread Timothy Gu
On Tue, Oct 13, 2015 at 9:33 PM Timothy Gu  wrote:

> ---
>  libavfilter/vf_chromakey.c | 25 +
>  1 file changed, 17 insertions(+), 8 deletions(-)
>

Reviewed by Timo on IRC and pushed.

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


Re: [FFmpeg-devel] [PATCH 1/4] opencl: Print error string when compilation fails

2015-10-16 Thread Timothy Gu
On Wed, Oct 14, 2015 at 2:21 PM Michael Niedermayer 
wrote:

> On Tue, Oct 13, 2015 at 09:48:35PM -0700, Timothy Gu wrote:
> > ---
> >  libavutil/opencl.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
>
> LGTM
>
> thanks
>

Set pushed.

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


Re: [FFmpeg-devel] [PATCH 1/2] avfilter/internal: Doxygen for ff_fmt_is_in

2015-10-14 Thread Timothy Gu
On Wed, Oct 14, 2015 at 8:05 PM Ganesh Ajjanagadde 
wrote:
> This clarifies and Doxygen's the comment for ff_fmt_is_in.

 ^
gajjanag.c:1:23: error: unexpected token ‘adjective’


>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavfilter/internal.h | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/internal.h b/libavfilter/internal.h
> index bb94707..c07d306 100644
> --- a/libavfilter/internal.h
> +++ b/libavfilter/internal.h
> @@ -152,7 +152,13 @@ struct AVFilterInternal {
>  avfilter_execute_func *execute;
>  };
>
> -/** Tell is a format is contained in the provided list terminated by -1.
> */
> +/**
>


> + * Tell if a format is contained in the provided -1 terminated list of
> formats.
>

-1-terminated

Also what's the format supposed to be? If it can be used for all integers
(as the source seems to indicate) then say "tell if an integer is contained
… list of integers. This is useful for determining if BLAH format is in an
array of supported formats."


> + *
> + * @param fmt provided format
> + * @param fmts -1 terminated list of formats
> + * @return 1 if present, 0 if absent
> + */
>  int ff_fmt_is_in(int fmt, const int *fmts);
>

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


Re: [FFmpeg-devel] [PATCH] doc/ffmpeg: use stream_loop instead of loop

2015-10-14 Thread Timothy Gu
On Wed, Oct 14, 2015 at 8:08 PM Ganesh Ajjanagadde 
wrote:

> pushed. Please let me know if such things are ok or not in the future
> - technically I guess doc maintainers need to respond before I can
> push, but as this change was trivial I thought I would do it.\
>

As a documentation maintainer, I'm comfortable to say that changes like
this can be directly pushed without first sending it to the ML.

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


Re: [FFmpeg-devel] [PATCH] .gitignore: some font temporaries

2015-10-13 Thread Timothy Gu
On Tue, Oct 13, 2015 at 6:24 PM Ganesh Ajjanagadde  wrote:

> On Tue, Oct 13, 2015 at 9:20 PM, Timothy Gu  wrote:
> > Patch LGTM.
>
> Go ahead and push


Pushed, thanks.

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


[FFmpeg-devel] [PATCH 4/4] opencl: Force the use of 1.2 APIs

2015-10-13 Thread Timothy Gu
Silences warnings regarding `clCreateCommandQueue` being deprecated.

Only a very limited number of products support 2.0. Since the
replacement API (`clCreateCommandQueueWithProperties`) is only available
in 2.0, we should not update it just yet.
---
 libavutil/opencl.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavutil/opencl.h b/libavutil/opencl.h
index e423e55..168461d 100644
--- a/libavutil/opencl.h
+++ b/libavutil/opencl.h
@@ -32,6 +32,7 @@
 #ifndef LIBAVUTIL_OPENCL_H
 #define LIBAVUTIL_OPENCL_H
 
+#define CL_USE_DEPRECATED_OPENCL_1_2_APIS 1
 #ifdef __APPLE__
 #include 
 #else
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 3/4] opencl: Use "opencl" as log context name

2015-10-13 Thread Timothy Gu
All other classes use lowercase names.
---
 libavutil/opencl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/opencl.c b/libavutil/opencl.c
index f720ce0..62706f3 100644
--- a/libavutil/opencl.c
+++ b/libavutil/opencl.c
@@ -84,7 +84,7 @@ static const AVOption opencl_options[] = {
 };
 
 static const AVClass openclutils_class = {
-.class_name= "OPENCLUTILS",
+.class_name= "opencl",
 .option= opencl_options,
 .item_name = av_default_item_name,
 .version   = LIBAVUTIL_VERSION_INT,
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 2/4] opencl: Print compilation log

2015-10-13 Thread Timothy Gu
Useful when debugging.
---
 libavutil/opencl.c | 33 ++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/libavutil/opencl.c b/libavutil/opencl.c
index c2956fd..f720ce0 100644
--- a/libavutil/opencl.c
+++ b/libavutil/opencl.c
@@ -449,12 +449,14 @@ end:
 cl_program av_opencl_compile(const char *program_name, const char *build_opts)
 {
 int i;
-cl_int status;
+cl_int status, build_status;
 int kernel_code_idx = 0;
 const char *kernel_source;
 size_t kernel_code_len;
 char* ptr = NULL;
 cl_program program = NULL;
+size_t log_size;
+char *log = NULL;
 
 LOCK_OPENCL;
 for (i = 0; i < opencl_ctx.kernel_code_count; i++) {
@@ -481,11 +483,36 @@ cl_program av_opencl_compile(const char *program_name, 
const char *build_opts)
 program = NULL;
 goto end;
 }
-status = clBuildProgram(program, 1, &(opencl_ctx.device_id), build_opts, 
NULL, NULL);
+
+build_status = clBuildProgram(program, 1, &(opencl_ctx.device_id), 
build_opts, NULL, NULL);
+status = clGetProgramBuildInfo(program, opencl_ctx.device_id,
+   CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size);
 if (status != CL_SUCCESS) {
+av_log(&opencl_ctx, AV_LOG_WARNING,
+   "Failed to get compilation log: %s\n",
+   av_opencl_errstr(status));
+} else {
+log = av_malloc(log_size);
+if (log) {
+status = clGetProgramBuildInfo(program, opencl_ctx.device_id,
+   CL_PROGRAM_BUILD_LOG, log_size,
+   log, NULL);
+if (status != CL_SUCCESS) {
+av_log(&opencl_ctx, AV_LOG_WARNING,
+   "Failed to get compilation log: %s\n",
+   av_opencl_errstr(status));
+} else {
+int level = build_status == CL_SUCCESS ? AV_LOG_DEBUG :
+ AV_LOG_ERROR;
+av_log(&opencl_ctx, level, "Compilation log:\n%s\n", log);
+}
+}
+av_freep(&log);
+}
+if (build_status != CL_SUCCESS) {
 av_log(&opencl_ctx, AV_LOG_ERROR,
"Compilation failed with OpenCL program '%s': %s\n",
-   program_name, av_opencl_errstr(status));
+   program_name, av_opencl_errstr(build_status));
 program = NULL;
 goto end;
 }
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 1/4] opencl: Print error string when compilation fails

2015-10-13 Thread Timothy Gu
---
 libavutil/opencl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/opencl.c b/libavutil/opencl.c
index 8686493..c2956fd 100644
--- a/libavutil/opencl.c
+++ b/libavutil/opencl.c
@@ -484,7 +484,8 @@ cl_program av_opencl_compile(const char *program_name, 
const char *build_opts)
 status = clBuildProgram(program, 1, &(opencl_ctx.device_id), build_opts, 
NULL, NULL);
 if (status != CL_SUCCESS) {
 av_log(&opencl_ctx, AV_LOG_ERROR,
-   "Compilation failed with OpenCL program: %s\n", program_name);
+   "Compilation failed with OpenCL program '%s': %s\n",
+   program_name, av_opencl_errstr(status));
 program = NULL;
 goto end;
 }
-- 
2.1.4

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


[FFmpeg-devel] [PATCH] chromakey: Use the pixel descriptor API for chroma subsampling info

2015-10-13 Thread Timothy Gu
---
 libavfilter/vf_chromakey.c | 25 +
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/libavfilter/vf_chromakey.c b/libavfilter/vf_chromakey.c
index 47fdea631..3309748 100644
--- a/libavfilter/vf_chromakey.c
+++ b/libavfilter/vf_chromakey.c
@@ -35,6 +35,9 @@ typedef struct ChromakeyContext {
 float blend;
 
 int is_yuv;
+
+int hsub_log2;
+int vsub_log2;
 } ChromakeyContext;
 
 static uint8_t do_chromakey_pixel(ChromakeyContext *ctx, uint8_t u[9], uint8_t 
v[9])
@@ -79,24 +82,17 @@ static int do_chromakey_slice(AVFilterContext *avctx, void 
*arg, int jobnr, int
 
 ChromakeyContext *ctx = avctx->priv;
 
-int hsub_log2 = 0, vsub_log2 = 0;
 int x, y, xo, yo;
 uint8_t u[9], v[9];
 
 memset(u, ctx->chromakey_uv[0], sizeof(u));
 memset(v, ctx->chromakey_uv[1], sizeof(v));
 
-if (frame->format == AV_PIX_FMT_YUVA420P || frame->format == 
AV_PIX_FMT_YUVA422P)
-hsub_log2 = 1;
-
-if (frame->format == AV_PIX_FMT_YUVA420P)
-vsub_log2 = 1;
-
 for (y = slice_start; y < slice_end; ++y) {
 for (x = 0; x < frame->width; ++x) {
 for (yo = 0; yo < 3; ++yo) {
 for (xo = 0; xo < 3; ++xo) {
-get_pixel_uv(frame, hsub_log2, vsub_log2, x + xo - 1, y + 
yo - 1, &u[yo * 3 + xo], &v[yo * 3 + xo]);
+get_pixel_uv(frame, ctx->hsub_log2, ctx->vsub_log2, x + xo 
- 1, y + yo - 1, &u[yo * 3 + xo], &v[yo * 3 + xo]);
 }
 }
 
@@ -155,12 +151,25 @@ static av_cold int query_formats(AVFilterContext *avctx)
 return ff_set_common_formats(avctx, formats);
 }
 
+static av_cold int config_input(AVFilterLink *inlink)
+{
+AVFilterContext *avctx = inlink->dst;
+ChromakeyContext *ctx = avctx->priv;
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
+
+ctx->hsub_log2 = desc->log2_chroma_w;
+ctx->vsub_log2 = desc->log2_chroma_h;
+
+return 0;
+}
+
 static const AVFilterPad chromakey_inputs[] = {
 {
 .name   = "default",
 .type   = AVMEDIA_TYPE_VIDEO,
 .needs_writable = 1,
 .filter_frame   = filter_frame,
+.config_props   = config_input,
 },
 { NULL }
 };
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH 3/3][RFC] avfilter/vf_chromakey: Add OpenCL acceleration

2015-10-13 Thread Timothy Gu
On Tue, Oct 13, 2015 at 3:28 AM Timo Rothenpieler 
wrote:

> > Hi
> >
> > I use your filter, but the kernel can't pass the compile, you should
> consider the "double" type in the kernel, some GPU card does not support
> double type
> > I add "#pragma OPENCL_EXTENSION cl_khr_fp64: enable " to the kernel, but
> it does not works
> >
> > I will check the error tomorrow
>
> I tested this filter on Nvidia on Linux, using driver 355 and on the
> Intel CPU-based OpenCL SDK so far.
> Using floats potentially has an impact on the keying quality.
>

Segfaults here with ffmpeg -f lavfi -i allrgb -vf chromakey=green:opencl=1
-f null -

gdb doesn't give anything useful:

$ gdb ffmpeg_g
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ffmpeg_g...done.
(gdb) r -loglevel debug -f lavfi -i allrgb -vf chromakey=green:opencl=1 -f
null -
Starting program: /home/timothy-gu/ffmpeg/ffmpeg/ffmpeg_g -loglevel debug
-f lavfi -i allrgb -vf chromakey=green:opencl=1 -f null -
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
ffmpeg version N-75973-g3cff255 Copyright (c) 2000-2015 the FFmpeg
developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --enable-gpl --enable-libass --enable-libfdk-aac
--enable-libfreetype --enable-libmp3lame --enable-libopus
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264
--enable-nonfree --extra-ldflags='-L/opt/intel/opencl-1.2-5.0.0.57/lib64
-Wl,-rpath,/opt/intel/opencl-1.2-5.0.0.57/lib64' --enable-opencl
  libavutil  55.  3.100 / 55.  3.100
  libavcodec 57.  5.100 / 57.  5.100
  libavformat57.  3.100 / 57.  3.100
  libavdevice57.  0.100 / 57.  0.100
  libavfilter 6. 11.100 /  6. 11.100
  libswscale  4.  0.100 /  4.  0.100
  libswresample   2.  0.100 /  2.  0.100
  libpostproc54.  0.100 / 54.  0.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'lavfi'.
Reading option '-i' ... matched as input file with argument 'allrgb'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with
argument 'chromakey=green:opencl=1'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'null'.
Reading option '-' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file allrgb.
Applying option f (force format) with argument lavfi.
Successfully parsed a group of options.
Opening an input file: allrgb.
detected 4 logical cores
[New Thread 0x7fffed3b9700 (LWP 13438)]
[New Thread 0x7fffecbb8700 (LWP 13439)]
[New Thread 0x7fffec3b7700 (LWP 13440)]
[New Thread 0x7fffebbb6700 (LWP 13441)]
[New Thread 0x7fffeb3b5700 (LWP 13442)]
[Parsed_allrgb_0 @ 0x1bb0fa0] size:4096x4096 rate:25/1 duration:-1.00
sar:1/1
[AVFilterGraph @ 0x1baff00] query_formats: 2 queried, 1 merged, 0 already
done, 0 delayed
[lavfi @ 0x1baf700] All info found
Input #0, lavfi, from 'allrgb':
  Duration: N/A, start: 0.00, bitrate: N/A
Stream #0:0, 1, 1/25: Video: rawvideo, 1 reference frame (RGB[24] /
0x18424752), rgb24, 4096x4096 [SAR 1:1 DAR 1:1], 1/25, 25 tbr, 25 tbn, 25
tbc
Successfully opened the file.
Parsing a group of options: output file -.
Applying option vf (set video filters) with argument
chromakey=green:opencl=1.
Applying option f (force format) with argument null.
Successfully parsed a group of options.
Opening an output file: -.
Successfully opened the file.
[New Thread 0x7fffe4bb2700 (LWP 13443)]
[New Thread 0x7fffe43b1700 (LWP 13444)]
[New Thread 0x7fffe3bb0700 (LWP 13445)]
[New Thread 0x7fffe33af700 (LWP 13446)]
[New Thread 0x7fffe2bae700 (LWP 13447)]
[Parsed_chromakey_0 @ 0x1bb52a0] S

Re: [FFmpeg-devel] [PATCH] .gitignore: some font temporaries

2015-10-13 Thread Timothy Gu
El martes, 13 de octubre de 2015, Michael Niedermayer
 escribió:

> On Sun, Oct 11, 2015 at 04:27:49PM -0400, Ganesh Ajjanagadde wrote:
> > ---
> >  .gitignore | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/.gitignore b/.gitignore
> > index 0b26f68..b215828 100644
> > --- a/.gitignore
> > +++ b/.gitignore
> > @@ -3,3 +3,4 @@
> >  /htdocs/main.rss
> >  /htdocs/components
> >  /htdocs/style.less
> > +/htdocs/fonts/*.woff2
>
> what generates these woff2 files ?


They are first installed to htdocs/ components with Bower (a local package
manager for the web) and then copied to htdocs/:
https://github.com/FFmpeg/web/blob/master/Makefile#L64

Patch LGTM.

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


Re: [FFmpeg-devel] [PATCH] intmath: remove av_ctz.

2015-10-11 Thread Timothy Gu
On Sun, Oct 11, 2015 at 6:31 PM Ganesh Ajjanagadde  wrote:

> Just to make this clear: suppose (hypothetically) av_ctz was public.
> If my application never used av_ctz, but I (or my distro) upgrades
> libav*, then I don't need to recompile/relink my code?
>

If we are only talking about av_ctz here, no, you don't need to rebuild
your code. But if a user uses a new libavutil but an old libavcodec that
still uses av_ctz, things will crash and burn.

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


Re: [FFmpeg-devel] setting up a proper Github mirror

2015-10-11 Thread Timothy Gu
On Sun, Oct 11, 2015 at 12:16 PM Ganesh Ajjanagadde 
wrote:

> Alternatively (for now, more sustainable is a proper hook), could you
> post here your alias to do this?
>

git remote set-url origin --push --add g...@github.com:FFmpeg/FFmpeg.git

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


Re: [FFmpeg-devel] [PATCH] intmath: remove av_ctz.

2015-10-11 Thread Timothy Gu
On Sun, Oct 11, 2015 at 11:29 AM Ronald S. Bultje 
wrote:

> It's an a non-installed header and only used in one place (flacenc).
> Since ff_ctz is static inline, it's fine to use that instead.
> ---
>  libavcodec/flacenc.c | 2 +-
>  libavutil/intmath.c  | 5 -
>  libavutil/intmath.h  | 8 
>  3 files changed, 1 insertion(+), 14 deletions(-)
>

Should we change ff_ctz to avpriv_ctz? Using a ff_ from another library
just doesn't look right. (Or we could remove the prefix like emms_c but
ctz() sounds too generic)

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


Re: [FFmpeg-devel] setting up a proper Github mirror

2015-10-11 Thread Timothy Gu
On Sun, Oct 11, 2015 at 11:44 AM Ganesh Ajjanagadde 
wrote:

> I noticed that the Github mirror: https://github.com/FFmpeg/FFmpeg is
> over 3 hours out of sync with the main repos, making it unusable as a
> fetch url for development. Anyone knows why this is the case?
>

It is not an automatic mirror, and it is only updated when Michael or I
pushes since a) only three people have been added to the FFmpeg
organization and b) only Michael and I bothered to add Git aliases.

Same goes for the other repos.

Also, it looks like one can set some fancy UI illustrating that it is
> a mirror, see for instance: https://github.com/coreutils/coreutils.
> Anyone knows how to do this?
>

One has to contact GitHub for it. I tried doing that a long time ago but
they said they would do it only if Michael asked for it, and I didn't
bother.

Plus the mirror symbol doesn't offer any advantages:

1. pull requests still cannot be disabled
2. one still has to manually push to the GitHub mirror, either by hand or
through a receive hook on the server IIRC

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


Re: [FFmpeg-devel] [PATCH] configure: fix configure when using gcc

2015-10-11 Thread Timothy Gu
On Sun, Oct 11, 2015 at 8:21 AM Ganesh Ajjanagadde 
wrote:

> Fixes Ticket4922.
>
> Commit 060102389e572abb2beaed3b9f5e1036aeea43f1 broke configure.
>
> From: Jean-Yves Avenard 
>

You might want to use `git commit --author` instead of manually adding a
"From" line in the commit message body.

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


Re: [FFmpeg-devel] av_ctz optimization

2015-10-11 Thread Timothy Gu
On Sun, Oct 11, 2015 at 9:10 AM Ganesh Ajjanagadde  wrote:

> Isn't that an API change and not an ABI change (it was in doc/APIchanges)?
>

No, since intmath.h is not public.

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


Re: [FFmpeg-devel] FFmpeg 2.8.1

2015-10-10 Thread Timothy Gu
On Sat, Oct 10, 2015 at 7:20 AM Ganesh Ajjanagadde  wrote:

> On Thu, Oct 8, 2015 at 8:37 AM, Michael Niedermayer
>  wrote:
> > Hi
> >
> > ill make 2.8.1 soon from release/2.8
> > if you want something backported push it to release/2.8 soon!
> > (or ask me to pull from your git tree, or if its trivial without
> >  conflicts then the commit hash to cherry pick is fine too)
>
> Can someone direct me to a doc on what should and should not be
> backported?


https://www.ffmpeg.org/developer.html#Criteria-for-Point-Releases-1

In my simplistic view, although e.g not all undefined behaviors are
> exploitable, I still consider such things worthy of a backport as they
> don't introduce any new features, and fix bugs. Similarly, I consider
> all clean, simple bug fixes worthy of a backport.
>

I would agree with this view.

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


Re: [FFmpeg-devel] [PATCH] configure: disabling --enable-libmfx and --enable-gpl combination

2015-10-08 Thread Timothy Gu
On Thu, Oct 8, 2015 at 9:55 AM Ivan Uskov  wrote:

> Hello Hendrik,
>
> Thursday, October 8, 2015, 7:03:36 PM, you wrote:
>
> HL> That doesn't seem correct to me. The mfx dispatcher library has the BSD
> HL> license plastered all over it. BSD is compatible with the GPL.
> Dispatcher, yes, but mfx library by itself which loaded by dispatcher is
> not.
>

I don't think GPL has any provisions for dynamic loading, only linking.

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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/alacdec: split off decorrelate_stereo and append_extra_bits as alacdsp

2015-10-04 Thread Timothy Gu
On Sun, Oct 4, 2015 at 2:21 PM Michael Niedermayer  wrote:

> there is a spec ?
>

Don't think so for the codec itself.


> i only know of soe reference source code and i looked yesterday
> and it usesed the full 8 bits unless i missed something
>

 https://alac.macosforge.org/trac/browser/trunk/codec/ALACEncoder.cpp says
that mixRes (aka decorr_left_weight) can be up to 4.

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


Re: [FFmpeg-devel] [PATCH 0/7] [RFC] x86 assembly constants

2015-10-02 Thread Timothy Gu
On Fri, Oct 2, 2015 at 10:08 AM James Darnley 
wrote:

> The third patch uses them in the remaining inline assembly.
>

That's the crux of the problem: inline asm uses these constants, but will
be unable to without yasm. Either we drop compatibility for inline asm for
x86 platforms w/o yasm, or we can't do this.

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


Re: [FFmpeg-devel] pngdec failing with an assertion

2015-09-27 Thread Timothy Gu
El domingo, 27 de septiembre de 2015, Gonzalo  escribió:

>
>
> El 27/09/15 a las 22:45, Gonzalo escribió:
>
>> $ ffplay /media/Linux/anims/wildlife/wildlife.%04d.png
>> ffplay version N-75563-g235381e Copyright (c) 2003-2015 the FFmpeg
>> developers
>>   built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
>>   configuration: --enable-gpl --enable-shared --enable-gray
>> --enable-runtime-cpudetect --enable-bzlib --enable-libfreetype
>> --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx
>> --enable-libx264 --enable-zlib
>>   libavutil  55.  2.100 / 55.  2.100
>>   libavcodec 57.  3.100 / 57.  3.100
>>   libavformat57.  2.100 / 57.  2.100
>>   libavdevice57.  0.100 / 57.  0.100
>>   libavfilter 6.  8.100 /  6.  8.100
>>   libswscale  4.  0.100 /  4.  0.100
>>   libswresample   2.  0.100 /  2.  0.100
>>   libpostproc54.  0.100 / 54.  0.100
>> Input #0, image2, from '/media/Linux/anims/wildlife/wildlife.%04d.png':
>>   Duration: 00:00:10.08, start: 0.00, bitrate: N/A
>> Stream #0:0: Video: png, rgba64be(pc), 1280x720 [SAR 2834:2834 DAR
>> 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
>> Assertion 0 failed at libavcodec/pngdec.c:666
>> Abortado (`core' generado)
>>
>> The same set of files loads fine with a previous ffmpeg version (6 months
>> ago).
>>
>
> Also, the individual files load fine.  It is just the sequence that does
> not work.
>
>
Please file a ticket at trac.ffmpeg.org with the source PNGs attached to it.

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


Re: [FFmpeg-devel] [PATCH] ffplay: add support for interactive volume control

2015-09-26 Thread Timothy Gu
On Sat, Sep 26, 2015 at 7:47 AM, Ganesh Ajjanagadde
 wrote:
> diff --git a/ffplay.c b/ffplay.c
> index d302793..4f3322b 100644
> --- a/ffplay.c
> +++ b/ffplay.c
> @@ -1348,6 +1353,25 @@ static void toggle_pause(VideoState *is)
>  is->step = 0;
>  }
>
> +static void toggle_mute(VideoState *is)
> +{
> +is->muted = !is->muted;
> +}
> +

> +static void update_volume(VideoState *is, int sign, int step)
> +{
> +if (sign > 0) {
> +is->audio_volume += step;
> +if (is->audio_volume > SDL_MIX_MAXVOLUME)
> +is->audio_volume = SDL_MIX_MAXVOLUME;
> +}
> +else {
> +is->audio_volume -= step;
> +if (is->audio_volume < 0)
> +is->audio_volume = 0;
> +}
> +}

AV_CLIP?

> +
>  static void step_to_next_frame(VideoState *is)
>  {
>  /* if the stream is paused unpause it, then step */
> @@ -2447,7 +2471,10 @@ static void sdl_audio_callback(void *opaque, Uint8 
> *stream, int len)
>  len1 = is->audio_buf_size - is->audio_buf_index;
>  if (len1 > len)
>  len1 = len;
> -memcpy(stream, (uint8_t *)is->audio_buf + is->audio_buf_index, len1);
> +if (is->muted)

> +SDL_MixAudio(stream, (uint8_t *)is->audio_buf + 
> is->audio_buf_index, len1, 0);

memset?

> +else
> +SDL_MixAudio(stream, (uint8_t *)is->audio_buf + 
> is->audio_buf_index, len1, is->audio_volume);
>  len -= len1;
>  stream += len1;
>  is->audio_buf_index += len1;

> @@ -3740,6 +3780,8 @@ int main(int argc, char **argv)
>  SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE);
>  SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
>
> +SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 
> SDL_DEFAULT_REPEAT_INTERVAL);
> +
>  if (av_lockmgr_register(lockmgr)) {
>  av_log(NULL, AV_LOG_FATAL, "Could not initialize lock manager!\n");
>  do_exit(NULL);

Separate patch please.

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


Re: [FFmpeg-devel] [PATCH 4/4] lavc: deprecate aac_adtstoasc BSF; remove warnings referencing it

2015-09-21 Thread Timothy Gu
On Mon, Sep 21, 2015 at 6:51 PM Rodger Combs  wrote:

> ---
>  doc/bitstream_filters.texi | 11 ---
>  libavcodec/aac_adtstoasc_bsf.c | 74
> ++
>  libavformat/flvenc.c   |  6 
>  libavformat/movenc.c   |  6 
>  4 files changed, 2 insertions(+), 95 deletions(-)
>

Change log entry needed.

[...]

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


Re: [FFmpeg-devel] [PATCH 1/4] lavc/aacdec: handle case where extradata is set between init and first packet

2015-09-21 Thread Timothy Gu
On Mon, Sep 21, 2015 at 6:50 PM Rodger Combs  wrote:

> ---
>  libavcodec/aacdec_template.c | 8 
>  1 file changed, 8 insertions(+)
>
> diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
> index c2d7d05..a999013 100644
> --- a/libavcodec/aacdec_template.c
> +++ b/libavcodec/aacdec_template.c
> @@ -3118,6 +3118,14 @@ static int aac_decode_frame(AVCodecContext *avctx,
> void *data,
>  }
>  }
>
> +if (!avctx->channels && avctx->extradata_size > 0) {
> +if ((err = decode_audio_specific_config(ac, ac->avctx,
> &ac->oc[1].m4ac,
> +avctx->extradata,
> +avctx->extradata_size *
> 8LL,
> +1)) < 0)
> +return AVERROR_INVALIDDATA;
>

return err; ?


> +}
> +
>  ac->dmono_mode = 0;
>  if (jp_dualmono && jp_dualmono_size > 0)
>  ac->dmono_mode =  1 + *jp_dualmono;
>

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


Re: [FFmpeg-devel] [PATCH] avformat/format: silence -Wdiscarded-qualifiers

2015-09-16 Thread Timothy Gu
On Wed, Sep 16, 2015 at 6:09 PM Michael Niedermayer 
wrote:

> this is wrong, the buffer is constant
> if the content of the buffer would change that would be a serious
> bug.
> Before this change the compiler would detect direct changes done to
> the buffer
>

Commit reverted before a consensus is reached.

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


Re: [FFmpeg-devel] [PATCH] swscale/swscale: silence unused function warning

2015-09-16 Thread Timothy Gu
On Wed, Sep 16, 2015 at 2:20 PM, Ganesh Ajjanagadde
 wrote:
> gamma_convert is only used with the old code. Thus, it is
> placed under a header guard. This patch silences a -Wunused-function
> observed on GCC 5.2.
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libswscale/swscale.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied, thanks.

[...]

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


Re: [FFmpeg-devel] [PATCH] avformat/mpjpegdec: silence unused variable/function warnings

2015-09-16 Thread Timothy Gu
On Wed, Sep 16, 2015 at 2:25 PM, Ganesh Ajjanagadde
 wrote:
> Silences a -Wunused-variable and -Wunused-function observed under GCC 5.2.
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavformat/mpjpegdec.c | 16 
>  1 file changed, 16 deletions(-)

Applied, thanks.

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


Re: [FFmpeg-devel] [PATCH] avformat/format: silence -Wdiscarded-qualifiers

2015-09-16 Thread Timothy Gu
On Wed, Sep 16, 2015 at 3:50 PM, Ganesh Ajjanagadde
 wrote:
> lpd.buf is non-const and discards the const qualifier of zerobuffer.
> This fixes -Wdiscarded-qualifiers observed with GCC 5.2.
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavformat/format.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

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


Re: [FFmpeg-devel] [PATCH] configure: Print large lists in more columns if the screen size allows

2015-09-15 Thread Timothy Gu
On Mon, Sep 14, 2015 at 5:09 PM Ganesh Ajjanagadde  wrote:

> Shouldn't this function be renamed, since it no longer necessarily
> prints in 3 columns?
>

Applied with that change.

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


Re: [FFmpeg-devel] [PATCH] configure: make assignment of variable to '=' explicit

2015-09-15 Thread Timothy Gu
On Sat, Sep 12, 2015 at 11:28 PM Ganesh Ajjanagadde 
wrote:

> op== is confusing, as it may easily be mistook for an equality check,
> while in reality it is doing an assigment to '='.
> This patch has the additional benefit of cleaning up 2 warnings from
> shellcheck.net.
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  configure | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

Applied, thanks.

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


[FFmpeg-devel] [PATCH] configure: Print large lists in more columns if the screen size allows

2015-09-14 Thread Timothy Gu
---
 configure | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index da18e70..3dfbb91 100755
--- a/configure
+++ b/configure
@@ -425,7 +425,10 @@ if test -t 1 && which tput >/dev/null; then
 error_color=$(tput setaf 1)
 reset_color=$(tput sgr0)
 fi
+# 72 used instead of 80 since that's the default of pr
+ncols=$(tput cols)
 fi
+: ${ncols:=72}
 
 log(){
 echo "$@" >> $logfile
@@ -3042,7 +3045,8 @@ die_unknown(){
 }
 
 print_3_columns() {
-cat | tr ' ' '\n' | sort | pr -r -3 -t
+cols=$(expr $ncols / 24)
+cat | tr ' ' '\n' | sort | pr -r "-$cols" -w $ncols -t
 }
 
 show_list() {
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] configure: colorize error messages

2015-09-09 Thread Timothy Gu
On Wed, Sep 9, 2015 at 11:15 AM Ganesh Ajjanagadde 
wrote:

> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  configure | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 056feea..4842b52 100755
> --- a/configure
> +++ b/configure
> @@ -421,6 +421,7 @@ if test -t 1 && which tput >/dev/null; then
>  if test -n "$ncolors" && test $ncolors -ge 8; then
>  bold_color=$(tput bold)
>  warn_color=$(tput setaf 3)
> +error_color=$(tput setaf 1)
>  reset_color=$(tput sgr0)
>  fi
>  fi
> @@ -437,7 +438,7 @@ log_file(){
>
>  echolog(){
>  log "$@"
> -echo "$@"
> +echo "$error_color$bold_color$@$reset_color"
>  }
>

You can inline this function in die() which is the only place this is used.
The function name `echolog` doesn't do anything to indicate that what's
echoed is an error.

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


Re: [FFmpeg-devel] [PATCH] configure: colorize warnings on Windows

2015-09-08 Thread Timothy Gu
On Tue, Sep 8, 2015 at 12:18 PM Ganesh Ajjanagadde 
wrote:

>  quotes='""'
> -if test -t 1 && which tput >/dev/null; then
> -ncolors=$(tput colors)
> -if test -n "$ncolors" && test $ncolors -ge 8; then
> -bold_color=$(tput bold)
> -warn_color=$(tput setaf 3)
> -reset_color=$(tput sgr0)
> +if test -t 1; then
> +if which tput >/dev/null; then
> +ncolors=$(tput colors)
> +if test -n "$ncolors" && test $ncolors -ge 8; then
> +bold_color=$(tput bold)
> +warn_color=$(tput setaf 3)
> +reset_color=$(tput sgr0)
> +fi
>


> +else
>

1. This doesn't check for Windows.
2. Not all Windows terminals support ANSI color codes.


> +bold_color=""
> +warn_color=$'\033[33;1m'
> +reset_color=$'\033[0m'
>  fi
>  fi
>

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


Re: [FFmpeg-devel] [PATCH] aacenc: set default coding tools by profile

2015-09-01 Thread Timothy Gu
On Tue, Sep 1, 2015 at 6:46 PM Rostislav Pehlivanov 
wrote:

>  /**
> + * List of currently supported profiles, anything not listed isn't
> supported.
> + */
>


> +struct AACProfileOptions aacenc_profiles[] = {
>

static const?


> +{FF_PROFILE_AAC_LOW,
> +{  /* Default profile, these are the settings that get set by
> default */
> +.stereo_mode = 0,
> +.aac_coder = AAC_CODER_TWOLOOP,
> +.pns = 1,
> +.tns = 0,
> +.pred = OPT_NEEDS_MAIN,
> +.intensity_stereo = 1,
> +},
> +},
> +{FF_PROFILE_MPEG2_AAC_LOW,
> +{  /* Strict MPEG 2 Part 7 compliance profile */
> +.stereo_mode = 0,
> +.aac_coder = AAC_CODER_TWOLOOP,
> +.pns = OPT_BANNED,
> +.tns = 0,
> +.pred = OPT_BANNED,
> +.intensity_stereo = 1,
> +},
> +},
> +{FF_PROFILE_AAC_MAIN,
> +{  /* Main profile, all advanced encoding abilities enabled */
> +.stereo_mode = 0,
> +.aac_coder = AAC_CODER_TWOLOOP,
> +.pns = 1,
> +.tns = 0,
> +.pred = OPT_REQUIRED,
> +.intensity_stereo = 0,
> +},
> +},
> +};
>

You could consider using the FF_PROFILE_ macros as the array index.

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


Re: [FFmpeg-devel] PATCH: better message that ffplay is not going to be built

2015-08-27 Thread Timothy Gu
On Thu, Aug 27, 2015 at 06:36:00PM -0400, Ganesh Ajjanagadde wrote:
> Please add the area (e.g configure:...) to the commit message.
> More generally, I suggest a slight cleanup of the commit message:
> first line-> "configure: print out enabled programs"
> skip a blank line, body-> "This prints out a better error message that
> ffplay is not being built by printing out what will be built. Based on
> patch by Moritz Barsnick."

Done.

> Otherwise, LGTM.

Patch applied. Thanks to all.

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


Re: [FFmpeg-devel] [PATCH] configure: colorize warning messages

2015-08-27 Thread Timothy Gu
On Thu, Aug 27, 2015 at 06:17:32PM -0400, Ganesh Ajjanagadde wrote:
> This patch introduces color warning messages (yellow).
> Tested with zsh, bash, and sh (bash under --posix).
> 
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  configure | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

I'm concerned that this would trash the configure output when it is
viewed with something not supporting ANSI support codes. For example,
when one pipes the output to a file.

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


Re: [FFmpeg-devel] [PATCH] ffmpeg_opt: Add -hwaccels option that lists all supported hwaccels

2015-08-26 Thread Timothy Gu
On Tue, Aug 25, 2015 at 09:25:14PM -0400, Ganesh Ajjanagadde wrote:
> Ok. Please place the function outside of all the opt_* stuff;
> since this is not setting options, it should not be in the middle of them.
> Otherwise, patch LGTM.

Pushed with the changes.

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


Re: [FFmpeg-devel] [PATCH] ffmpeg_opt: Add -hwaccels option that lists all supported hwaccels

2015-08-25 Thread Timothy Gu
On Tue, Aug 25, 2015 at 08:19:59PM -0400, Ganesh Ajjanagadde wrote:
> For consistency, prefix with an opt_?

This name is chosen to be consistent with other show_ functions. opt_*
are exclusively used for setting some options AFAICT.

> Maybe you could check the return value of printf?

Absolutely zero calls to printf in FFmpeg are checked. Even if checking
the result code can be more secure, it is way outside the scope of this
patch.

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


Re: [FFmpeg-devel] [PATCH] ffmpeg_opt: Add -hwaccels option that lists all supported hwaccels

2015-08-25 Thread Timothy Gu
On Tue, Aug 25, 2015 at 08:28:43PM -0400, Ganesh Ajjanagadde wrote:
> On Tue, Aug 25, 2015 at 8:08 PM, Timothy Gu  wrote:
> >
> > cmdutils.c is shared for all ff* programs. -hwaccel is only supported in
> > ffmpeg.
> 
> Why?

Because nobody has implemented it for other fftools yet.

> I don't know about this and I might be naive here,
> but isn't hardware acceleration useful for decoding as well?

The existing hwaccel is only for decoding.

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


Re: [FFmpeg-devel] [PATCH] ffmpeg_opt: Add -hwaccels option that lists all supported hwaccels

2015-08-25 Thread Timothy Gu
On Tue, Aug 25, 2015 at 5:06 PM Ganesh Ajjanagadde  wrote:

> On Tue, Aug 25, 2015 at 7:47 PM, Timothy Gu  wrote:
> > ---
> >  doc/ffmpeg.texi |  4 
> >  ffmpeg_opt.c| 14 ++
> >  2 files changed, 18 insertions(+)
> >
> > diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
> > index 51a4ec5..e1d8562 100644
> > --- a/doc/ffmpeg.texi
> > +++ b/doc/ffmpeg.texi
> > @@ -698,6 +698,10 @@ is not specified, the value of the @var{DISPLAY}
> environment variable is used
> >  For DXVA2, this option should contain the number of the display adapter
> to use.
> >  If this option is not specified, the default adapter is used.
> >  @end table
> > +
> > +@item -hwaccels
> > +List all hardware acceleration methods supported in this build of
> avconv.
> > +
>
> This is ffmpeg, not avconv.
>

Oops. Fixed locally.

Doesn't this belong in cmdutils.c?
>

No.


> What was your rationale for placing it here?
>

cmdutils.c is shared for all ff* programs. -hwaccel is only supported in
ffmpeg.

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


[FFmpeg-devel] [PATCH] ffmpeg_opt: Add -hwaccels option that lists all supported hwaccels

2015-08-25 Thread Timothy Gu
---
 doc/ffmpeg.texi |  4 
 ffmpeg_opt.c| 14 ++
 2 files changed, 18 insertions(+)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 51a4ec5..e1d8562 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -698,6 +698,10 @@ is not specified, the value of the @var{DISPLAY} 
environment variable is used
 For DXVA2, this option should contain the number of the display adapter to use.
 If this option is not specified, the default adapter is used.
 @end table
+
+@item -hwaccels
+List all hardware acceleration methods supported in this build of avconv.
+
 @end table
 
 @section Audio Options
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index a369224..b8b9022 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -205,6 +205,18 @@ static int opt_video_standard(void *optctx, const char 
*opt, const char *arg)
 return opt_default(optctx, "standard", arg);
 }
 
+static int show_hwaccels(void *optctx, const char *opt, const char *arg)
+{
+int i;
+
+printf("Hardware acceleration methods:\n");
+for (i = 0; i < FF_ARRAY_ELEMS(hwaccels) - 1; i++) {
+printf("%s\n", hwaccels[i].name);
+}
+printf("\n");
+return 0;
+}
+
 static int opt_audio_codec(void *optctx, const char *opt, const char *arg)
 {
 OptionsContext *o = optctx;
@@ -3241,6 +3253,8 @@ const OptionDef options[] = {
 #if CONFIG_VDA || CONFIG_VIDEOTOOLBOX
 { "videotoolbox_pixfmt", HAS_ARG | OPT_STRING | OPT_EXPERT, { 
&videotoolbox_pixfmt}, "" },
 #endif
+{ "hwaccels", OPT_EXIT,
  { .func_arg = show_hwaccels },
+"show available HW acceleration methods" },
 { "autorotate",   HAS_ARG | OPT_BOOL | OPT_SPEC |
   OPT_EXPERT | OPT_INPUT,  
  { .off = OFFSET(autorotate) },
 "automatically insert correct rotate filters" },
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 2/2] avfilter: add hstack & vstack filter

2015-08-25 Thread Timothy Gu
On Tue, Aug 25, 2015 at 7:37 AM Paul B Mahol  wrote:

> +@section hstack
> +Stack streams horizontally.
> +
> +All streams must be of same pixel format and of same height.
>

Add a new line here


> +Note: this filter is faster then using @ref{overlay} and @ref{pad} filter

+to create same output.


You can use @float NOTE

Same below in vstack. You should also add a similar note in docs of pad
filter.

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


Re: [FFmpeg-devel] Make libavfilter/vf_drawtext.c build under uclibc environments

2015-08-22 Thread Timothy Gu
On Sat, Aug 22, 2015 at 1:18 PM Paul B Mahol  wrote:

> On 8/22/15, Rene Rheaume  wrote:
> > In function func_eval_expr_int_format inside
> > libavfilter/vf_drawtext.c, the functions feclearexcept and
> > fetestexcept are used. They are missing on uclibc. On that platform,
> > instead of checking if the FPU raised an exception after trying to
> > convert a floating-point number to an integer, do the check beforehand
> > using isfinite and comparisons against the maximum and minimum value
> > of an int32_t.
> >
> > Signed-off-by: Rene Rheaume 
> >
>
> This is ugly solution to problem.
>

What would you suggest?

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


Re: [FFmpeg-devel] [PATCH 2/2] avutil: Move prototype of av_ctz to common.h

2015-08-22 Thread Timothy Gu
On Sat, Aug 22, 2015 at 10:31 AM Hendrik Leppkes 
wrote:

> On Sat, Aug 22, 2015 at 7:15 PM, Timothy Gu  wrote:
> > intmath.h is not installed so it cannot be considered "public".
> >
> > Instead, handle av_ctz the same way as av_log2.
> > ---
> >  libavcodec/flacenc.c |  2 +-
> >  libavutil/common.h   | 10 ++
> >  libavutil/intmath.c  |  1 +
> >  libavutil/intmath.h  |  8 +---
> >  4 files changed, 13 insertions(+), 8 deletions(-)
>
> Maybe it was never meant to be public?
>

Well, it is used in libraries other than libavutil, has the `av_` prefix,
and has an APIchanges entry…

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


[FFmpeg-devel] [PATCH 2/2] avutil: Move prototype of av_ctz to common.h

2015-08-22 Thread Timothy Gu
intmath.h is not installed so it cannot be considered "public".

Instead, handle av_ctz the same way as av_log2.
---
 libavcodec/flacenc.c |  2 +-
 libavutil/common.h   | 10 ++
 libavutil/intmath.c  |  1 +
 libavutil/intmath.h  |  8 +---
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index be791b3..7ef53a4 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -21,7 +21,7 @@
 
 #include "libavutil/avassert.h"
 #include "libavutil/crc.h"
-#include "libavutil/intmath.h"
+#include "libavutil/common.h"
 #include "libavutil/md5.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
diff --git a/libavutil/common.h b/libavutil/common.h
index 3e62b6d..17290fd 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -95,6 +95,16 @@ av_const int av_log2(unsigned v);
 av_const int av_log2_16bit(unsigned v);
 #endif
 
+#ifndef av_ctz
+/**
+ * Trailing zero bit count.
+ *
+ * @param v  input value. If v is 0, the result is undefined.
+ * @return   the number of trailing 0-bits
+ */
+av_const int av_ctz(int v);
+#endif
+
 /**
  * Clip a signed integer value into the amin-amax range.
  * @param a value to clip
diff --git a/libavutil/intmath.c b/libavutil/intmath.c
index 1f725c7..3ff6123 100644
--- a/libavutil/intmath.c
+++ b/libavutil/intmath.c
@@ -21,6 +21,7 @@
 /* undef these to get the function prototypes from common.h */
 #undef av_log2
 #undef av_log2_16bit
+#undef av_ctz
 #include "common.h"
 
 int av_log2(unsigned v)
diff --git a/libavutil/intmath.h b/libavutil/intmath.h
index 08d54a6..f7c6676 100644
--- a/libavutil/intmath.h
+++ b/libavutil/intmath.h
@@ -158,13 +158,7 @@ static av_always_inline av_const int ff_ctz_c( int v )
 #endif
 #endif
 
-/**
- * Trailing zero bit count.
- *
- * @param v  input value. If v is 0, the result is undefined.
- * @return   the number of trailing 0-bits
- */
-int av_ctz(int v);
+#define av_ctz ff_ctz
 
 /**
  * @}
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 1/2] avcodec: Remove unused includes of lavu/intmath.h

2015-08-22 Thread Timothy Gu
---
 libavcodec/mpegvideo_enc.c  | 1 -
 libavcodec/proresdec_lgpl.c | 1 -
 libavcodec/snow.c   | 1 -
 libavcodec/snowdec.c| 1 -
 libavcodec/snowenc.c| 1 -
 5 files changed, 5 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 488ec51..7138cbf 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -30,7 +30,6 @@
 #include 
 
 #include "libavutil/internal.h"
-#include "libavutil/intmath.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/opt.h"
diff --git a/libavcodec/proresdec_lgpl.c b/libavcodec/proresdec_lgpl.c
index 9e5674e..f29327c 100644
--- a/libavcodec/proresdec_lgpl.c
+++ b/libavcodec/proresdec_lgpl.c
@@ -32,7 +32,6 @@
 
 #include 
 
-#include "libavutil/intmath.h"
 #include "avcodec.h"
 #include "idctdsp.h"
 #include "internal.h"
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index fc2e727..1a544ae 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -18,7 +18,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/intmath.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
index 1b288dd..8231e44 100644
--- a/libavcodec/snowdec.c
+++ b/libavcodec/snowdec.c
@@ -18,7 +18,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/intmath.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index beb25c1..683f7cb 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -18,7 +18,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/intmath.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
-- 
1.9.1

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


<    1   2   3   4   5   6   7   >