Re: [FFmpeg-devel] [PATCH] lavf/mpegtsdec: fix AVPacket.pos when FEC/DVHS/BDAV data is present

2018-08-31 Thread Hendrik Leppkes
On Fri, Aug 31, 2018 at 7:28 AM Rodger Combs  wrote:
>
> We previously set pos to several bytes before the actual packet sync byte,
> which meant that seeking to pos relied on resync working, which can fail
> if there are 0x47 bytes in the additional data.
>
> The resync issue should probably also be fixed separately.
> ---
>  libavformat/mpegts.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index a5cb17ac16..881708b42d 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -2581,10 +2581,9 @@ static int handle_packet(MpegTSContext *ts, const 
> uint8_t *packet)
>
>  } else {
>  int ret;
> -// Note: The position here points actually behind the current packet.

This comment still applies, which is why we substract the packet size
from the position. Probably shouldn't remove it.

>  if (tss->type == MPEGTS_PES) {
>  if ((ret = tss->u.pes_filter.pes_cb(tss, p, p_end - p, is_start,
> -pos - ts->raw_packet_size)) 
> < 0)
> +pos - TS_PACKET_SIZE)) < 0)
>  return ret;
>  }
>  }

For the record, my code currently relies on AVPacket.pos pointing to
the actual start of BDAV packets from Blu-ray m2ts files so the
position lines up with the Blu-ray playlist metadata, which also has
positions for seamless clip changes etc.
I don't know how all the other cases work, but at least for BDAV the
current value is correct.

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


[FFmpeg-devel] [PATCH v2 2/2] lavf: add raw avs2 muxer

2018-08-31 Thread hwren
Signed-off-by: hwren 
---
 libavformat/allformats.c |  1 +
 libavformat/rawenc.c | 13 +
 2 files changed, 14 insertions(+)

diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index adcc8d9..c17cdc2 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -76,6 +76,7 @@ extern AVInputFormat  ff_avisynth_demuxer;
 extern AVOutputFormat ff_avm2_muxer;
 extern AVInputFormat  ff_avr_demuxer;
 extern AVInputFormat  ff_avs_demuxer;
+extern AVOutputFormat ff_avs2_muxer;
 extern AVInputFormat  ff_bethsoftvid_demuxer;
 extern AVInputFormat  ff_bfi_demuxer;
 extern AVInputFormat  ff_bintext_demuxer;
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 809ca23..993d232 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -117,6 +117,19 @@ AVOutputFormat ff_aptx_hd_muxer = {
 };
 #endif
 
+#if CONFIG_AVS2_MUXER
+AVOutputFormat ff_avs2_muxer = {
+.name  = "avs2",
+.long_name = NULL_IF_CONFIG_SMALL("raw AVS2-P2/IEEE1857.4 video"),
+.extensions= "avs,avs2",
+.audio_codec   = AV_CODEC_ID_NONE,
+.video_codec   = AV_CODEC_ID_AVS2,
+.write_header  = force_one_stream,
+.write_packet  = ff_raw_write_packet,
+.flags = AVFMT_NOTIMESTAMPS,
+};
+#endif
+
 #if CONFIG_CAVSVIDEO_MUXER
 AVOutputFormat ff_cavsvideo_muxer = {
 .name  = "cavsvideo",
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2 1/2] lavc, doc, configure: add libxavs2 video encoder wrapper

2018-08-31 Thread hwren
Signed-off-by: hwren 
---
 Changelog  |   1 +
 configure  |   4 +
 doc/encoders.texi  |  40 ++
 doc/general.texi   |  14 +++
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libxavs2.c  | 330 +
 libavcodec/version.h   |   2 +-
 8 files changed, 392 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/libxavs2.c

diff --git a/Changelog b/Changelog
index 0975fee..8377956 100644
--- a/Changelog
+++ b/Changelog
@@ -21,6 +21,7 @@ version :
 - Brooktree ProSumer video decoder
 - MatchWare Screen Capture Codec decoder
 - WinCam Motion Video decoder
+- AVS2 video encoder via libxavs2
 
 
 version 4.0:
diff --git a/configure b/configure
index 8bbcd53..c439d2a 100755
--- a/configure
+++ b/configure
@@ -280,6 +280,7 @@ External library support:
   --enable-libx264 enable H.264 encoding via x264 [no]
   --enable-libx265 enable HEVC encoding via x265 [no]
   --enable-libxavs enable AVS encoding via xavs [no]
+  --enable-libxavs2enable AVS2 encoding via xavs2 [no]
   --enable-libxcb  enable X11 grabbing using XCB [autodetect]
   --enable-libxcb-shm  enable X11 grabbing shm communication [autodetect]
   --enable-libxcb-xfixes   enable X11 grabbing mouse rendering [autodetect]
@@ -1667,6 +1668,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
 libx264
 libx265
 libxavs
+libxavs2
 libxvid
 "
 
@@ -3132,6 +3134,7 @@ libx264rgb_encoder_deps="libx264 x264_csp_bgr"
 libx264rgb_encoder_select="libx264_encoder"
 libx265_encoder_deps="libx265"
 libxavs_encoder_deps="libxavs"
+libxavs2_encoder_deps="libxavs2"
 libxvid_encoder_deps="libxvid"
 libzvbi_teletext_decoder_deps="libzvbi"
 vapoursynth_demuxer_deps="vapoursynth"
