Motion - Draw Textn Improvement

draw_textn Improvement

Introduction

This patch should give a small speed boost to the function draw_textn.

Description of Patch

Since draw_textn is a heavily called function, even minor changes can have a big impact over time. This patch merely creates a temporary variable in place of constantly recalculating the same equation multiple times in a loop.

Installation of Patch

cd <motion dir>
gunzip draw_textn-0.01.patch.gz
patch -p1 < draw_textn-0.01.patch
make clean
make
make install (as root if needed)

Change History of Patch

0.01 Initial Version

Discussion and Comments

Andrew great ! I think that the patch could be improved a bit more to avoid some CPU cycles smile The way i did is adding a new temp variable that include the x value in the for over x.


for (x=0; x<6; x++) {
int tempvar_x = tempvar +x;

...

image[tempvar_x+1+(y+starty)*width]=0;

...

-- AngelCarpintero - 26 May 2005

This patch is now in my sources for 3.2.2_snap1

-- KennethLavrsen - 03 Jun 2005
Topic revision: r8 - 13 Aug 2005, KennethLavrsen
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.