Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Zhao Zhili <quinkblack-at-foxmail.com@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Zhao Zhili <zhilizhao@tencent.com>
Subject: [FFmpeg-devel] [PATCH 2/2] aarch64/hevcdsp_idct_neon: Add implementation for idct dc 12
Date: Thu, 20 Feb 2025 00:50:31 +0800
Message-ID: <tencent_88080EB7E55D1309E84513ED737135C90905@qq.com> (raw)

From: Zhao Zhili <zhilizhao@tencent.com>

Reduce binary size at the same time. The performance compared to clang -O3
is the same.
---
 libavcodec/aarch64/hevcdsp_idct_neon.S    | 43 ++++++++++++++---------
 libavcodec/aarch64/hevcdsp_init_aarch64.c |  8 +++++
 2 files changed, 35 insertions(+), 16 deletions(-)

diff --git a/libavcodec/aarch64/hevcdsp_idct_neon.S b/libavcodec/aarch64/hevcdsp_idct_neon.S
index 4543ab6b07..e1fee0cd80 100644
--- a/libavcodec/aarch64/hevcdsp_idct_neon.S
+++ b/libavcodec/aarch64/hevcdsp_idct_neon.S
@@ -901,15 +901,33 @@ endfunc
 .endm
 
 // void ff_hevc_idct_NxN_dc_DEPTH_neon(int16_t *coeffs)
-.macro idct_dc size, bitdepth
-function ff_hevc_idct_\size\()x\size\()_dc_\bitdepth\()_neon, export=1
+.macro idct_dc size
+function ff_hevc_idct_\size\()x\size\()_dc_10_neon, export=1
         ldrsh           w1, [x0]
         add             w1, w1, #1
         asr             w1, w1, #1
-        add             w1, w1, #(1 << (13 - \bitdepth))
-        asr             w1, w1, #(14 - \bitdepth)
-        dup             v0.8h, w1
+        add             w1, w1, #(1 << (13 - 10))
+        asr             w1, w1, #(14 - 10)
+        b               2f
+endfunc
+
+function ff_hevc_idct_\size\()x\size\()_dc_12_neon, export=1
+        ldrsh           w1, [x0]
+        add             w1, w1, #1
+        asr             w1, w1, #1
+        add             w1, w1, #(1 << (13 - 12))
+        asr             w1, w1, #(14 - 12)
+        b               2f
+endfunc
 
+function ff_hevc_idct_\size\()x\size\()_dc_8_neon, export=1
+        ldrsh           w1, [x0]
+        add             w1, w1, #1
+        asr             w1, w1, #1
+        add             w1, w1, #(1 << (13 - 8))
+        asr             w1, w1, #(14 - 8)
+2:
+        dup             v0.8h, w1
 .if \size < 8
         stp             q0, q0, [x0]
 .else
@@ -932,14 +950,7 @@ function ff_hevc_idct_\size\()x\size\()_dc_\bitdepth\()_neon, export=1
 endfunc
 .endm
 
-idct_dc 4, 8
-idct_dc 4, 10
-
-idct_dc 8, 8
-idct_dc 8, 10
-
-idct_dc 16, 8
-idct_dc 16, 10
-
-idct_dc 32, 8
-idct_dc 32, 10
+idct_dc 4
+idct_dc 8
+idct_dc 16
+idct_dc 32
diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c b/libavcodec/aarch64/hevcdsp_init_aarch64.c
index 386d7c59c8..5dd470baaa 100644
--- a/libavcodec/aarch64/hevcdsp_init_aarch64.c
+++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c
@@ -91,6 +91,10 @@ void ff_hevc_idct_4x4_dc_10_neon(int16_t *coeffs);
 void ff_hevc_idct_8x8_dc_10_neon(int16_t *coeffs);
 void ff_hevc_idct_16x16_dc_10_neon(int16_t *coeffs);
 void ff_hevc_idct_32x32_dc_10_neon(int16_t *coeffs);
+void ff_hevc_idct_4x4_dc_12_neon(int16_t *coeffs);
+void ff_hevc_idct_8x8_dc_12_neon(int16_t *coeffs);
+void ff_hevc_idct_16x16_dc_12_neon(int16_t *coeffs);
+void ff_hevc_idct_32x32_dc_12_neon(int16_t *coeffs);
 void ff_hevc_transform_luma_4x4_neon_8(int16_t *coeffs);
 
 #define NEON8_FNASSIGN(member, v, h, fn, ext) \
@@ -267,5 +271,9 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
         c->add_residual[1]             = ff_hevc_add_residual_8x8_12_neon;
         c->add_residual[2]             = ff_hevc_add_residual_16x16_12_neon;
         c->add_residual[3]             = ff_hevc_add_residual_32x32_12_neon;
+        c->idct_dc[0]                  = ff_hevc_idct_4x4_dc_12_neon;
+        c->idct_dc[1]                  = ff_hevc_idct_8x8_dc_12_neon;
+        c->idct_dc[2]                  = ff_hevc_idct_16x16_dc_12_neon;
+        c->idct_dc[3]                  = ff_hevc_idct_32x32_dc_12_neon;
     }
 }
-- 
2.46.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

                 reply	other threads:[~2025-02-19 16:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_88080EB7E55D1309E84513ED737135C90905@qq.com \
    --to=quinkblack-at-foxmail.com@ffmpeg.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=zhilizhao@tencent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git