Re: [FFmpeg-devel] [PATCH V3 1/2] avfilter/vf_gblur: add x86 SIMD optimizations

2019-06-12 Thread Adam Sampson
Hi Ruiling,

Ruiling Song  writes:

> The horizontal pass get ~2x performance with the patch
> under single thread.
[...]
> +++ b/libavfilter/x86/vf_gblur.asm
[...]
> +%if ARCH_X86_64
> +INIT_XMM sse4
> +HORIZ_SLICE
> +
> +INIT_XMM avx2
> +HORIZ_SLICE
> +%endif
[...]
> +++ b/libavfilter/x86/vf_gblur_init.c
[...]
> +void ff_horiz_slice_sse4(float *ptr, int width, int height, int steps, float 
> nu, float bscale);
> +void ff_horiz_slice_avx2(float *ptr, int width, int height, int
> steps, float nu, float bscale);

This breaks the build for me on x86-32 -- the asm helpers in
vf_gblur.asm are only defined on x86-64, but vf_gblur_init.c expects
them to exist on both architectures.

ld: libavfilter/libavfilter.so: undefined reference to `ff_horiz_slice_avx2'
ld: libavfilter/libavfilter.so: undefined reference to `ff_horiz_slice_sse4'
collect2: error: ld returned 1 exit status

Adding "#if ARCH_X86_64" conditionals to vf_gblur_init.c fixes it.

Thanks,

-- 
Adam Sampson  <http://offog.org/>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH v2] lavf/jacosubdec: compute subtitle duration correctly

2019-02-19 Thread Adam Sampson
When a JACOsub subtitle has two timestamps, they represent its start and
end times (http://unicorn.us.com/jacosub/jscripts.html#l_times); the
duration is the difference between the two, not the sum of the two.

The subtitle end times in the FATE test for this were wrong as a result;
fix them too. (This test is based on JACOsub's demo.txt, and the end
time computed for the last line using @ now matches what the comments
there say it should be.)

Also tested in practice using MPV, a LaserDisc, and some authentic 1993
JACOsub files.

Signed-off-by: Adam Sampson 
---
v2: update the test data too (thanks, Carl Eugen!)

 libavformat/jacosubdec.c   |  2 +-
 tests/ref/fate/sub-jacosub | 22 +++---
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 520c435cc5..f6be5df2d7 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -127,7 +127,7 @@ shift_and_ret:
 ts_start  = (ts_start + jacosub->shift) * 100 / jacosub->timeres;
 ts_end= (ts_end   + jacosub->shift) * 100 / jacosub->timeres;
 *start= ts_start;
-*duration = ts_start + ts_end;
+*duration = ts_end - ts_start;
 return buf + len;
 }
 
diff --git a/tests/ref/fate/sub-jacosub b/tests/ref/fate/sub-jacosub
index a30fe4a196..5f282cdcf6 100644
--- a/tests/ref/fate/sub-jacosub
+++ b/tests/ref/fate/sub-jacosub
@@ -10,14 +10,14 @@ Style: 
Default,Arial,16,0,0,0,0,100,100,0,0,1,1,0,2,10
 
 [Events]
 Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:00.12,0:00:04.36,Default,,0,0,0,,{\an5}JACOsub\N\NThis script 
