You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	lavu/riscv: Revert d808070, removing AV_READ_TIME
				
					
				
			The implementation of ff_read_time() for RISC-V uses rdtime which has
 precision on existing hardware too low (!) for benchmarking purposes.
Deleting this implementation falls back on clock_gettime() which was
 added as the default ff_read_time() implementation in 33e4cc9.
Below are metrics gathered on SpacemiT K1, before and after this commit:
Before:
$ tests/checkasm/checkasm --bench
benchmarking with native FFmpeg timers
nop: 0.0
checkasm: using random seed 3473665261
checkasm: bench runs 1024 (1 << 10)
RVI:
 - pixblockdsp.get_pixels                [OK]
 - vc1dsp.mspel_pixels                   [OK]
RVF:
 - audiodsp.audiodsp                     [OK]
checkasm: all 4 tests passed
audiodsp.vector_clipf_c: 1388.7
audiodsp.vector_clipf_rvf: 261.5
get_pixels_c: 2.0
get_pixels_rvi: 1.5
vc1dsp.put_vc1_mspel_pixels_tab[0][0]_c: 8.0
vc1dsp.put_vc1_mspel_pixels_tab[0][0]_rvi: 1.0
vc1dsp.put_vc1_mspel_pixels_tab[1][0]_c: 2.0
vc1dsp.put_vc1_mspel_pixels_tab[1][0]_rvi: 0.5
After:
$ tests/checkasm/checkasm --bench
benchmarking with native FFmpeg timers
nop: 56.4
checkasm: using random seed 1021411603
checkasm: bench runs 1024 (1 << 10)
RVI:
 - pixblockdsp.get_pixels                [OK]
 - vc1dsp.mspel_pixels                   [OK]
RVF:
 - audiodsp.audiodsp                     [OK]
checkasm: all 4 tests passed
audiodsp.vector_clipf_c: 23236.4
audiodsp.vector_clipf_rvf: 11038.4
get_pixels_c: 79.6
get_pixels_rvi: 48.4
vc1dsp.put_vc1_mspel_pixels_tab[0][0]_c: 329.6
vc1dsp.put_vc1_mspel_pixels_tab[0][0]_rvi: 38.1
vc1dsp.put_vc1_mspel_pixels_tab[1][0]_c: 89.9
vc1dsp.put_vc1_mspel_pixels_tab[1][0]_rvi: 17.1
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
			
			
This commit is contained in:
		
				
					committed by
					
						 Rémi Denis-Courmont
						Rémi Denis-Courmont
					
				
			
			
				
	
			
			
			
						parent
						
							ab5c612137
						
					
				
				
					commit
					8280ec7a32
				
			| @@ -1,54 +0,0 @@ | ||||
| /* | ||||
|  * This file is part of FFmpeg. | ||||
|  * | ||||
|  * FFmpeg is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Lesser General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2.1 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * FFmpeg is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Lesser General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Lesser General Public | ||||
|  * License along with FFmpeg; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
|  */ | ||||
|  | ||||
| #ifndef AVUTIL_RISCV_TIMER_H | ||||
| #define AVUTIL_RISCV_TIMER_H | ||||
|  | ||||
| #include "config.h" | ||||
|  | ||||
| #if HAVE_INLINE_ASM | ||||
| #include <stdint.h> | ||||
|  | ||||
| static inline uint64_t ff_read_time(void) | ||||
| { | ||||
| #if (__riscv_xlen >= 64) | ||||
|     uintptr_t cycles; | ||||
|  | ||||
|     __asm__ volatile ("rdtime  %0" : "=r" (cycles)); | ||||
|  | ||||
| #else | ||||
|     uint64_t cycles; | ||||
|     uint32_t hi, lo, check; | ||||
|  | ||||
|     __asm__ volatile ( | ||||
|         "1: rdtimeh %0\n" | ||||
|         "   rdtime  %1\n" | ||||
|         "   rdtimeh %2\n" | ||||
|         "   bne %0, %2, 1b\n" : "=r" (hi), "=r" (lo), "=r" (check)); | ||||
|  | ||||
|     cycles = (((uint64_t)hi) << 32) | lo; | ||||
|  | ||||
| #endif | ||||
|     return cycles; | ||||
| } | ||||
|  | ||||
| #define AV_READ_TIME ff_read_time | ||||
| #define FF_TIMER_UNITS "ticks" | ||||
|  | ||||
| #endif | ||||
| #endif /* AVUTIL_RISCV_TIMER_H */ | ||||
| @@ -61,8 +61,6 @@ | ||||
| #   include "arm/timer.h" | ||||
| #elif ARCH_PPC | ||||
| #   include "ppc/timer.h" | ||||
| #elif ARCH_RISCV | ||||
| #   include "riscv/timer.h" | ||||
| #elif ARCH_X86 | ||||
| #   include "x86/timer.h" | ||||
| #elif ARCH_LOONGARCH | ||||
|   | ||||
		Reference in New Issue
	
	Block a user