[ffmpeg-devel][PATCH] OpenHEVC new MC with ASM
Hello, here is a patch submission changing the way MC is done : 4 and 8 tap filters now do the weighting too. x86 ASM is also added in the second file. Best Regards, Pierre-Edouard Lepere
Hi, On Tue, Apr 29, 2014 at 11:09 AM, Pierre Edouard Lepere < Pierre-Edouard.Lepere@insa-rennes.fr> wrote:
Hello, here is a patch submission changing the way MC is done : 4 and 8 tap filters now do the weighting too. x86 ASM is also added in the second file.
Patches look good to me. Ronald
On Tue, May 06, 2014 at 08:14:54AM -0400, Ronald S. Bultje wrote:
Hi,
On Tue, Apr 29, 2014 at 11:09 AM, Pierre Edouard Lepere < Pierre-Edouard.Lepere@insa-rennes.fr> wrote:
Hello, here is a patch submission changing the way MC is done : 4 and 8 tap filters now do the weighting too. x86 ASM is also added in the second file.
Patches look good to me.
applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No snowflake in an avalanche ever feels responsible. -- Voltaire
On 29/04/14 12:09 PM, Pierre Edouard Lepere wrote:
Hello, here is a patch submission changing the way MC is done : 4 and 8 tap filters now do the weighting too. x86 ASM is also added in the second file.
Best Regards, Pierre-Edouard Lepere
+void ff_hevcdsp_init_x86(HEVCDSPContext *c, const int bit_depth) +{ + int mm_flags = av_get_cpu_flags(); + + if (bit_depth == 8) { + if (EXTERNAL_MMX(mm_flags)) { + + if (EXTERNAL_MMXEXT(mm_flags)) { + + if (EXTERNAL_SSSE3(mm_flags) && ARCH_X86_64) {
The asm functions and the prototypes are all SSE4, yet you're checking for SSSE3 support at runtime here. This will crash on CPUs like first gen Core 2, Atom and AMD Bobcat. Also, there's no need to check for MMX and MMXEXT in a chain like this. EXTERNAL_SSSE3() is enough.
+ + EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels, 8); + EPEL_LINKS(c->put_hevc_epel, 0, 1, epel_h, 8); + EPEL_LINKS(c->put_hevc_epel, 1, 0, epel_v, 8); + EPEL_LINKS(c->put_hevc_epel, 1, 1, epel_hv, 8); + + QPEL_LINKS(c->put_hevc_qpel, 0, 0, pel_pixels, 8); + QPEL_LINKS(c->put_hevc_qpel, 0, 1, qpel_h, 8); + QPEL_LINKS(c->put_hevc_qpel, 1, 0, qpel_v, 8); + QPEL_LINKS(c->put_hevc_qpel, 1, 1, qpel_hv, 8); + + } + } + } + } else if (bit_depth == 10) { + if (EXTERNAL_MMX(mm_flags)) { + if (EXTERNAL_MMXEXT(mm_flags) && ARCH_X86_64) { + + if (EXTERNAL_SSSE3(mm_flags)) {
Same as above.
+ + EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels, 10); + EPEL_LINKS(c->put_hevc_epel, 0, 1, epel_h, 10); + EPEL_LINKS(c->put_hevc_epel, 1, 0, epel_v, 10); + EPEL_LINKS(c->put_hevc_epel, 1, 1, epel_hv, 10); + + QPEL_LINKS(c->put_hevc_qpel, 0, 0, pel_pixels, 10); + QPEL_LINKS(c->put_hevc_qpel, 0, 1, qpel_h, 10); + QPEL_LINKS(c->put_hevc_qpel, 1, 0, qpel_v, 10); + QPEL_LINKS(c->put_hevc_qpel, 1, 1, qpel_hv, 10); + } + + } + } + } +}
On Tue, May 06, 2014 at 01:04:35PM -0300, James Almer wrote:
On 29/04/14 12:09 PM, Pierre Edouard Lepere wrote:
Hello, here is a patch submission changing the way MC is done : 4 and 8 tap filters now do the weighting too. x86 ASM is also added in the second file.
Best Regards, Pierre-Edouard Lepere
+void ff_hevcdsp_init_x86(HEVCDSPContext *c, const int bit_depth) +{ + int mm_flags = av_get_cpu_flags(); + + if (bit_depth == 8) { + if (EXTERNAL_MMX(mm_flags)) { + + if (EXTERNAL_MMXEXT(mm_flags)) { + + if (EXTERNAL_SSSE3(mm_flags) && ARCH_X86_64) {
The asm functions and the prototypes are all SSE4, yet you're checking for SSSE3 support at runtime here. This will crash on CPUs like first gen Core 2, Atom and AMD Bobcat.
Also, there's no need to check for MMX and MMXEXT in a chain like this. EXTERNAL_SSSE3() is enough.
+ + EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels, 8); + EPEL_LINKS(c->put_hevc_epel, 0, 1, epel_h, 8); + EPEL_LINKS(c->put_hevc_epel, 1, 0, epel_v, 8); + EPEL_LINKS(c->put_hevc_epel, 1, 1, epel_hv, 8); + + QPEL_LINKS(c->put_hevc_qpel, 0, 0, pel_pixels, 8); + QPEL_LINKS(c->put_hevc_qpel, 0, 1, qpel_h, 8); + QPEL_LINKS(c->put_hevc_qpel, 1, 0, qpel_v, 8); + QPEL_LINKS(c->put_hevc_qpel, 1, 1, qpel_hv, 8); + + } + } + } + } else if (bit_depth == 10) { + if (EXTERNAL_MMX(mm_flags)) { + if (EXTERNAL_MMXEXT(mm_flags) && ARCH_X86_64) { + + if (EXTERNAL_SSSE3(mm_flags)) {
Same as above.
fixed (was easier for me to fix instead of waiting for a new patch as i already had fixed 2 other issues locally ...) thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many that live deserve death. And some that die deserve life. Can you give it to them? Then do not be too eager to deal out death in judgement. For even the very wise cannot see all ends. -- Gandalf
On 06/05/14 1:34 PM, Michael Niedermayer wrote:
On Tue, May 06, 2014 at 01:04:35PM -0300, James Almer wrote:
On 29/04/14 12:09 PM, Pierre Edouard Lepere wrote:
Hello, here is a patch submission changing the way MC is done : 4 and 8 tap filters now do the weighting too. x86 ASM is also added in the second file.
Best Regards, Pierre-Edouard Lepere
+void ff_hevcdsp_init_x86(HEVCDSPContext *c, const int bit_depth) +{ + int mm_flags = av_get_cpu_flags(); + + if (bit_depth == 8) { + if (EXTERNAL_MMX(mm_flags)) { + + if (EXTERNAL_MMXEXT(mm_flags)) { + + if (EXTERNAL_SSSE3(mm_flags) && ARCH_X86_64) {
The asm functions and the prototypes are all SSE4, yet you're checking for SSSE3 support at runtime here. This will crash on CPUs like first gen Core 2, Atom and AMD Bobcat.
Also, there's no need to check for MMX and MMXEXT in a chain like this. EXTERNAL_SSSE3() is enough.
+ + EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels, 8); + EPEL_LINKS(c->put_hevc_epel, 0, 1, epel_h, 8); + EPEL_LINKS(c->put_hevc_epel, 1, 0, epel_v, 8); + EPEL_LINKS(c->put_hevc_epel, 1, 1, epel_hv, 8); + + QPEL_LINKS(c->put_hevc_qpel, 0, 0, pel_pixels, 8); + QPEL_LINKS(c->put_hevc_qpel, 0, 1, qpel_h, 8); + QPEL_LINKS(c->put_hevc_qpel, 1, 0, qpel_v, 8); + QPEL_LINKS(c->put_hevc_qpel, 1, 1, qpel_hv, 8); + + } + } + } + } else if (bit_depth == 10) { + if (EXTERNAL_MMX(mm_flags)) { + if (EXTERNAL_MMXEXT(mm_flags) && ARCH_X86_64) { + + if (EXTERNAL_SSSE3(mm_flags)) {
Same as above.
fixed (was easier for me to fix instead of waiting for a new patch as i already had fixed 2 other issues locally ...)
thx
Seems to break fate for msvc x64 and mingw-w64 (probably also icl). http://fate.ffmpeg.org/report.cgi?time=20140506174737&slot=x86_64-msvc12-windows-native http://fate.ffmpeg.org/report.cgi?time=20140506193115&slot=x86_64-mingw-w64-windows-native Linux gcc and clang seem unaffected so far, but in a couple hours something might show up.
Hi, On Tue, May 6, 2014 at 3:43 PM, James Almer <jamrial@gmail.com> wrote:
On 06/05/14 1:34 PM, Michael Niedermayer wrote:
On Tue, May 06, 2014 at 01:04:35PM -0300, James Almer wrote:
On 29/04/14 12:09 PM, Pierre Edouard Lepere wrote:
Hello, here is a patch submission changing the way MC is done : 4 and 8 tap filters now do the weighting too. x86 ASM is also added in the second file.
Best Regards, Pierre-Edouard Lepere
+void ff_hevcdsp_init_x86(HEVCDSPContext *c, const int bit_depth) +{ + int mm_flags = av_get_cpu_flags(); + + if (bit_depth == 8) { + if (EXTERNAL_MMX(mm_flags)) { + + if (EXTERNAL_MMXEXT(mm_flags)) { + + if (EXTERNAL_SSSE3(mm_flags) && ARCH_X86_64) {
The asm functions and the prototypes are all SSE4, yet you're checking for SSSE3 support at runtime here. This will crash on CPUs like first gen Core 2, Atom and AMD Bobcat.
Also, there's no need to check for MMX and MMXEXT in a chain like this. EXTERNAL_SSSE3() is enough.
+ + EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels, 8); + EPEL_LINKS(c->put_hevc_epel, 0, 1, epel_h, 8); + EPEL_LINKS(c->put_hevc_epel, 1, 0, epel_v, 8); + EPEL_LINKS(c->put_hevc_epel, 1, 1, epel_hv, 8); + + QPEL_LINKS(c->put_hevc_qpel, 0, 0, pel_pixels, 8); + QPEL_LINKS(c->put_hevc_qpel, 0, 1, qpel_h, 8); + QPEL_LINKS(c->put_hevc_qpel, 1, 0, qpel_v, 8); + QPEL_LINKS(c->put_hevc_qpel, 1, 1, qpel_hv, 8); + + } + } + } + } else if (bit_depth == 10) { + if (EXTERNAL_MMX(mm_flags)) { + if (EXTERNAL_MMXEXT(mm_flags) && ARCH_X86_64) { + + if (EXTERNAL_SSSE3(mm_flags)) {
Same as above.
fixed (was easier for me to fix instead of waiting for a new patch as i already had fixed 2 other issues locally ...)
thx
Seems to break fate for msvc x64 and mingw-w64 (probably also icl).
http://fate.ffmpeg.org/report.cgi?time=20140506174737&slot=x86_64-msvc12-windows-native
http://fate.ffmpeg.org/report.cgi?time=20140506193115&slot=x86_64-mingw-w64-windows-native
Linux gcc and clang seem unaffected so far, but in a couple hours something might show up.
That's usually a sign that we reported use of xmm regs uncorrectly in cglobal, which causes xmm reg clobbers. Ronald
Hi, the ASM is indicated as SSE4 bevause we use SSE4 intrinsics in openHEVC. in FFmpeg, I believe the ASM is SSSE3 at most. I have a computer which supports SSSE3 only, so I will test on it if all the ASM can go from SSE4 to SSSE3. in the meantime, I've done a patch which changes the macros in hevcdsp_init.c and hevcdsp.h so we can re-use the macros for other optimisations : SSE2, AVX2... etc. Regards, Pierre-Edouard Lepere
On Wed, May 07, 2014 at 10:37:50AM +0200, Pierre Edouard Lepere wrote:
Hi, the ASM is indicated as SSE4 bevause we use SSE4 intrinsics in openHEVC. in FFmpeg, I believe the ASM is SSSE3 at most. I have a computer which supports SSSE3 only, so I will test on it if all the ASM can go from SSE4 to SSSE3.
in the meantime, I've done a patch which changes the macros in hevcdsp_init.c and hevcdsp.h so we can re-use the macros for other optimisations : SSE2, AVX2... etc.
Regards, Pierre-Edouard Lepere
hevcdsp.h | 128 +++++++-------- hevcdsp_init.c | 476 ++++++++++++++++++++++++++++----------------------------- 2 files changed, 302 insertions(+), 302 deletions(-) 2fb9ddd9286c5b88d05f7e79ca0f7e9307f95af1 0001-hevc-hevcdsp_init.c-macros-are-more-modular-to-suppo.patch From 1c70af619065af6042d968b79df041cd32863ce4 Mon Sep 17 00:00:00 2001 From: plepere <pierre-edouard.lepere@insa-rennes.fr> Date: Wed, 7 May 2014 09:58:34 +0200 Subject: [PATCH] hevc : hevcdsp_init.c macros are more modular to support functions that are not sse4
applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
participants (4)
-
James Almer -
Michael Niedermayer -
Pierre Edouard Lepere -
Ronald S. Bultje