demonstrates some of the capabilities of JACOsub.
-Dialogue: 0,0:00:04.12,0:00:14.86,Default,,0,0,0,,{\an8}Text may be positioned 
at the top,
-Dialogue: 0,0:00:05.12,0:00:17.46,Default,,0,0,0,,{\an5}middle,
-Dialogue: 0,0:00:06.12,0:00:20.06,Default,,0,0,0,,{\an2}or bottom of the 
screen.
-Dialogue: 0,0:00:08.12,0:00:27.36,Default,,0,0,0,,{\an5}{this is a comment} 
(And, you just saw, {another comment} timing ranges for different lines of text.
-Dialogue: 0,0:00:11.12,0:00:35.86,Default,,0,0,0,,{\an1}Within margin 
constraints\Nthat you set, text may be\Nleft justified,
-Dialogue: 0,0:00:13.62,0:00:42.11,Default,,0,0,0,,{\an2}{the JC is redundant - 
it's the default}center\Njustified,
-Dialogue: 0,0:00:14.87,0:00:45.86,Default,,0,0,0,,{\an3}and also\Nright 
justified.
-Dialogue: 0,0:00:22.42,0:01:12.76,Default,,0,0,0,,Text may appear in different 
styles\N(Normal, {\b1}Bold{\r}, {\i1}Italic{\r})
-Dialogue: 0,0:01:16.12,0:03:53.36,Default,,0,0,0,,{\an5}\N\NAt that time, you 
may press any key to return to the Editor.
-Dialogue: 0,0:01:16.12,0:03:53.36,Default,,0,0,0,,OK, this script will be 
finished when the screen goes blank.
+Dialogue: 0,0:00:00.12,0:00:04.12,Default,,0,0,0,,{\an5}JACOsub\N\NThis script 
demonstrates some of the capabilities of JACOsub.
+Dialogue: 0,0:00:04.12,0:00:06.62,Default,,0,0,0,,{\an8}Text may be positioned 
at the top,
+Dialogue: 0,0:00:05.12,0:00:07.22,Default,,0,0,0,,{\an5}middle,
+Dialogue: 0,0:00:06.12,0:00:07.82,Default,,0,0,0,,{\an2}or bottom of the 
screen.
+Dialogue: 0,0:00:08.12,0:00:11.12,Default,,0,0,0,,{\an5}{this is a comment} 
(And, you just saw, {another comment} timing ranges for different lines of text.
+Dialogue: 0,0:00:11.12,0:00:13.62,Default,,0,0,0,,{\an1}Within margin 
constraints\Nthat you set, text may be\Nleft justified,
+Dialogue: 0,0:00:13.62,0:00:14.87,Default,,0,0,0,,{\an2}{the JC is redundant - 
it's the default}center\Njustified,
+Dialogue: 0,0:00:14.87,0:00:16.12,Default,,0,0,0,,{\an3}and also\Nright 
justified.
+Dialogue: 0,0:00:22.42,0:00:27.92,Default,,0,0,0,,Text may appear in different 
styles\N(Normal, {\b1}Bold{\r}, {\i1}Italic{\r})
+Dialogue: 0,0:01:16.12,0:01:21.12,Default,,0,0,0,,{\an5}\N\NAt that time, you 
may press any key to return to the Editor.
+Dialogue: 0,0:01:16.12,0:01:21.12,Default,,0,0,0,,OK, this script will be 
finished when the screen goes blank.
-- 
2.20.1

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


[FFmpeg-devel] [PATCH v2] lavf/jacosubdec: compute subtitle duration correctly

2019-02-13 Thread Adam Sampson
When a JACOsub subtitle has two timestamps, they represent its start and
end times (http://unicorn.us.com/jacosub/jscripts.html#l_times); the
duration is the difference between the two, not the sum of the two.

The subtitle end times in the FATE test for this were wrong as a result;
fix them too. (This test is based on JACOsub's demo.txt, and the end
time computed for the last line using @ now matches what the comments
there say it should be.)

Also tested in practice using MPV, a LaserDisc, and some authentic 1993
JACOsub files.

Signed-off-by: Adam Sampson 
---
v2: update the test data too (thanks, Carl Eugen!)

 libavformat/jacosubdec.c   |  2 +-
 tests/ref/fate/sub-jacosub | 22 +++---
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 520c435cc5..f6be5df2d7 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -127,7 +127,7 @@ shift_and_ret:
 ts_start  = (ts_start + jacosub->shift) * 100 / jacosub->timeres;
 ts_end= (ts_end   + jacosub->shift) * 100 / jacosub->timeres;
 *start= ts_start;
-*duration = ts_start + ts_end;
+*duration = ts_end - ts_start;
 return buf + len;
 }
 
diff --git a/tests/ref/fate/sub-jacosub b/tests/ref/fate/sub-jacosub
index a30fe4a196..5f282cdcf6 100644
--- a/tests/ref/fate/sub-jacosub
+++ b/tests/ref/fate/sub-jacosub
@@ -10,14 +10,14 @@ Style: 
Default,Arial,16,0,0,0,0,100,100,0,0,1,1,0,2,10
 
 [Events]
 Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:00.12,0:00:04.36,Default,,0,0,0,,{\an5}JACOsub\N\NThis script 
demonstrates some of the capabilities of JACOsub.
-Dialogue: 0,0:00:04.12,0:00:14.86,Default,,0,0,0,,{\an8}Text may be positioned 
at the top,
-Dialogue: 0,0:00:05.12,0:00:17.46,Default,,0,0,0,,{\an5}middle,
-Dialogue: 0,0:00:06.12,0:00:20.06,Default,,0,0,0,,{\an2}or bottom of the 
screen.
-Dialogue: 0,0:00:08.12,0:00:27.36,Default,,0,0,0,,{\an5}{this is a comment} 
(And, you just saw, {another comment} timing ranges for different lines of text.
-Dialogue: 0,0:00:11.12,0:00:35.86,Default,,0,0,0,,{\an1}Within margin 
constraints\Nthat you set, text may be\Nleft justified,
-Dialogue: 0,0:00:13.62,0:00:42.11,Default,,0,0,0,,{\an2}{the JC is redundant - 
it's the default}center\Njustified,
-Dialogue: 0,0:00:14.87,0:00:45.86,Default,,0,0,0,,{\an3}and also\Nright 
justified.
-Dialogue: 0,0:00:22.42,0:01:12.76,Default,,0,0,0,,Text may appear in different 
styles\N(Normal, {\b1}Bold{\r}, {\i1}Italic{\r})
-Dialogue: 0,0:01:16.12,0:03:53.36,Default,,0,0,0,,{\an5}\N\NAt that time, you 
may press any key to return to the Editor.
-Dialogue: 0,0:01:16.12,0:03:53.36,Default,,0,0,0,,OK, this script will be 
finished when the screen goes blank.
+Dialogue: 0,0:00:00.12,0:00:04.12,Default,,0,0,0,,{\an5}JACOsub\N\NThis script 
demonstrates some of the capabilities of JACOsub.
+Dialogue: 0,0:00:04.12,0:00:06.62,Default,,0,0,0,,{\an8}Text may be positioned 
at the top,
+Dialogue: 0,0:00:05.12,0:00:07.22,Default,,0,0,0,,{\an5}middle,
+Dialogue: 0,0:00:06.12,0:00:07.82,Default,,0,0,0,,{\an2}or bottom of the 
screen.
+Dialogue: 0,0:00:08.12,0:00:11.12,Default,,0,0,0,,{\an5}{this is a comment} 
(And, you just saw, {another comment} timing ranges for different lines of text.
+Dialogue: 0,0:00:11.12,0:00:13.62,Default,,0,0,0,,{\an1}Within margin 
constraints\Nthat you set, text may be\Nleft justified,
+Dialogue: 0,0:00:13.62,0:00:14.87,Default,,0,0,0,,{\an2}{the JC is redundant - 
it's the default}center\Njustified,
+Dialogue: 0,0:00:14.87,0:00:16.12,Default,,0,0,0,,{\an3}and also\Nright 
justified.
+Dialogue: 0,0:00:22.42,0:00:27.92,Default,,0,0,0,,Text may appear in different 
styles\N(Normal, {\b1}Bold{\r}, {\i1}Italic{\r})
+Dialogue: 0,0:01:16.12,0:01:21.12,Default,,0,0,0,,{\an5}\N\NAt that time, you 
may press any key to return to the Editor.
+Dialogue: 0,0:01:16.12,0:01:21.12,Default,,0,0,0,,OK, this script will be 
finished when the screen goes blank.
-- 
2.20.1

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


[FFmpeg-devel] [PATCH] lavf/jacosubdec: compute subtitle duration correctly

2019-02-12 Thread Adam Sampson
When a JACOsub subtitle has two timestamps, they represent its start and
end times (http://unicorn.us.com/jacosub/jscripts.html#l_times); the
duration is the difference between the two, not the sum of the two.

Tested using MPV, a LaserDisc, and some authentic 1993 JACOsub files.
---
 libavformat/jacosubdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 520c435cc5..f6be5df2d7 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -127,7 +127,7 @@ shift_and_ret:
 ts_start  = (ts_start + jacosub->shift) * 100 / jacosub->timeres;
 ts_end= (ts_end   + jacosub->shift) * 100 / jacosub->timeres;
 *start= ts_start;
-*duration = ts_start + ts_end;
+*duration = ts_end - ts_start;
 return buf + len;
 }
 
-- 
2.20.1

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