* [FFmpeg-devel] [PATCH 2/2] lavc/blockdsp: R-V V fill_block @ 2024-04-29 7:09 flow gg 2024-04-29 17:31 ` Rémi Denis-Courmont 0 siblings, 1 reply; 7+ messages in thread From: flow gg @ 2024-04-29 7:09 UTC (permalink / raw) To: FFmpeg development discussions and patches [-- Attachment #1: Type: text/plain, Size: 1 bytes --] [-- Attachment #2: 0002-lavc-blockdsp-R-V-V-fill_block.patch --] [-- Type: text/x-patch, Size: 2226 bytes --] From 4315f4e4774e3006d7cc55b6d235cb80e0173cf9 Mon Sep 17 00:00:00 2001 From: sunyuechi <sunyuechi@iscas.ac.cn> Date: Wed, 6 Mar 2024 12:46:03 +0800 Subject: [PATCH 2/2] lavc/blockdsp: R-V V fill_block C908: blockdsp.fill_block_tab[0]_c: 550.0 blockdsp.fill_block_tab[0]_rvv_i64: 48.2 blockdsp.fill_block_tab[1]_c: 148.7 blockdsp.fill_block_tab[1]_rvv_i64: 29.7 --- libavcodec/riscv/blockdsp_init.c | 6 ++++++ libavcodec/riscv/blockdsp_rvv.S | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/libavcodec/riscv/blockdsp_init.c b/libavcodec/riscv/blockdsp_init.c index 59b2f9d47b..42c8e87fa7 100644 --- a/libavcodec/riscv/blockdsp_init.c +++ b/libavcodec/riscv/blockdsp_init.c @@ -27,6 +27,10 @@ void ff_clear_block_rvv(int16_t *block); void ff_clear_blocks_rvv(int16_t *block); +void ff_fill_block16_rvv(uint8_t *block, uint8_t value, ptrdiff_t line_size, + int h); +void ff_fill_block8_rvv(uint8_t *block, uint8_t value, ptrdiff_t line_size, + int h); av_cold void ff_blockdsp_init_riscv(BlockDSPContext *c) { @@ -36,6 +40,8 @@ av_cold void ff_blockdsp_init_riscv(BlockDSPContext *c) if (flags & AV_CPU_FLAG_RVV_I64 && ff_get_rv_vlenb() >= 16) { c->clear_block = ff_clear_block_rvv; c->clear_blocks = ff_clear_blocks_rvv; + c->fill_block_tab[0] = ff_fill_block16_rvv; + c->fill_block_tab[1] = ff_fill_block8_rvv; } #endif } diff --git a/libavcodec/riscv/blockdsp_rvv.S b/libavcodec/riscv/blockdsp_rvv.S index 8bb00bb467..71d72cce56 100644 --- a/libavcodec/riscv/blockdsp_rvv.S +++ b/libavcodec/riscv/blockdsp_rvv.S @@ -40,3 +40,24 @@ func ff_clear_blocks_rvv, zve64x ret endfunc + +func ff_fill_block16_rvv, zve32x + vsetivli t0, 16, e8, m1, ta, ma + vmv.v.x v8, a1 +1: + addi a3, a3, -1 + vse8.v v8, (a0) + add a0, a0, a2 + bnez a3, 1b + + ret +endfunc + +func ff_fill_block8_rvv, zve64x + vsetvli t0, zero, e8, m8, ta, ma + vmv.v.x v8, a1 + vsetvli t0, a3, e64, m8, ta, ma + vsse64.v v8, (a0), a2 + + ret +endfunc -- 2.44.0 [-- Attachment #3: Type: text/plain, Size: 251 bytes --] _______________________________________________ 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". ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] lavc/blockdsp: R-V V fill_block 2024-04-29 7:09 [FFmpeg-devel] [PATCH 2/2] lavc/blockdsp: R-V V fill_block flow gg @ 2024-04-29 17:31 ` Rémi Denis-Courmont 2024-04-30 0:26 ` flow gg 0 siblings, 1 reply; 7+ messages in thread From: Rémi Denis-Courmont @ 2024-04-29 17:31 UTC (permalink / raw) To: FFmpeg development discussions and patches Le maanantaina 29. huhtikuuta 2024, 10.09.41 EEST flow gg a écrit : > Are you sure that this works with all vector lengths? The block8 code looks odd. -- レミ・デニ-クールモン http://www.remlab.net/ _______________________________________________ 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". ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] lavc/blockdsp: R-V V fill_block 2024-04-29 17:31 ` Rémi Denis-Courmont @ 2024-04-30 0:26 ` flow gg 2024-04-30 1:16 ` flow gg 2024-04-30 6:40 ` Rémi Denis-Courmont 0 siblings, 2 replies; 7+ messages in thread From: flow gg @ 2024-04-30 0:26 UTC (permalink / raw) To: FFmpeg development discussions and patches Hi, I initially used a loop, but according to libavcodec/blockdsp.h, the maximum is 8x16 = 128 bytes, so using ff_get_rv_vlenb() >= 16 and m8 does not require a loop. ``` /* add and put pixel (decoding) * Block sizes for op_pixels_func are 8x4,8x8 16x8 16x16. * h for op_pixels_func is limited to { width / 2, width }, * but never larger than 16 and never smaller than 4. */ typedef void (*op_fill_func)(uint8_t *block /* align width (8 or 16) */, uint8_t value, ptrdiff_t line_size, int h); ``` Rémi Denis-Courmont <remi@remlab.net> 于2024年4月30日周二 01:31写道: > Le maanantaina 29. huhtikuuta 2024, 10.09.41 EEST flow gg a écrit : > > > > Are you sure that this works with all vector lengths? > The block8 code looks odd. > > -- > レミ・デニ-クールモン > http://www.remlab.net/ > _______________________________________________ > 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". > _______________________________________________ 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". ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] lavc/blockdsp: R-V V fill_block 2024-04-30 0:26 ` flow gg @ 2024-04-30 1:16 ` flow gg 2024-04-30 6:40 ` Rémi Denis-Courmont 1 sibling, 0 replies; 7+ messages in thread From: flow gg @ 2024-04-30 1:16 UTC (permalink / raw) To: FFmpeg development discussions and patches [-- Attachment #1: Type: text/plain, Size: 1341 bytes --] Since there is no 8x16, I changed m8 to m4, and updated it in the reply flow gg <hlefthleft@gmail.com> 于2024年4月30日周二 08:26写道: > Hi, I initially used a loop, but according to libavcodec/blockdsp.h, > > the maximum is 8x16 = 128 bytes, so using ff_get_rv_vlenb() >= 16 and m8 > does not require a loop. > > ``` > /* add and put pixel (decoding) > * Block sizes for op_pixels_func are 8x4,8x8 16x8 16x16. > * h for op_pixels_func is limited to { width / 2, width }, > * but never larger than 16 and never smaller than 4. */ > typedef void (*op_fill_func)(uint8_t *block /* align width (8 or 16) */, > uint8_t value, ptrdiff_t line_size, int h); > ``` > > Rémi Denis-Courmont <remi@remlab.net> 于2024年4月30日周二 01:31写道: > >> Le maanantaina 29. huhtikuuta 2024, 10.09.41 EEST flow gg a écrit : >> > >> >> Are you sure that this works with all vector lengths? >> The block8 code looks odd. >> >> -- >> レミ・デニ-クールモン >> http://www.remlab.net/ >> _______________________________________________ >> 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". >> > [-- Attachment #2: 0002-lavc-blockdsp-R-V-V-fill_block.patch --] [-- Type: text/x-patch, Size: 2225 bytes --] From 38068cd4c770b24ac494bddab6c3d19149d2f5cb Mon Sep 17 00:00:00 2001 From: sunyuechi <sunyuechi@iscas.ac.cn> Date: Wed, 6 Mar 2024 12:46:03 +0800 Subject: [PATCH 2/2] lavc/blockdsp: R-V V fill_block C908: blockdsp.fill_block_tab[0]_c: 549.7 blockdsp.fill_block_tab[0]_rvv_i64: 48.2 blockdsp.fill_block_tab[1]_c: 77.0 blockdsp.fill_block_tab[1]_rvv_i64: 19.7 --- libavcodec/riscv/blockdsp_init.c | 6 ++++++ libavcodec/riscv/blockdsp_rvv.S | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/libavcodec/riscv/blockdsp_init.c b/libavcodec/riscv/blockdsp_init.c index 59b2f9d47b..42c8e87fa7 100644 --- a/libavcodec/riscv/blockdsp_init.c +++ b/libavcodec/riscv/blockdsp_init.c @@ -27,6 +27,10 @@ void ff_clear_block_rvv(int16_t *block); void ff_clear_blocks_rvv(int16_t *block); +void ff_fill_block16_rvv(uint8_t *block, uint8_t value, ptrdiff_t line_size, + int h); +void ff_fill_block8_rvv(uint8_t *block, uint8_t value, ptrdiff_t line_size, + int h); av_cold void ff_blockdsp_init_riscv(BlockDSPContext *c) { @@ -36,6 +40,8 @@ av_cold void ff_blockdsp_init_riscv(BlockDSPContext *c) if (flags & AV_CPU_FLAG_RVV_I64 && ff_get_rv_vlenb() >= 16) { c->clear_block = ff_clear_block_rvv; c->clear_blocks = ff_clear_blocks_rvv; + c->fill_block_tab[0] = ff_fill_block16_rvv; + c->fill_block_tab[1] = ff_fill_block8_rvv; } #endif } diff --git a/libavcodec/riscv/blockdsp_rvv.S b/libavcodec/riscv/blockdsp_rvv.S index 8bb00bb467..18ab17da00 100644 --- a/libavcodec/riscv/blockdsp_rvv.S +++ b/libavcodec/riscv/blockdsp_rvv.S @@ -40,3 +40,24 @@ func ff_clear_blocks_rvv, zve64x ret endfunc + +func ff_fill_block16_rvv, zve32x + vsetivli t0, 16, e8, m1, ta, ma + vmv.v.x v8, a1 +1: + addi a3, a3, -1 + vse8.v v8, (a0) + add a0, a0, a2 + bnez a3, 1b + + ret +endfunc + +func ff_fill_block8_rvv, zve64x + vsetvli t0, zero, e8, m4, ta, ma + vmv.v.x v8, a1 + vsetvli t0, a3, e64, m4, ta, ma + vsse64.v v8, (a0), a2 + + ret +endfunc -- 2.44.0 [-- Attachment #3: Type: text/plain, Size: 251 bytes --] _______________________________________________ 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". ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] lavc/blockdsp: R-V V fill_block 2024-04-30 0:26 ` flow gg 2024-04-30 1:16 ` flow gg @ 2024-04-30 6:40 ` Rémi Denis-Courmont 2024-04-30 8:22 ` flow gg 1 sibling, 1 reply; 7+ messages in thread From: Rémi Denis-Courmont @ 2024-04-30 6:40 UTC (permalink / raw) To: FFmpeg development discussions and patches Le 30 avril 2024 03:26:25 GMT+03:00, flow gg <hlefthleft@gmail.com> a écrit : >Hi, I initially used a loop, but according to libavcodec/blockdsp.h, > >the maximum is 8x16 = 128 bytes, so using ff_get_rv_vlenb() >= 16 and m8 >does not require a loop. It's okay to assume that VLENB is at least 16 bytes (as long as it's checked), but the code seems to assume (?) that it's *exactly* 16 bytes, which will break on future hardware. > >``` >/* add and put pixel (decoding) > * Block sizes for op_pixels_func are 8x4,8x8 16x8 16x16. > * h for op_pixels_func is limited to { width / 2, width }, > * but never larger than 16 and never smaller than 4. */ >typedef void (*op_fill_func)(uint8_t *block /* align width (8 or 16) */, > uint8_t value, ptrdiff_t line_size, int h); >``` > >Rémi Denis-Courmont <remi@remlab.net> 于2024年4月30日周二 01:31写道: > >> Le maanantaina 29. huhtikuuta 2024, 10.09.41 EEST flow gg a écrit : >> > >> >> Are you sure that this works with all vector lengths? >> The block8 code looks odd. >> >> -- >> レミ・デニ-クールモン >> http://www.remlab.net/ >> _______________________________________________ >> 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". >> >_______________________________________________ >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". _______________________________________________ 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". ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] lavc/blockdsp: R-V V fill_block 2024-04-30 6:40 ` Rémi Denis-Courmont @ 2024-04-30 8:22 ` flow gg 2024-04-30 12:49 ` Rémi Denis-Courmont 0 siblings, 1 reply; 7+ messages in thread From: flow gg @ 2024-04-30 8:22 UTC (permalink / raw) To: FFmpeg development discussions and patches Since the number of stores is controlled by a3 and not by zero, it doesn't have to be exactly 16 bytes ? Rémi Denis-Courmont <remi@remlab.net> 于2024年4月30日周二 14:40写道: > > > Le 30 avril 2024 03:26:25 GMT+03:00, flow gg <hlefthleft@gmail.com> a > écrit : > >Hi, I initially used a loop, but according to libavcodec/blockdsp.h, > > > >the maximum is 8x16 = 128 bytes, so using ff_get_rv_vlenb() >= 16 and m8 > >does not require a loop. > > It's okay to assume that VLENB is at least 16 bytes (as long as it's > checked), but the code seems to assume (?) that it's *exactly* 16 bytes, > which will break on future hardware. > > > > >``` > >/* add and put pixel (decoding) > > * Block sizes for op_pixels_func are 8x4,8x8 16x8 16x16. > > * h for op_pixels_func is limited to { width / 2, width }, > > * but never larger than 16 and never smaller than 4. */ > >typedef void (*op_fill_func)(uint8_t *block /* align width (8 or 16) */, > > uint8_t value, ptrdiff_t line_size, int h); > >``` > > > >Rémi Denis-Courmont <remi@remlab.net> 于2024年4月30日周二 01:31写道: > > > >> Le maanantaina 29. huhtikuuta 2024, 10.09.41 EEST flow gg a écrit : > >> > > >> > >> Are you sure that this works with all vector lengths? > >> The block8 code looks odd. > >> > >> -- > >> レミ・デニ-クールモン > >> http://www.remlab.net/ > >> _______________________________________________ > >> 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". > >> > >_______________________________________________ > >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". > _______________________________________________ > 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". > _______________________________________________ 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". ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/2] lavc/blockdsp: R-V V fill_block 2024-04-30 8:22 ` flow gg @ 2024-04-30 12:49 ` Rémi Denis-Courmont 0 siblings, 0 replies; 7+ messages in thread From: Rémi Denis-Courmont @ 2024-04-30 12:49 UTC (permalink / raw) To: FFmpeg development discussions and patches Le 30 avril 2024 11:22:31 GMT+03:00, flow gg <hlefthleft@gmail.com> a écrit : >Since the number of stores is controlled by a3 and not by zero, it doesn't >have to be exactly 16 bytes ? Yeah ok, I get it now > >Rémi Denis-Courmont <remi@remlab.net> 于2024年4月30日周二 14:40写道: > >> >> >> Le 30 avril 2024 03:26:25 GMT+03:00, flow gg <hlefthleft@gmail.com> a >> écrit : >> >Hi, I initially used a loop, but according to libavcodec/blockdsp.h, >> > >> >the maximum is 8x16 = 128 bytes, so using ff_get_rv_vlenb() >= 16 and m8 >> >does not require a loop. >> >> It's okay to assume that VLENB is at least 16 bytes (as long as it's >> checked), but the code seems to assume (?) that it's *exactly* 16 bytes, >> which will break on future hardware. >> >> > >> >``` >> >/* add and put pixel (decoding) >> > * Block sizes for op_pixels_func are 8x4,8x8 16x8 16x16. >> > * h for op_pixels_func is limited to { width / 2, width }, >> > * but never larger than 16 and never smaller than 4. */ >> >typedef void (*op_fill_func)(uint8_t *block /* align width (8 or 16) */, >> > uint8_t value, ptrdiff_t line_size, int h); >> >``` >> > >> >Rémi Denis-Courmont <remi@remlab.net> 于2024年4月30日周二 01:31写道: >> > >> >> Le maanantaina 29. huhtikuuta 2024, 10.09.41 EEST flow gg a écrit : >> >> > >> >> >> >> Are you sure that this works with all vector lengths? >> >> The block8 code looks odd. >> >> >> >> -- >> >> レミ・デニ-クールモン >> >> http://www.remlab.net/ >> >> _______________________________________________ >> >> 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". >> >> >> >_______________________________________________ >> >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". >> _______________________________________________ >> 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". >> >_______________________________________________ >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". _______________________________________________ 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". ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-04-30 12:50 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-04-29 7:09 [FFmpeg-devel] [PATCH 2/2] lavc/blockdsp: R-V V fill_block flow gg 2024-04-29 17:31 ` Rémi Denis-Courmont 2024-04-30 0:26 ` flow gg 2024-04-30 1:16 ` flow gg 2024-04-30 6:40 ` Rémi Denis-Courmont 2024-04-30 8:22 ` flow gg 2024-04-30 12:49 ` Rémi Denis-Courmont
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