@@ -6164,6 +6167,7 @@ enabled libx264   && { check_pkg_config libx264 
x264 "stdint.h x264.h" x
 enabled libx265   && require_pkg_config libx265 x265 x265.h 
x265_api_get &&
  require_cpp_condition x265.h "X265_BUILD >= 68"
 enabled libxavs   && require libxavs "stdint.h xavs.h" 
xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
+enabled libxavs2  && require_pkg_config libxavs2 "xavs2 >= 1.2.77" 
"stdint.h xavs2.h" xavs2_api_get
 enabled libxvid   && require libxvid xvid.h xvid_global -lxvidcore
 enabled libzimg   && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h 
zimg_get_api_version
 enabled libzmq&& require_pkg_config libzmq libzmq zmq.h zmq_ctx_new
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 7b09575..b5f9c5e 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2726,6 +2726,46 @@ Reduces detail but attempts to preserve color at 
extremely low bitrates.
 
 @end table
 
+@section libxavs2
+
+xavs2 AVS2-P2/IEEE1857.4 encoder wrapper.
+
+This encoder requires the presence of the libxavs2 headers and library
+during configuration. You need to explicitly configure the build with
+@option{--enable-libxavs2}.
+
+@subsection Options
+
+@table @option
+@item i_lcurow_threads
+Set the number of parallel threads for rows from 1 to 8 (default 5).
+
+@item i_initial_qp
+Set the xavs2 quantization parameter from 1 to 63 (default 34).
+
+@item preset_level
+Set the Speed level from 0 to 9 (default 0).
+
+@item intra_period
+Set the Intra period from 3 to 100 (default 4).
+
+@item hierarchical_ref
+Set the hierarchical reference from 0 to 1 (default 1).
+
+@item num_bframes
+Set the number of B frames from 0 to 15 (default 7).
+
+@item xavs2-params
+Set xavs2 options using a list of @var{key}=@var{value} couples separated
+by ":".
+
+For example to specify libxavs2 encoding options with @option{-xavs2-params}:
+
+@example
+ffmpeg -i input -c:v libxavs2 -xavs2-params -preset_level=5 output.avs2
+@end example
+@end table
+
 @c man end VIDEO ENCODERS
 
 @chapter Subtitles Encoders
diff --git a/doc/general.texi b/doc/general.texi
index 06f7a78..05f7bcd9 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -17,6 +17,20 @@ for more formats. None of them are used by default, their 
use has to be
 explicitly requested by passing the appropriate flags to
 @command{./configure}.
 
+@section libxavs2
+
+FFmpeg can make use of the xavs2 library for AVS2-P2/IEEE1857.4 video encoding.
+
+Go to @url{https://github.com/pkuvcl/xavs2} and follow the instructions for
+installing the library. Then pass @code{--enable-libxavs2} to configure to
+enable it.
+
+@float NOTE
+libxavs2 is under the GNU Public License Version 2 or later
+(see @url{http://www.gnu.org/licenses/old-licenses/gpl-2.0.html} for
+details), you must upgrade FFmpeg's license to GPL in order to use it.
+@end float
+
 @section libdavs2
 
 FFmpeg can make use of the davs2 library for AVS2-P2/IEEE1857.4 video decoding.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index f8673f0..bf17bf7 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -992,6 +992,7 @@ OBJS-$(CONFIG_LIBX262_ENC

Re: [FFmpeg-devel] [PATCH v2] fate: add 10-bit test for hue video filter

2018-08-31 Thread Michael Niedermayer
On Thu, Aug 30, 2018 at 10:27:23AM +0200, Tobias Rapp wrote:
> Signed-off-by: Tobias Rapp 
> ---
>  tests/fate/filter-video.mak | 3 +++
>  tests/ref/fate/filter-hue4  | 1 +
>  2 files changed, 4 insertions(+)
>  create mode 100644 tests/ref/fate/filter-hue4

LGTM

thx

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

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


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


Re: [FFmpeg-devel] [PATCH v2] avcodec/mips: [loongson] reoptimize h264_chroma_mc8_mmi v2.

2018-08-31 Thread Michael Niedermayer
On Fri, Aug 31, 2018 at 10:30:21AM +0800, Shiyou Yin wrote:
> >-Original Message-
> >From: ffmpeg-devel-boun...@ffmpeg.org 
> >[mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> >Michael Niedermayer
> >Sent: Friday, August 31, 2018 5:47 AM
> >To: FFmpeg development discussions and patches
> >Subject: Re: [FFmpeg-devel] [PATCH v2] avcodec/mips: [loongson] reoptimize 
> >h264_chroma_mc8_mmi v2.
> >
> >On Thu, Aug 30, 2018 at 02:24:04PM +0800, Shiyou Yin wrote:
> >> Reoptimize function ff_put_h264_chroma_mc8_mmi and 
> >> ff_avg_h264_chroma_mc8_mmi.
> >> Performance of h264 decoding improved about 5%(from 69fps to 73fps, tested 
> >> on loongson 3A3000).
> >
> >what do you mean by "Reoptimize"?
> >does this port some optimizations from elsewhere ?
> >does this take the same code as previous optimizations did and re implements
> >(better/faster) MIPS code based on it ?
> >
> >what is the speed difference ?
> 
> Two functions have optimized with mmi yet.
> This patch was based on the previous version, then optimized the branch 
> condition and the code in
> branch.
> This patch will speed up about 5% for h264 decode on loongson platform.
> 

> >>
> >> Change-Id: Iccd7f4e480b2d0bfc47e4d409874c4adb77416cc
> >
> >what is this ?
> 
> The original patch was made from loongson's local repository(we use gerrit to 
> manage patch review
> and merge), each commit has it's own Change-Id.
> When I use git am to apply this patch to ffmpeg source, so the Change-Id was 
> keeped with commit
> message.
> I will remove it in the next version.

you can use git notes to keep track of internal change-ids but they
should not be in public commits as noone can do anything with them except you.

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

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


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


Re: [FFmpeg-devel] [PATCH v2] avcodec/mips: [loongson] optimize memset in h264dsp.

2018-08-31 Thread Michael Niedermayer
On Thu, Aug 30, 2018 at 08:40:56PM +0800, Shiyou Yin wrote:
> Optimized memset with mmi in following functions:
> 1. ff_h264_add_pixels4_8_mmi.
> 2. ff_h264_idct_add_8_mmi.
> 3. ff_h264_idct8_add_8_mmi.
> 

> This optimization improved h264 decoding performance about 1fps(tested on 
> loongson 3A3000).

1fps is ambigous. 
Consider if the speed was 2fps before and is 3fps now, its a huge speed gain
if it was 1000fps before and is 1001 now its a small gain
please be more precisse

thanks


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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato


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


Re: [FFmpeg-devel] [PATCH] avcodec/dnxhdenc: stop leaking memory when initalization fails

2018-08-31 Thread Michael Niedermayer
On Thu, Aug 30, 2018 at 11:37:45AM +0200, Paul B Mahol wrote:
> Fixes #6593.
> 
> Signed-off-by: Paul B Mahol 
> ---
>  libavcodec/dnxhdenc.c | 18 +-
>  libavcodec/dnxhdenc.h |  2 ++
>  2 files changed, 11 insertions(+), 9 deletions(-)

LGTM

thx

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

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


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


Re: [FFmpeg-devel] [PATCH v2] fate: add 10-bit test for hue video filter

2018-08-31 Thread Tobias Rapp

On 31.08.2018 12:43, Michael Niedermayer wrote:

On Thu, Aug 30, 2018 at 10:27:23AM +0200, Tobias Rapp wrote:

Signed-off-by: Tobias Rapp 
---
  tests/fate/filter-video.mak | 3 +++
  tests/ref/fate/filter-hue4  | 1 +
  2 files changed, 4 insertions(+)
  create mode 100644 tests/ref/fate/filter-hue4


LGTM


Pushed, thanks for the review.

Regards,
Tobias

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


Re: [FFmpeg-devel] [PATCH]lavc/h264: Output pix_fmt GRAY for monochrome input.

2018-08-31 Thread Michael Niedermayer
On Tue, Aug 07, 2018 at 11:40:08PM +0200, Carl Eugen Hoyos wrote:
[...]

> +if (h->ps.sps->chroma_format_idc) {
>  const uint8_t *src_cb = sl->intra_pcm_ptr + 256;
>  const uint8_t *src_cr = sl->intra_pcm_ptr + 256 + 
> block_h * 8;
>  for (i = 0; i < block_h; i++) {
> @@ -155,7 +143,7 @@ static av_noinline void FUNC(hl_decode_mb)(const 
> H264Context *h, H264SliceContex
>  xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize,
> uvlinesize, 1, 0, SIMPLE, PIXEL_SHIFT);
>  
> -if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {
> +if (!chroma400 && (SIMPLE || !CONFIG_GRAY || !(h->flags & 
> AV_CODEC_FLAG_GRAY))) {
>  h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, uvlinesize);
>  h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, uvlinesize);
>  }

for all i know chroma400 is a obscure case not commonly occuring in real world
files. So unless iam mistaken, this should not be on the "simple" codepath but
chroma400 should possibly use the complex path instead
slowing down 99.9% of files with extra checks seems suboptimal

also the CONFIG_GRAY checks are already ommited by default 
so as not to slow the common case down for a optimization very few use.
if a check was added in the default and simple path then there would likely
be no advantage in keeping CONFIG_GRAY as a compile time conditional as
the checks would always be build (and could be simplified to a single
field for both features)

thx

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

"I am not trying to be anyone's saviour, I'm trying to think about the
 future and not be sad" - Elon Musk



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


[FFmpeg-devel] [PATCH 1/2] ffmpeg: handle flushing and non-flushing separately in sub2video

2018-08-31 Thread Jan Ekström
The initial fix for sub2video flushing during filter chain restarts
seemed to add additional buffering into the filter chain, which in case
of files did work, but when handling live streams would cause premature
failure.

This fix reverts the timestamp filtering, and separates flushing from
normal heartbeat functionality by adding an explicit parameter.
From 9ed9d80535a1e6a2a70faef296fd8d3cbfde8e55 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= 
Date: Thu, 26 Jul 2018 19:07:38 +0300
Subject: [PATCH 1/2] ffmpeg: handle flushing and non-flushing separately in
 sub2video

This stops accidental flushes from happening in sub2video in case
the filter chain gets a re-configuration/re-init. Heartbeats
should not cause a flush and additional buffering in the filter chain.

Properly fixes filter chain flush handling, as previously the
filter chain would keep buffering frames.

Additionally, document the various stages of sub2video.
---
 fftools/ffmpeg.c| 57 +++--
 fftools/ffmpeg.h|  2 +-
 fftools/ffmpeg_filter.c |  2 +-
 3 files changed, 51 insertions(+), 10 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 934dc71a74..758e3839a3 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -237,7 +237,7 @@ static void sub2video_push_ref(InputStream *ist, int64_t pts)
 }
 }
 
-void sub2video_update(InputStream *ist, AVSubtitle *sub)
+void sub2video_update(InputStream *ist, AVSubtitle *sub, int flush)
 {
 AVFrame *frame = ist->sub2video.frame;
 int8_t *dst;
@@ -254,9 +254,47 @@ void sub2video_update(InputStream *ist, AVSubtitle *sub)
  AV_TIME_BASE_Q, ist->st->time_base);
 num_rects = sub->num_rects;
 } else {
-pts   = ist->sub2video.end_pts;
-end_pts   = INT64_MAX;
 num_rects = 0;
+
+if (flush) {
+/* Flush of the sub2video filter chain was requested.
+   Utilize previous end_pts as the pts, and set end_pts to
+   the filter chain flush value (INT64_MAX). */
+pts = ist->sub2video.end_pts;
+end_pts = INT64_MAX;
+
+av_log(ist->dec_ctx, AV_LOG_DEBUG,
+   "nullptr AVSubtitle (flush): utilized values: "
+   "pts=%"PRId64", end_pts=%"PRId64"\n",
+   pts, end_pts);
+} else {
+/* We do not have an active sub-picture and this was not a flush.
+   We will be sending a blank heartbeat frame to the filter
+   chain. */
+
+if (ist->sub2video.last_pts != AV_NOPTS_VALUE &&
+ist->sub2video.last_pts < INT64_MAX) {
+/* if the last PTS is not invalid (it's not unknown/unset or
+   the flush value), use the last PTS as the start point
+   for this filter chain heartbeat frame. */
+pts = ist->sub2video.last_pts;
+} else {
+/* If the last sub2video PTS is invalid, use the provided
+   sub2video frame PTS (set to the current input
+   timestamp by sub2video_heartbeat) */
+pts = frame->pts;
+}
+
+/* FIXME: decide if pts+1 is good enough for this, currently set
+   for .2 seconds */
+end_pts = pts + av_rescale_q(2*1000LL, AV_TIME_BASE_Q,
+ ist->st->time_base);
+
+av_log(ist->dec_ctx, AV_LOG_DEBUG,
+   "nullptr AVSubtitle (no flush): utilized values: "
+   "pts=%"PRId64", end_pts=%"PRId64"\n",
+   pts, end_pts);
+}
 }
 if (sub2video_get_blank_frame(ist) < 0) {
 av_log(ist->dec_ctx, AV_LOG_ERROR,
@@ -291,9 +329,12 @@ static void sub2video_heartbeat(InputStream *ist, int64_t pts)
 /* do not send the heartbeat frame if the subtitle is already ahead */
 if (pts2 <= ist2->sub2video.last_pts)
 continue;
-if (pts2 >= ist2->sub2video.end_pts ||
-(!ist2->sub2video.frame->data[0] && ist2->sub2video.end_pts < INT64_MAX))
-sub2video_update(ist2, NULL);
+if (pts2 >= ist2->sub2video.end_pts || !ist2->sub2video.frame->data[0]) {
+/* if we do not have a subtitle to show for a specific time,
+   add the current stream time as the fall-back PTS */
+ist2->sub2video.frame->pts = pts2;
+sub2video_update(ist2, NULL, 0);
+}
 for (j = 0, nb_reqs = 0; j < ist2->nb_filters; j++)
 nb_reqs += av_buffersrc_get_nb_failed_requests(ist2->filters[j]->filter);
 if (nb_reqs)
@@ -307,7 +348,7 @@ static void sub2video_flush(InputStream *ist)
 int ret;
 
 if (ist->sub2video.end_pts < INT64_MAX)
-sub2video_update(ist, NULL);
+sub2video_update(ist, NULL, 1);
 for (i = 0; i < ist->nb_filters; i++) {
 ret = av_buffersrc_add_frame(is

Re: [FFmpeg-devel] [mov] Error on too large stsd entry counts.

2018-08-31 Thread Michael Niedermayer
On Thu, Aug 30, 2018 at 03:21:02PM -0700, Dale Curtis wrote:
> Entries are always at least 8 bytes per the parsing code, so if we
> see an impossible entry count avoid massive allocations. This is
> similar to an existing check in mov_read_stsc().
> 
> Since ff_mov_read_stsd_entries() does eof checks, an alternative
> approach could be to clamp the entry count to atom.size / 8.
> 
> Signed-off-by: Dale Curtis 

>  mov.c |3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 3678e5a185138a43c4f5dc4eb54283900e0e74c8  
> 0001-Error-on-too-large-stsd-entry-counts.patch
> From 3e1663d84068ff7615f7e84fa1c1122729a531da Mon Sep 17 00:00:00 2001
> From: Dale Curtis 
> Date: Thu, 30 Aug 2018 15:18:25 -0700
> Subject: [PATCH] Error on too large stsd entry counts.
> 
> Entries are always at least 8 bytes per the parsing code, so if we
> see an impossible entry count avoid massive allocations. This is
> similar to an existing check in mov_read_stsc().
> 
> Since ff_mov_read_stsd_entries() does eof checks, an alternative
> approach could be to clamp the entry count to atom.size / 8.
> 
> Signed-off-by: Dale Curtis 
> ---
>  libavformat/mov.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Elect your leaders based on what they did after the last election, not
based on what they say before an election.



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


[FFmpeg-devel] [PATCH 2/2] ffmpeg_filter: keep sub2video size configuration if likely a re-init

2018-08-31 Thread Jan Ekström
This commit tries to keep the sub2video canvas
size in case a filter chain re-initialization occurs. This issue
could also be improved by having this size be checked as new frames are
pushed into the overlay, or the overlay filter itself having an option
to scale overlayed images to the primary image's size.
From d896643576f4f03f0f2f4bc2b653895bb4c07df3 Mon Sep 17 00:00:00 2001
From: Nongji Chen 
Date: Thu, 26 Jul 2018 16:25:19 +0300
Subject: [PATCH 2/2] ffmpeg_filter: keep sub2video size configuration if
 likely a re-init

This way the filter chain does not accidentally mis-configure itself
in case a filter chain re-initialization happens during run-time.
---
 fftools/ffmpeg_filter.c | 23 ++-
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 4cb81ea41f..ae86be1f1a 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -698,11 +698,17 @@ void check_filter_outputs(void)
 static int sub2video_prepare(InputStream *ist, InputFilter *ifilter)
 {
 AVFormatContext *avf = input_files[ist->file_index]->ctx;
-int i, w, h;
+int i, w, h, keep_existing = 0;
 
 /* Compute the size of the canvas for the subtitles stream.
-   If the subtitles codecpar has set a size, use it. Otherwise use the
-   maximum dimensions of the video streams in the same file. */
+
+   If the ifilter->width|height are nonzero and match the sub2video.w|h,
+   keep the configuration as this is likely a re-initialization
+   of the filter chain.
+
+   Otherwise if the subtitles codecpar has set a size, use it, and
+   utilize either the input filter's width|height or the maximum
+   dimensions of the video streams in the same file. */
 w = ifilter->width;
 h = ifilter->height;
 if (!(w && h)) {
@@ -717,12 +723,19 @@ static int sub2video_prepare(InputStream *ist, InputFilter *ifilter)
 h = FFMAX(h, 576);
 }
 av_log(avf, AV_LOG_INFO, "sub2video: using %dx%d canvas\n", w, h);
+} else if (w == ist->sub2video.w && h == ist->sub2video.h) {
+// This is most likely a re-configuration, so keep the currently
+// configured values for width and height.
+keep_existing = 1;
 }
+
 ist->sub2video.w = ifilter->width  = w;
 ist->sub2video.h = ifilter->height = h;
 
-ifilter->width  = ist->dec_ctx->width  ? ist->dec_ctx->width  : ist->sub2video.w;
-ifilter->height = ist->dec_ctx->height ? ist->dec_ctx->height : ist->sub2video.h;
+if (!keep_existing) {
+ifilter->width  = ist->dec_ctx->width  ? ist->dec_ctx->width  : ist->sub2video.w;
+ifilter->height = ist->dec_ctx->height ? ist->dec_ctx->height : ist->sub2video.h;
+}
 
 /* rectangles are AV_PIX_FMT_PAL8, but we have no guarantee that the
palettes for all rectangles are identical or compatible */
-- 
2.17.1

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


Re: [FFmpeg-devel] [PATCH 2/2] examples: Fix use of AV_CODEC_FLAG_GLOBAL_HEADER

2018-08-31 Thread Michael Niedermayer
On Thu, Aug 30, 2018 at 08:56:19AM +0200, Michael Bunk wrote:
> AV_CODEC_FLAG_GLOBAL_HEADER should be set before calling avcodec_open2() to 
> have any effect.
> ---
>  doc/examples/transcoding.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

will apply

thx

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

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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


[FFmpeg-devel] [PATCH v3] avcodec/mips: [loongson] reoptimize simple idct with mmi.

2018-08-31 Thread Shiyou Yin
Performance of mpeg4 decoding improved about 23%(from 128fps to 158fps, tested 
on loongson 3A3000).
Reoptimized following functions with mmi.
1. ff_simple_idct_put_8_mmi
2. ff_simple_idct_add_8_mmi
3. ff_simple_idct_8_mmi
---
 libavcodec/mips/idctdsp_init_mips.c |7 +-
 libavcodec/mips/idctdsp_mips.h  |6 +-
 libavcodec/mips/simple_idct_mmi.c   | 1167 ---
 libavutil/mips/mmiutils.h   |   49 ++
 4 files changed, 444 insertions(+), 785 deletions(-)

diff --git a/libavcodec/mips/idctdsp_init_mips.c 
b/libavcodec/mips/idctdsp_init_mips.c
index 8c26bca..bb33b55 100644
--- a/libavcodec/mips/idctdsp_init_mips.c
+++ b/libavcodec/mips/idctdsp_init_mips.c
@@ -20,6 +20,7 @@
  */
 
 #include "idctdsp_mips.h"
+#include "xvididct_mips.h"
 
 #if HAVE_MSA
 static av_cold void idctdsp_init_msa(IDCTDSPContext *c, AVCodecContext *avctx,
@@ -48,8 +49,10 @@ static av_cold void idctdsp_init_mmi(IDCTDSPContext *c, 
AVCodecContext *avctx,
 if ((avctx->lowres != 1) && (avctx->lowres != 2) && (avctx->lowres != 3) &&
 (avctx->bits_per_raw_sample != 10) &&
 (avctx->bits_per_raw_sample != 12) &&
-(avctx->idct_algo == FF_IDCT_AUTO)) {
-c->idct = ff_simple_idct_mmi;
+((avctx->idct_algo == FF_IDCT_AUTO) || (avctx->idct_algo == 
FF_IDCT_SIMPLE))) {
+c->idct_put = ff_simple_idct_put_8_mmi;
+c->idct_add = ff_simple_idct_add_8_mmi;
+c->idct = ff_simple_idct_8_mmi;
 c->perm_type = FF_IDCT_PERM_NONE;
 }
 
diff --git a/libavcodec/mips/idctdsp_mips.h b/libavcodec/mips/idctdsp_mips.h
index 7ca7c1c..829efeb 100644
--- a/libavcodec/mips/idctdsp_mips.h
+++ b/libavcodec/mips/idctdsp_mips.h
@@ -46,8 +46,8 @@ void ff_put_signed_pixels_clamped_mmi(const int16_t *block,
 uint8_t *av_restrict pixels, ptrdiff_t line_size);
 void ff_add_pixels_clamped_mmi(const int16_t *block,
 uint8_t *av_restrict pixels, ptrdiff_t line_size);
-void ff_simple_idct_mmi(int16_t *block);
-void ff_simple_idct_put_mmi(uint8_t *dest, ptrdiff_t line_size, int16_t 
*block);
-void ff_simple_idct_add_mmi(uint8_t *dest, ptrdiff_t line_size, int16_t 
*block);
+void ff_simple_idct_8_mmi(int16_t *block);
+void ff_simple_idct_put_8_mmi(uint8_t *dest, ptrdiff_t line_size, int16_t 
*block);
+void ff_simple_idct_add_8_mmi(uint8_t *dest, ptrdiff_t line_size, int16_t 
*block);
 
 #endif  // #ifndef AVCODEC_MIPS_IDCTDSP_MIPS_H
diff --git a/libavcodec/mips/simple_idct_mmi.c 
b/libavcodec/mips/simple_idct_mmi.c
index 628e13f..7f4bb74 100644
--- a/libavcodec/mips/simple_idct_mmi.c
+++ b/libavcodec/mips/simple_idct_mmi.c
@@ -24,793 +24,400 @@
 
 #include "idctdsp_mips.h"
 #include "constants.h"
+#include "libavutil/mips/asmdefs.h"
+#include "libavutil/mips/mmiutils.h"
 
-#define C0 23170 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C3 19266 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C4 16383 //cos(i*M_PI/16)*sqrt(2)*(1<<14) - 0.5
-#define C5 12873 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C6 8867  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C7 4520  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define W1  22725  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define W2  21407  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define W3  19266  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define W4  16383  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define W5  12873  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define W6  8867   //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define W7  4520   //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
 
 #define ROW_SHIFT 11
 #define COL_SHIFT 20
-
-DECLARE_ALIGNED(8, static const int16_t, coeffs)[]= {
-1<<(ROW_SHIFT-1),   0, 1<<(ROW_SHIFT-1),   0,
-1<<(ROW_SHIFT-1),   1, 1<<(ROW_SHIFT-1),   0,
-  C4,  C4,   C4,  C4,
-  C4, -C4,   C4, -C4,
-  C2,  C6,   C2,  C6,
-  C6, -C2,   C6, -C2,
-  C1,  C3,   C1,  C3,
-  C5,  C7,   C5,  C7,
-  C3, -C7,   C3, -C7,
- -C1, -C5,  -C1, -C5,
-  C5, -C1,   C5, -C1,
-  C7,  C3,   C7,  C3,
-  C7, -C5,   C7, -C5,
-  C3, -C1,   C3, -C1
+#define DC_SHIFT 3
+
+DECLARE_ALIGNED(8, const int16_t, W_arr)[46] = {
+W4,  W2,  W4,  W6,
+W1,  W3,  W5,  W7,
+W4,  W6, -W4, -W2,
+W3, -W7, -W1, -W5,
+W4, -W6, -W4,  W2,
+W5, -W1,  W7,  W3,
+W4, -W2,  W4, -W6,
+W7, -W5,  W3, -W1,
+1024, 0,  1024, 0, //ff_p32_1024 = 0x04000400ULL
+0,   -1,  -1,  -1, //mask = 0xULL
+32,  32,  32,  32  //ff_p16_32 = 0x0020002000200020ULL
 };
 
-void ff_simple_idct_mmi(int16_t *block)
+void ff_simp

[FFmpeg-devel] [PATCH v3] avcodec/mips: [loongson] reoptimize h264_chroma_mc8_mmi v2.

2018-08-31 Thread Shiyou Yin
Reoptimize function ff_put_h264_chroma_mc8_mmi and ff_avg_h264_chroma_mc8_mmi.
Performance of h264 decoding improved about 5%(from 69fps to 73fps, tested on 
loongson 3A3000).
---
 libavcodec/mips/h264chroma_mmi.c | 744 ---
 1 file changed, 455 insertions(+), 289 deletions(-)

diff --git a/libavcodec/mips/h264chroma_mmi.c b/libavcodec/mips/h264chroma_mmi.c
index bafe0f9..91b2cc4 100644
--- a/libavcodec/mips/h264chroma_mmi.c
+++ b/libavcodec/mips/h264chroma_mmi.c
@@ -29,326 +29,322 @@
 void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
 int h, int x, int y)
 {
-const int A = (8 - x) * (8 - y);
-const int B = x * (8 - y);
-const int C = (8 - x) * y;
-const int D = x * y;
-const int E = B + C;
+int A = 64, B, C, D, E;
 double ftmp[10];
 uint64_t tmp[1];
-mips_reg addr[1];
-DECLARE_VAR_ALL64;
 
-if (D) {
+if (!(x || y)) {
+/* x=0, y=0, A=64 */
 __asm__ volatile (
-"xor%[ftmp0],   %[ftmp0],   %[ftmp0]\n\t"
-"dli%[tmp0],0x06\n\t"
-"pshufh %[A],   %[A],   %[ftmp0]\n\t"
-"pshufh %[B],   %[B],   %[ftmp0]\n\t"
-"mtc1   %[tmp0],%[ftmp9]\n\t"
-"pshufh %[C],   %[C],   %[ftmp0]\n\t"
-"pshufh %[D],   %[D],   %[ftmp0]\n\t"
+"xor%[ftmp0],   %[ftmp0],   %[ftmp0]   \n\t"
+"dli%[tmp0],0x06   \n\t"
+"mtc1   %[tmp0],%[ftmp4]   \n\t"
 
-"1: \n\t"
-PTR_ADDU   "%[addr0],   %[src], %[stride]   \n\t"
+"1:\n\t"
 MMI_ULDC1(%[ftmp1], %[src], 0x00)
-MMI_ULDC1(%[ftmp2], %[src], 0x01)
-MMI_ULDC1(%[ftmp3], %[addr0], 0x00)
-MMI_ULDC1(%[ftmp4], %[addr0], 0x01)
-
-"punpcklbh  %[ftmp5],   %[ftmp1],   %[ftmp0]\n\t"
-"punpckhbh  %[ftmp6],   %[ftmp1],   %[ftmp0]\n\t"
-"punpcklbh  %[ftmp7],   %[ftmp2],   %[ftmp0]\n\t"
-"punpckhbh  %[ftmp8],   %[ftmp2],   %[ftmp0]\n\t"
-"pmullh %[ftmp5],   %[ftmp5],   %[A]\n\t"
-"pmullh %[ftmp7],   %[ftmp7],   %[B]\n\t"
-"paddh  %[ftmp1],   %[ftmp5],   %[ftmp7]\n\t"
-"pmullh %[ftmp6],   %[ftmp6],   %[A]\n\t"
-"pmullh %[ftmp8],   %[ftmp8],   %[B]\n\t"
-"paddh  %[ftmp2],   %[ftmp6],   %[ftmp8]\n\t"
-
-"punpcklbh  %[ftmp5],   %[ftmp3],   %[ftmp0]\n\t"
-"punpckhbh  %[ftmp6],   %[ftmp3],   %[ftmp0]\n\t"
-"punpcklbh  %[ftmp7],   %[ftmp4],   %[ftmp0]\n\t"
-"punpckhbh  %[ftmp8],   %[ftmp4],   %[ftmp0]\n\t"
-"pmullh %[ftmp5],   %[ftmp5],   %[C]\n\t"
-"pmullh %[ftmp7],   %[ftmp7],   %[D]\n\t"
-"paddh  %[ftmp3],   %[ftmp5],   %[ftmp7]\n\t"
-"pmullh %[ftmp6],   %[ftmp6],   %[C]\n\t"
-"pmullh %[ftmp8],   %[ftmp8],   %[D]\n\t"
-"paddh  %[ftmp4],   %[ftmp6],   %[ftmp8]\n\t"
-
-"paddh  %[ftmp1],   %[ftmp1],   %[ftmp3]\n\t"
-"paddh  %[ftmp2],   %[ftmp2],   %[ftmp4]\n\t"
-"paddh  %[ftmp1],   %[ftmp1],   %[ff_pw_32] \n\t"
-"paddh  %[ftmp2],   %[ftmp2],   %[ff_pw_32] \n\t"
-"psrlh  %[ftmp1],   %[ftmp1],   %[ftmp9]\n\t"
-"psrlh  %[ftmp2],   %[ftmp2],   %[ftmp9]\n\t"
-"packushb   %[ftmp1],   %[ftmp1],   %[ftmp2]\n\t"
-"addi   %[h],   %[h],   -0x01   \n\t"
+"addi   %[h],   %[h],   -0x04  \n\t"
+PTR_ADDU   "%[src], %[src], %[stride]  \n\t"
+MMI_ULDC1(%[ftmp5], %[src], 0x00)
+PTR_ADDU   "%[src], %[src], %[stride]  \n\t"
+MMI_ULDC1(%[ftmp6], %[src], 0x00)
+PTR_ADDU   "%[src], %[src], %[stride]  \n\t"
+MMI_ULDC1(%[ftmp7], %[src], 0x00)
+
+"punpcklbh  %[ftmp2],   %[ftmp1],   %[ftmp0]   \n\t"
+"punpckhbh 

[FFmpeg-devel] [PATCH v3] avcodec/mips: [loongson] optimize memset in h264dsp.

2018-08-31 Thread Shiyou Yin
Optimized memset with mmi in following functions:
1. ff_h264_add_pixels4_8_mmi.
2. ff_h264_idct_add_8_mmi.
3. ff_h264_idct8_add_8_mmi.

This optimization improved h264 decoding performance about 1.3%(tested on 
loongson 3A3000).
---
 libavcodec/mips/h264dsp_mmi.c | 30 +-
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/libavcodec/mips/h264dsp_mmi.c b/libavcodec/mips/h264dsp_mmi.c
index ac6fa99..ac65a20 100644
--- a/libavcodec/mips/h264dsp_mmi.c
+++ b/libavcodec/mips/h264dsp_mmi.c
@@ -31,7 +31,6 @@ void ff_h264_add_pixels4_8_mmi(uint8_t *dst, int16_t *src, 
int stride)
 {
 double ftmp[9];
 DECLARE_VAR_LOW32;
-DECLARE_VAR_ALL64;
 
 __asm__ volatile (
 "xor%[ftmp0],   %[ftmp0],   %[ftmp0]\n\t"
@@ -59,12 +58,16 @@ void ff_h264_add_pixels4_8_mmi(uint8_t *dst, int16_t *src, 
int stride)
 MMI_SWC1(%[ftmp2], %[dst1], 0x00)
 MMI_SWC1(%[ftmp3], %[dst2], 0x00)
 MMI_SWC1(%[ftmp4], %[dst3], 0x00)
+
+/* memset(src, 0, 32); */
+"xor%[ftmp0],   %[ftmp0],   %[ftmp0]\n\t"
+"gssqc1 %[ftmp0],   %[ftmp0],   0x00(%[src])\n\t"
+"gssqc1 %[ftmp0],   %[ftmp0],   0x10(%[src])\n\t"
 : [ftmp0]"=&f"(ftmp[0]),[ftmp1]"=&f"(ftmp[1]),
   [ftmp2]"=&f"(ftmp[2]),[ftmp3]"=&f"(ftmp[3]),
   [ftmp4]"=&f"(ftmp[4]),[ftmp5]"=&f"(ftmp[5]),
   [ftmp6]"=&f"(ftmp[6]),[ftmp7]"=&f"(ftmp[7]),
   RESTRICT_ASM_LOW32
-  RESTRICT_ASM_ALL64
   [ftmp8]"=&f"(ftmp[8])
 : [dst0]"r"(dst),   [dst1]"r"(dst+stride),
   [dst2]"r"(dst+2*stride),  [dst3]"r"(dst+3*stride),
@@ -72,7 +75,6 @@ void ff_h264_add_pixels4_8_mmi(uint8_t *dst, int16_t *src, 
int stride)
 : "memory"
 );
 
-memset(src, 0, 32);
 }
 
 void ff_h264_idct_add_8_mmi(uint8_t *dst, int16_t *block, int stride)
@@ -80,7 +82,6 @@ void ff_h264_idct_add_8_mmi(uint8_t *dst, int16_t *block, int 
stride)
 double ftmp[12];
 uint64_t tmp[1];
 DECLARE_VAR_LOW32;
-DECLARE_VAR_ALL64;
 DECLARE_VAR_ADDRT;
 
 __asm__ volatile (
@@ -152,6 +153,11 @@ void ff_h264_idct_add_8_mmi(uint8_t *dst, int16_t *block, 
int stride)
 MMI_SWC1(%[ftmp2], %[dst], 0x00)
 "packushb   %[ftmp0],   %[ftmp0],   %[ftmp7]\n\t"
 MMI_SWXC1(%[ftmp0], %[dst], %[stride], 0x00)
+
+/* memset(block, 0, 32) */
+"xor%[ftmp0],   %[ftmp0],   %[ftmp0]\n\t"
+"gssqc1 %[ftmp0],   %[ftmp0],   0x00(%[block])  \n\t"
+"gssqc1 %[ftmp0],   %[ftmp0],   0x10(%[block])  \n\t"
 : [ftmp0]"=&f"(ftmp[0]),[ftmp1]"=&f"(ftmp[1]),
   [ftmp2]"=&f"(ftmp[2]),[ftmp3]"=&f"(ftmp[3]),
   [ftmp4]"=&f"(ftmp[4]),[ftmp5]"=&f"(ftmp[5]),
@@ -159,7 +165,6 @@ void ff_h264_idct_add_8_mmi(uint8_t *dst, int16_t *block, 
int stride)
   [ftmp8]"=&f"(ftmp[8]),[ftmp9]"=&f"(ftmp[9]),
   [ftmp10]"=&f"(ftmp[10]),  [ftmp11]"=&f"(ftmp[11]),
   RESTRICT_ASM_LOW32
-  RESTRICT_ASM_ALL64
   RESTRICT_ASM_ADDRT
   [tmp0]"=&r"(tmp[0])
 : [dst]"r"(dst),[block]"r"(block),
@@ -167,7 +172,6 @@ void ff_h264_idct_add_8_mmi(uint8_t *dst, int16_t *block, 
int stride)
 : "memory"
 );
 
-memset(block, 0, 32);
 }
 
 void ff_h264_idct8_add_8_mmi(uint8_t *dst, int16_t *block, int stride)
@@ -176,7 +180,6 @@ void ff_h264_idct8_add_8_mmi(uint8_t *dst, int16_t *block, 
int stride)
 uint64_t tmp[7];
 mips_reg addr[1];
 DECLARE_VAR_LOW32;
-DECLARE_VAR_ALL64;
 DECLARE_VAR_ADDRT;
 
 __asm__ volatile (
@@ -617,6 +620,17 @@ void ff_h264_idct8_add_8_mmi(uint8_t *dst, int16_t *block, 
int stride)
 MMI_SWC1(%[ftmp6], %[addr0], 0x00)
 MMI_SWXC1(%[ftmp7], %[addr0], %[stride], 0x00)
 PTR_ADDIU  "$29,$29,0x20\n\t"
+
+/* memset(block, 0, 128) */
+"xor%[ftmp0],   %[ftmp0],   %[ftmp0]\n\t"
+"gssqc1 %[ftmp0],   %[ftmp0],   0x00(%[block])  \n\t"
+"gssqc1 %[ftmp0],   %[ftmp0],   0x10(%[block])  \n\t"
+"gssqc1 %[ftmp0],   %[ftmp0],   0x20(%[block])  \n\t"
+"gssqc1 %[ftmp0],   %[ftmp0],   0x30(%[block])  \n\t"
+"gssqc1 %[ftmp0],   %[ftmp0],   0x40(%[block])  \n\t"
+"gssqc1 %[ftmp0],   %[ftmp0],   0x50(%[block])  \n\t"
+"gssqc1 %[ftmp0],   %[ftmp0],   0x60(%[block])  \n\t"
+"gssqc1 %[ftmp0],   %[ftmp0],   0x70(%[block])  \n\t"
 : [ftmp0]"=&f"(ftmp[0]),[ftmp1]"=&f"(ftmp[1]),
   [ftmp2]"=&f"(ftmp[2]),   

Re: [FFmpeg-devel] wolfSSL - new TLS backend patch

2018-08-31 Thread Carl Eugen Hoyos
2018-08-28 12:02 GMT+02:00, samsamsam :

> [autodetect]  @@ -1563,6 +1565,7 @@   libndi_newtek   libfdk_aac
>  openssl  +wolfssl

Afaict, wolfssl is gpl, so it does not belong in the NONFREE
but in the GPL list.

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


Re: [FFmpeg-devel] [PATCH] lavc/libaomenc: Add -tile-columns/-tile-rows

2018-08-31 Thread Kagami Hiiragi
On 31/08/18 02:58, James Almer wrote:
> On 8/20/2018 2:56 PM, Kagami Hiiragi wrote:
>> These options are required for multithreaded encoding, because they set
>> to zero by default in av1_cx_iface.c.
>>
>> Signed-off-by: Kagami Hiiragi 
>>
>> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
>> index 9431179886..55cb7ff72e 100644
>> --- a/libavcodec/libaomenc.c
>> +++ b/libavcodec/libaomenc.c
>> @@ -68,6 +68,8 @@ typedef struct AOMEncoderContext {
>>  int static_thresh;
>>  int drop_threshold;
>>  int noise_sensitivity;
>> +int tile_columns;
>> +int tile_rows;
>>  } AOMContext;
>>  
>>  static const char *const ctlidstr[] = {
>> @@ -75,6 +77,8 @@ static const char *const ctlidstr[] = {
>>  [AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL",
>>  [AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF",
>>  [AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD",
>> +[AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS",
>> +[AV1E_SET_TILE_ROWS]= "AV1E_SET_TILE_ROWS",
>>  [AV1E_SET_COLOR_RANGE]  = "AV1E_SET_COLOR_RANGE",
>>  [AV1E_SET_COLOR_PRIMARIES]  = "AV1E_SET_COLOR_PRIMARIES",
>>  [AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS",
>> @@ -449,6 +453,11 @@ static av_cold int aom_init(AVCodecContext *avctx,
>>  if (ctx->crf >= 0)
>>  codecctl_int(avctx, AOME_SET_CQ_LEVEL,  ctx->crf);
>>  
>> +if (ctx->tile_columns >= 0)
>> +codecctl_int(avctx, AV1E_SET_TILE_COLUMNS, ctx->tile_columns);
>> +if (ctx->tile_rows >= 0)
>> +codecctl_int(avctx, AV1E_SET_TILE_ROWS, ctx->tile_rows);
>> +
>>  codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries);
>>  codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace);
>>  codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, 
>> avctx->color_trc);
>> @@ -746,6 +755,8 @@ static const AVOption options[] = {
>>  { "static-thresh","A change threshold on blocks below which they 
>> will be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, { 
>> .i64 = 0 }, 0, INT_MAX, VE },
>>  { "drop-threshold",   "Frame drop threshold", offsetof(AOMContext, 
>> drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE },
>>  { "noise-sensitivity", "Noise sensitivity", OFFSET(noise_sensitivity), 
>> AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4, VE},
>> +{ "tile-columns", "Number of tile columns to use, log2", 
>> OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
> 
> Why 6? The libaom API doesn't mention a limit, just says the argument
> should be in log2 unit, and that it will be capped based on the image size.

https://aomedia.googlesource.com/aom/+/1742b043e2269dc1927afe428fbf5a46493e741e/av1/av1_cx_iface.c#298
 
>> +{ "tile-rows", "Number of tile rows to use, log2", OFFSET(tile_rows), 
>> AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
> 
> And for this one it says the range is [0-2].

Who says it? I can pass --tile-rows=6 to aomenc.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/libaomenc: Add -tile-columns/-tile-rows

2018-08-31 Thread James Almer
On 8/31/2018 11:52 AM, Kagami Hiiragi wrote:
> On 31/08/18 02:58, James Almer wrote:
>> On 8/20/2018 2:56 PM, Kagami Hiiragi wrote:
>>> These options are required for multithreaded encoding, because they set
>>> to zero by default in av1_cx_iface.c.
>>>
>>> Signed-off-by: Kagami Hiiragi 
>>>
>>> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
>>> index 9431179886..55cb7ff72e 100644
>>> --- a/libavcodec/libaomenc.c
>>> +++ b/libavcodec/libaomenc.c
>>> @@ -68,6 +68,8 @@ typedef struct AOMEncoderContext {
>>>  int static_thresh;
>>>  int drop_threshold;
>>>  int noise_sensitivity;
>>> +int tile_columns;
>>> +int tile_rows;
>>>  } AOMContext;
>>>  
>>>  static const char *const ctlidstr[] = {
>>> @@ -75,6 +77,8 @@ static const char *const ctlidstr[] = {
>>>  [AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL",
>>>  [AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF",
>>>  [AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD",
>>> +[AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS",
>>> +[AV1E_SET_TILE_ROWS]= "AV1E_SET_TILE_ROWS",
>>>  [AV1E_SET_COLOR_RANGE]  = "AV1E_SET_COLOR_RANGE",
>>>  [AV1E_SET_COLOR_PRIMARIES]  = "AV1E_SET_COLOR_PRIMARIES",
>>>  [AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS",
>>> @@ -449,6 +453,11 @@ static av_cold int aom_init(AVCodecContext *avctx,
>>>  if (ctx->crf >= 0)
>>>  codecctl_int(avctx, AOME_SET_CQ_LEVEL,  ctx->crf);
>>>  
>>> +if (ctx->tile_columns >= 0)
>>> +codecctl_int(avctx, AV1E_SET_TILE_COLUMNS, ctx->tile_columns);
>>> +if (ctx->tile_rows >= 0)
>>> +codecctl_int(avctx, AV1E_SET_TILE_ROWS, ctx->tile_rows);
>>> +
>>>  codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries);
>>>  codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace);
>>>  codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, 
>>> avctx->color_trc);
>>> @@ -746,6 +755,8 @@ static const AVOption options[] = {
>>>  { "static-thresh","A change threshold on blocks below which they 
>>> will be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, { 
>>> .i64 = 0 }, 0, INT_MAX, VE },
>>>  { "drop-threshold",   "Frame drop threshold", offsetof(AOMContext, 
>>> drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE },
>>>  { "noise-sensitivity", "Noise sensitivity", OFFSET(noise_sensitivity), 
>>> AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4, VE},
>>> +{ "tile-columns", "Number of tile columns to use, log2", 
>>> OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
>>
>> Why 6? The libaom API doesn't mention a limit, just says the argument
>> should be in log2 unit, and that it will be capped based on the image size.
> 
> https://aomedia.googlesource.com/aom/+/1742b043e2269dc1927afe428fbf5a46493e741e/av1/av1_cx_iface.c#298
>  
>>> +{ "tile-rows", "Number of tile rows to use, log2", OFFSET(tile_rows), 
>>> AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
>>
>> And for this one it says the range is [0-2].
> 
> Who says it? I can pass --tile-rows=6 to aomenc.

The doxy in the public header:
https://aomedia.googlesource.com/aom/+/master/aom/aomcx.h#312

One shouldn't have to look at source code when there's documentation for
public API, but since the latter is apparently wrong...
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/4] lavf/mov: add AVCodecTag entry for GoPro metadata

2018-08-31 Thread John Stebbins
On 08/30/2018 03:59 PM, Michael Niedermayer wrote:
> On Mon, Aug 27, 2018 at 12:57:07PM -0700, John Stebbins wrote:
>> This allows for validation of the track type
>> ---
>>  libavformat/isom.c | 5 +
>>  libavformat/isom.h | 1 +
>>  libavformat/mov.c  | 3 +++
>>  3 files changed, 9 insertions(+)
>>
>> diff --git a/libavformat/isom.c b/libavformat/isom.c
>> index ce66d1bcd4..ca9d22e4f7 100644
>> --- a/libavformat/isom.c
>> +++ b/libavformat/isom.c
>> @@ -374,6 +374,11 @@ const AVCodecTag ff_codec_movsubtitle_tags[] = {
>>  { AV_CODEC_ID_NONE, 0 },
>>  };
>>  
>> +const AVCodecTag ff_codec_movdata_tags[] = {
>> +{ AV_CODEC_ID_BIN_DATA, MKTAG('g', 'p', 'm', 'd') },
>> +{ AV_CODEC_ID_NONE, 0 },
>> +};
>> +
>>  /* map numeric codes from mdhd atom to ISO 639 */
>>  /* cf. QTFileFormat.pdf p253, qtff.pdf p205 */
>>  /* http://developer.apple.com/documentation/mac/Text/Text-368.html */
>> diff --git a/libavformat/isom.h b/libavformat/isom.h
>> index 51abea52de..f3a7a8633d 100644
>> --- a/libavformat/isom.h
>> +++ b/libavformat/isom.h
>> @@ -41,6 +41,7 @@ extern const AVCodecTag ff_mp4_obj_type[];
>>  extern const AVCodecTag ff_codec_movvideo_tags[];
>>  extern const AVCodecTag ff_codec_movaudio_tags[];
>>  extern const AVCodecTag ff_codec_movsubtitle_tags[];
>> +extern const AVCodecTag ff_codec_movdata_tags[];
>>  
>>  int ff_mov_iso639_to_lang(const char lang[4], int mp4);
>>  int ff_mov_lang_to_iso639(unsigned code, char to[4]);
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index d66f4e338c..8915e3b9e0 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -2034,6 +2034,8 @@ static int mov_codec_id(AVStream *st, uint32_t format)
>>  id = ff_codec_get_id(ff_codec_movsubtitle_tags, format);
>>  if (id > 0)
>>  st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
>> +else
>> +id = ff_codec_get_id(ff_codec_movdata_tags, format);
> I think this should also set codec_type like the other cases
>
>
>>  }
>>  }
>>  
>> @@ -2507,6 +2509,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, 
>> AVIOContext *pb, int entries)
>>  mov_parse_stsd_subtitle(c, pb, st, sc,
>>  size - (avio_tell(pb) - start_pos));
>>  } else {
>> +st->codecpar->codec_id = id;
> if this is done for all cases it should be factored out 
> (maybe in a seperate patch)
>
> thx
>

Sure

-- 
John  GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7




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


Re: [FFmpeg-devel] [PATCH] lavc/libaomenc: Add -tile-columns/-tile-rows

2018-08-31 Thread Derek Buitenhuis
On 31/08/2018 16:18, James Almer wrote:
> The doxy in the public header:
> https://aomedia.googlesource.com/aom/+/master/aom/aomcx.h#312
> 
> One shouldn't have to look at source code when there's documentation for
> public API, but since the latter is apparently wrong...

If it's like this, at the very least, it should be noted
where this magic number came from in libaom.c.

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


Re: [FFmpeg-devel] [PATCH] lavf/mov: Fix PCM audio w/ bit depth > 16

2018-08-31 Thread John Stebbins

On 08/30/2018 04:43 PM, Michael Niedermayer wrote:
> On Mon, Aug 27, 2018 at 12:59:28PM -0700, John Stebbins wrote:
>> This type of audio is defined by the QT spec, but can be found in
>> non-QT branded files in the wild.
>>
>> Fixes ticket #7376
>> ---
>>  libavformat/mov.c | 14 ++
>>  1 file changed, 14 insertions(+)
> So IIUC this is supporting a case that is slightly violating the spec ?
> Iam asking as i was wondering if it makes sense to check a few more
> things. For example the size could be checked if it actually is
> large enough to contain a version=1 header
>
> either way i think this patch should be ok
>
>

Yes, your understanding is correct.

I don't think the size can be used here because it includes the sizes of any 
other atoms that are contained in the stsd
entry.  It might be possible to sanity check some of the version qt version 1 
(or 2) values read and rewind the stream
if they don't make sense (i.e. extreme values).  Or the following data could 
first be read as if it were *not* qt
version 1 and checked if it made sense (i.e. looked like the start of an atom), 
then rewind.

Unfortunately, the audio actually plays correctly if you just drop the qt 
version 1 data on the floor.  So it's not
necessary for playback which means someone could create yet another spec 
violating sample that has 24 bit pcm but muxed
using isom version 1 instead.  If anything like this exists in the wild, it 
would be necessary to perform heuristic
sanity checking of values I think.

-- 
John  GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7




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


[FFmpeg-devel] [PATCH] lavf/mov: factor out setting codec_id

2018-08-31 Thread John Stebbins
Since it is performed in all cases now.
---
 libavformat/mov.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 3d4f6bcb21..4ee67cf500 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2508,22 +2508,19 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext 
*pb, int entries)
"size=%"PRId64" 4CC=%s codec_type=%d\n", size,
av_fourcc2str(format), st->codecpar->codec_type);
 
+st->codecpar->codec_id = id;
 if (st->codecpar->codec_type==AVMEDIA_TYPE_VIDEO) {
-st->codecpar->codec_id = id;
 mov_parse_stsd_video(c, pb, st, sc);
 } else if (st->codecpar->codec_type==AVMEDIA_TYPE_AUDIO) {
-st->codecpar->codec_id = id;
 mov_parse_stsd_audio(c, pb, st, sc);
 if (st->codecpar->sample_rate < 0) {
 av_log(c->fc, AV_LOG_ERROR, "Invalid sample rate %d\n", 
st->codecpar->sample_rate);
 return AVERROR_INVALIDDATA;
 }
 } else if (st->codecpar->codec_type==AVMEDIA_TYPE_SUBTITLE){
-st->codecpar->codec_id = id;
 mov_parse_stsd_subtitle(c, pb, st, sc,
 size - (avio_tell(pb) - start_pos));
 } else {
-st->codecpar->codec_id = id;
 ret = mov_parse_stsd_data(c, pb, st, sc,
   size - (avio_tell(pb) - start_pos));
 if (ret < 0)
-- 
2.17.1

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


Re: [FFmpeg-devel] [PATCH] lavc/libaomenc: Add -tile-columns/-tile-rows

2018-08-31 Thread Kagami Hiiragi
On 31/08/18 18:18, James Almer wrote:
> On 8/31/2018 11:52 AM, Kagami Hiiragi wrote:
>> On 31/08/18 02:58, James Almer wrote:
>>> On 8/20/2018 2:56 PM, Kagami Hiiragi wrote:
 These options are required for multithreaded encoding, because they set
 to zero by default in av1_cx_iface.c.

 Signed-off-by: Kagami Hiiragi 

 diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
 index 9431179886..55cb7ff72e 100644
 --- a/libavcodec/libaomenc.c
 +++ b/libavcodec/libaomenc.c
 @@ -68,6 +68,8 @@ typedef struct AOMEncoderContext {
  int static_thresh;
  int drop_threshold;
  int noise_sensitivity;
 +int tile_columns;
 +int tile_rows;
  } AOMContext;
  
  static const char *const ctlidstr[] = {
 @@ -75,6 +77,8 @@ static const char *const ctlidstr[] = {
  [AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL",
  [AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF",
  [AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD",
 +[AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS",
 +[AV1E_SET_TILE_ROWS]= "AV1E_SET_TILE_ROWS",
  [AV1E_SET_COLOR_RANGE]  = "AV1E_SET_COLOR_RANGE",
  [AV1E_SET_COLOR_PRIMARIES]  = "AV1E_SET_COLOR_PRIMARIES",
  [AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS",
 @@ -449,6 +453,11 @@ static av_cold int aom_init(AVCodecContext *avctx,
  if (ctx->crf >= 0)
  codecctl_int(avctx, AOME_SET_CQ_LEVEL,  ctx->crf);
  
 +if (ctx->tile_columns >= 0)
 +codecctl_int(avctx, AV1E_SET_TILE_COLUMNS, ctx->tile_columns);
 +if (ctx->tile_rows >= 0)
 +codecctl_int(avctx, AV1E_SET_TILE_ROWS, ctx->tile_rows);
 +
  codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries);
  codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace);
  codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, 
 avctx->color_trc);
 @@ -746,6 +755,8 @@ static const AVOption options[] = {
  { "static-thresh","A change threshold on blocks below which they 
 will be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, { 
 .i64 = 0 }, 0, INT_MAX, VE },
  { "drop-threshold",   "Frame drop threshold", offsetof(AOMContext, 
 drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE },
  { "noise-sensitivity", "Noise sensitivity", 
 OFFSET(noise_sensitivity), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4, VE},
 +{ "tile-columns", "Number of tile columns to use, log2", 
 OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
>>>
>>> Why 6? The libaom API doesn't mention a limit, just says the argument
>>> should be in log2 unit, and that it will be capped based on the image size.
>>
>> https://aomedia.googlesource.com/aom/+/1742b043e2269dc1927afe428fbf5a46493e741e/av1/av1_cx_iface.c#298
>>  
 +{ "tile-rows", "Number of tile rows to use, log2", OFFSET(tile_rows), 
 AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
>>>
>>> And for this one it says the range is [0-2].
>>
>> Who says it? I can pass --tile-rows=6 to aomenc.
> 
> The doxy in the public header:
> https://aomedia.googlesource.com/aom/+/master/aom/aomcx.h#312

I guess it wasn't fixed after
https://aomedia.googlesource.com/aom/+/492c545fad1e1f980d23d79d0372857c60d31458^!/#F1

I don't think ffmpeg should deal with libaom documentation issues...
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/libaomenc: Add -tile-columns/-tile-rows

2018-08-31 Thread James Almer
On 8/31/2018 1:00 PM, Kagami Hiiragi wrote:
> On 31/08/18 18:18, James Almer wrote:
>> On 8/31/2018 11:52 AM, Kagami Hiiragi wrote:
>>> On 31/08/18 02:58, James Almer wrote:
 On 8/20/2018 2:56 PM, Kagami Hiiragi wrote:
> These options are required for multithreaded encoding, because they set
> to zero by default in av1_cx_iface.c.
>
> Signed-off-by: Kagami Hiiragi 
>
> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
> index 9431179886..55cb7ff72e 100644
> --- a/libavcodec/libaomenc.c
> +++ b/libavcodec/libaomenc.c
> @@ -68,6 +68,8 @@ typedef struct AOMEncoderContext {
>  int static_thresh;
>  int drop_threshold;
>  int noise_sensitivity;
> +int tile_columns;
> +int tile_rows;
>  } AOMContext;
>  
>  static const char *const ctlidstr[] = {
> @@ -75,6 +77,8 @@ static const char *const ctlidstr[] = {
>  [AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL",
>  [AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF",
>  [AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD",
> +[AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS",
> +[AV1E_SET_TILE_ROWS]= "AV1E_SET_TILE_ROWS",
>  [AV1E_SET_COLOR_RANGE]  = "AV1E_SET_COLOR_RANGE",
>  [AV1E_SET_COLOR_PRIMARIES]  = "AV1E_SET_COLOR_PRIMARIES",
>  [AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS",
> @@ -449,6 +453,11 @@ static av_cold int aom_init(AVCodecContext *avctx,
>  if (ctx->crf >= 0)
>  codecctl_int(avctx, AOME_SET_CQ_LEVEL,  ctx->crf);
>  
> +if (ctx->tile_columns >= 0)
> +codecctl_int(avctx, AV1E_SET_TILE_COLUMNS, ctx->tile_columns);
> +if (ctx->tile_rows >= 0)
> +codecctl_int(avctx, AV1E_SET_TILE_ROWS, ctx->tile_rows);
> +
>  codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, 
> avctx->color_primaries);
>  codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace);
>  codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, 
> avctx->color_trc);
> @@ -746,6 +755,8 @@ static const AVOption options[] = {
>  { "static-thresh","A change threshold on blocks below which they 
> will be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, 
> { .i64 = 0 }, 0, INT_MAX, VE },
>  { "drop-threshold",   "Frame drop threshold", offsetof(AOMContext, 
> drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE },
>  { "noise-sensitivity", "Noise sensitivity", 
> OFFSET(noise_sensitivity), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4, VE},
> +{ "tile-columns", "Number of tile columns to use, log2", 
> OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},

 Why 6? The libaom API doesn't mention a limit, just says the argument
 should be in log2 unit, and that it will be capped based on the image size.
>>>
>>> https://aomedia.googlesource.com/aom/+/1742b043e2269dc1927afe428fbf5a46493e741e/av1/av1_cx_iface.c#298
>>>  
> +{ "tile-rows", "Number of tile rows to use, log2", 
> OFFSET(tile_rows), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},

 And for this one it says the range is [0-2].
>>>
>>> Who says it? I can pass --tile-rows=6 to aomenc.
>>
>> The doxy in the public header:
>> https://aomedia.googlesource.com/aom/+/master/aom/aomcx.h#312
> 
> I guess it wasn't fixed after
> https://aomedia.googlesource.com/aom/+/492c545fad1e1f980d23d79d0372857c60d31458^!/#F1
> 
> I don't think ffmpeg should deal with libaom documentation issues...

Seeing it's effectively a documentation issue, and that the change you
quoted was made before libaom 1.0.0 was tagged, then i guess the patch
is ok.

I reported it to libaom bug tracker as well.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [LDP] FFmpeg at LinuxDays 2018 in Prague

2018-08-31 Thread Thilo Borgmann
Hi all,

FFmpeg been accepted for a booth at the LinuxDays 2018 in Prague, Czech 
Republic during October 6th to 7th!

We've made contact during this years CLT. This is our first attendance to this 
end-user conference that has a similar program like the Linux Days in Chemnitz 
- means mainly booths and talks as well as a lot of users and fellow 
open-source projects. Find detailed information here:

https://www.linuxdays.cz/2018/en/

Currently, I'm the only staff member registered - any other developer is 
welcome to join in! Prague is quite affordable regarding travel & accomodation, 
so don't hesitate if you've interest in coming.

Hope to meet you there!

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


Re: [FFmpeg-devel] [PATCH] lavc/libaomenc: Add -tile-columns/-tile-rows

2018-08-31 Thread James Zern
On Fri, Aug 31, 2018 at 9:40 AM James Almer  wrote:
>
> On 8/31/2018 1:00 PM, Kagami Hiiragi wrote:
> > On 31/08/18 18:18, James Almer wrote:
> >> On 8/31/2018 11:52 AM, Kagami Hiiragi wrote:
> >>> On 31/08/18 02:58, James Almer wrote:
>  On 8/20/2018 2:56 PM, Kagami Hiiragi wrote:
> > These options are required for multithreaded encoding, because they set
> > to zero by default in av1_cx_iface.c.
> >
> > Signed-off-by: Kagami Hiiragi 
> >
> > diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
> > index 9431179886..55cb7ff72e 100644
> > --- a/libavcodec/libaomenc.c
> > +++ b/libavcodec/libaomenc.c
> > @@ -68,6 +68,8 @@ typedef struct AOMEncoderContext {
> >  int static_thresh;
> >  int drop_threshold;
> >  int noise_sensitivity;
> > +int tile_columns;
> > +int tile_rows;
> >  } AOMContext;
> >
> >  static const char *const ctlidstr[] = {
> > @@ -75,6 +77,8 @@ static const char *const ctlidstr[] = {
> >  [AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL",
> >  [AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF",
> >  [AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD",
> > +[AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS",
> > +[AV1E_SET_TILE_ROWS]= "AV1E_SET_TILE_ROWS",
> >  [AV1E_SET_COLOR_RANGE]  = "AV1E_SET_COLOR_RANGE",
> >  [AV1E_SET_COLOR_PRIMARIES]  = "AV1E_SET_COLOR_PRIMARIES",
> >  [AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS",
> > @@ -449,6 +453,11 @@ static av_cold int aom_init(AVCodecContext *avctx,
> >  if (ctx->crf >= 0)
> >  codecctl_int(avctx, AOME_SET_CQ_LEVEL,  ctx->crf);
> >
> > +if (ctx->tile_columns >= 0)
> > +codecctl_int(avctx, AV1E_SET_TILE_COLUMNS, ctx->tile_columns);
> > +if (ctx->tile_rows >= 0)
> > +codecctl_int(avctx, AV1E_SET_TILE_ROWS, ctx->tile_rows);
> > +
> >  codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, 
> > avctx->color_primaries);
> >  codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, 
> > avctx->colorspace);
> >  codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, 
> > avctx->color_trc);
> > @@ -746,6 +755,8 @@ static const AVOption options[] = {
> >  { "static-thresh","A change threshold on blocks below which 
> > they will be skipped by the encoder", OFFSET(static_thresh), 
> > AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
> >  { "drop-threshold",   "Frame drop threshold", offsetof(AOMContext, 
> > drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE },
> >  { "noise-sensitivity", "Noise sensitivity", 
> > OFFSET(noise_sensitivity), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4, VE},
> > +{ "tile-columns", "Number of tile columns to use, log2", 
> > OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
> 
>  Why 6? The libaom API doesn't mention a limit, just says the argument
>  should be in log2 unit, and that it will be capped based on the image 
>  size.
> >>>
> >>> https://aomedia.googlesource.com/aom/+/1742b043e2269dc1927afe428fbf5a46493e741e/av1/av1_cx_iface.c#298
> >>>
> > +{ "tile-rows", "Number of tile rows to use, log2", 
> > OFFSET(tile_rows), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
> 
>  And for this one it says the range is [0-2].
> >>>
> >>> Who says it? I can pass --tile-rows=6 to aomenc.
> >>
> >> The doxy in the public header:
> >> https://aomedia.googlesource.com/aom/+/master/aom/aomcx.h#312
> >
> > I guess it wasn't fixed after
> > https://aomedia.googlesource.com/aom/+/492c545fad1e1f980d23d79d0372857c60d31458^!/#F1
> >
> > I don't think ffmpeg should deal with libaom documentation issues...
>
> Seeing it's effectively a documentation issue, and that the change you
> quoted was made before libaom 1.0.0 was tagged, then i guess the patch
> is ok.
>
> I reported it to libaom bug tracker as well.

Thanks for filing the bug, I posted a fix. Note AV1 supports
non-uniform tiles now and there's another way to specify absolute
widths and heights (--tile-width/height). This parameter wasn't
descaled to allow the encoder to choose the layout unfortunately [1].

[1] https://bugs.chromium.org/p/aomedia/issues/detail?id=2124
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel