[FFmpeg-devel] [PATCH 1/2] avfilter/vf_histogram: clean up code
zhilizhao
quinkblack at foxmail.com
Mon Dec 16 10:05:27 EET 2019
> On Dec 15, 2019, at 12:35 AM, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
>
> Am Sa., 14. Dez. 2019 um 08:28 Uhr schrieb zhilizhao <quinkblack at foxmail.com>:
>
>>> On Dec 13, 2019, at 10:00 PM, Paul B Mahol <onemda at gmail.com> wrote:
>>>
>>> Please provide some explanation.
>>
>> No functional changes, just use temporary variables to make code more readable,
>
>> and may improve a little bit of performance.
>
> Such a claim needs numbers and / or a testcase.
It may or may not improve performance depends on compiler optimization, and I don’t
think such small change can lead to measurable difference.
Assemble results on aarch64. Less deferences lead to smaller inner loop, but it doesn’t
mean much.
Before:
.LBB1_11: // Parent Loop BB1_4 Depth=1
// => This Inner Loop Header: Depth=2
//DEBUG_VALUE: filter_frame:i <- 0
//DEBUG_VALUE: dst_w <- $w11
//DEBUG_VALUE: dst_h <- $w25
//DEBUG_VALUE: filter_frame:k <- $x19
//DEBUG_VALUE: filter_frame:out <- $x20
//DEBUG_VALUE: filter_frame:outlink <- $x28
//DEBUG_VALUE: filter_frame:h <- $x22
//DEBUG_VALUE: filter_frame:i <- $w26
.loc 15 272 37 is_stmt 1 // src/libavfilter/vf_histogram.c:272:37
ldr x8, [x23, #48]
.loc 15 272 17 is_stmt 0 // src/libavfilter/vf_histogram.c:272:17
ldrb w1, [x27]
.loc 15 272 59 // src/libavfilter/vf_histogram.c:272:59
sxtw x10, w26
.loc 15 272 17 // src/libavfilter/vf_histogram.c:272:17
mov x2, x21
.loc 15 272 52 // src/libavfilter/vf_histogram.c:272:52
add x8, x8, x19, lsl #5
ldrsw x8, [x8, #24]
.loc 15 272 24 // src/libavfilter/vf_histogram.c:272:24
ldr x9, [x20, x8, lsl #3]
.loc 15 273 28 is_stmt 1 // src/libavfilter/vf_histogram.c:273:28
add x8, x20, x8, lsl #2
ldrsw x8, [x8, #64]
.loc 15 272 59 // src/libavfilter/vf_histogram.c:272:59
nop
madd x0, x8, x10, x9
.loc 15 272 17 is_stmt 0 // src/libavfilter/vf_histogram.c:272:17
bl memset
.Ltmp74:
.loc 15 271 38 is_stmt 1 // src/libavfilter/vf_histogram.c:271:38
add w26, w26, #1 // =1
.Ltmp75:
//DEBUG_VALUE: filter_frame:i <- $w26
.loc 15 271 13 is_stmt 0 // src/libavfilter/vf_histogram.c:271:13
cmp w25, w26
b.ne .LBB1_11
-----------------------------------------------------------------------------------
After:
.LBB1_11: // Parent Loop BB1_4 Depth=1
// => This Inner Loop Header: Depth=2
//DEBUG_VALUE: dst_h <- $w29
//DEBUG_VALUE: filter_frame:outlink <- [DW_OP_plus_uconst 16] [$sp+0]
//DEBUG_VALUE: filter_frame:i <- 0
//DEBUG_VALUE: data <- $x21
//DEBUG_VALUE: dst_w <- $w9
//DEBUG_VALUE: filter_frame:k <- $x19
//DEBUG_VALUE: filter_frame:out <- $x20
//DEBUG_VALUE: filter_frame:h <- $x23
//DEBUG_VALUE: filter_frame:i <- undef
.loc 15 275 17 is_stmt 1 // src/libavfilter/vf_histogram.c:275:17
ldrb w1, [x28]
mov x0, x21
mov x2, x22
bl memset
.Ltmp79:
//DEBUG_VALUE: filter_frame:i <- [DW_OP_plus_uconst 1, DW_OP_stack_value] undef
.loc 15 274 27 // src/libavfilter/vf_histogram.c:274:27
subs x29, x29, #1 // =1
.Ltmp80:
add x21, x21, x27
.Ltmp81:
.loc 15 274 13 is_stmt 0 // src/libavfilter/vf_histogram.c:274:13
b.ne .LBB1_11
>
> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list