[FFmpeg-devel] [PATCH 4/4] avcodec/xpm: Minor speed increase for mod_strcspn() use string pointer

2021-02-25 Thread Jose Da Silva
Incrementing pointer *ps once is faster than computing string[i] for each time we need it. Bug fix: For the remote possibility of a crazy-long comment section that overflows int, this fix can also return a value larger than sizeof(int). Signed-off-by: Jose Da Silva --- libavcodec/xpmdec.c | 27

[FFmpeg-devel] [PATCH 3/4] avcodec/xpm: Minor speed increase for mod_strcspn() use reject pointer

2021-02-25 Thread Jose Da Silva
Incrementing pointer *pr once is faster than computing reject[j] for each time we need it. Signed-off-by: Jose Da Silva --- libavcodec/xpmdec.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index 66a9a8008c..7b3d3a7ff5

[FFmpeg-devel] [PATCH 2/4] avcodec/xpm: Minor speed increase for mod_strcspn() {string, reject}==0

2021-02-25 Thread Jose Da Silva
Test string==0 once before looping. This avoids testing 'string!=0' i times inside the for i loop, (plus more checks for comments). Test reject==0 once before looping. This avoids testing 'reject!=0' i*[strlen(reject)+1] times inside the for j loop string. Signed-o

[FFmpeg-devel] [PATCH 1/4] avcodec/xpm: Minor speed increase to function hex_char_to_number()

2021-02-25 Thread Jose Da Silva
t;int". Signed-off-by: Jose Da Silva --- libavcodec/xpmdec.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index 922dfc0f67..5aab46c52d 100644 --- a/libavcodec/xpmdec.c +++ b/libavcodec/xpmdec.c @@ -191,

Re: [FFmpeg-devel] [PATCH 2/4] avcodec/xpm: Minor speed increase for mod_strcspn() {string, reject}==0

2021-02-25 Thread Jose Da Silva
On February 24, 2021 05:56:17 AM Moritz Barsnick wrote: > On Mon, Feb 22, 2021 at 20:32:14 -0800, Jose Da Silva wrote: > > -for (i = 0; string && string[i]; i++) { > > +if (string == 0) > > "if (!string)" is the preferred style for pointers. Wor

[FFmpeg-devel] [PATCH 4/4] avcodec/xpm: Minor speed increase for mod_strcspn() use string pointer

2021-02-22 Thread Jose Da Silva
Incrementing pointer *ps once is faster than computing string[i] for each time we need it. Bug fix: For the remote possibility of a crazy-long comment section that overflows int, this fix can also return a value larger than sizeof(int). Signed-off-by: Jose Da Silva --- libavcodec/xpmdec.c | 27

[FFmpeg-devel] [PATCH 2/4] avcodec/xpm: Minor speed increase for mod_strcspn() {string, reject}==0

2021-02-22 Thread Jose Da Silva
Test string==0 once before looping. Avoid testing inside the loop. Test reject==0 once before looping. Avoid testing inside the loop. Signed-off-by: Jose Da Silva --- libavcodec/xpmdec.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/xpmdec.c b

[FFmpeg-devel] [PATCH 1/4] avcodec/xpm: Minor speed increase to function hex_char_to_number()

2021-02-22 Thread Jose Da Silva
t;int". Signed-off-by: Jose Da Silva --- libavcodec/xpmdec.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index 922dfc0f67..5aab46c52d 100644 --- a/libavcodec/xpmdec.c +++ b/libavcodec/xpmdec.c @@ -191,

[FFmpeg-devel] [PATCH 3/4] avcodec/xpm: Minor speed increase for mod_strcspn() use reject pointer

2021-02-22 Thread Jose Da Silva
Incrementing pointer *pr once is faster than computing reject[j] for each time we need it. Signed-off-by: Jose Da Silva --- libavcodec/xpmdec.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index 92a568041c..be5277e637

[FFmpeg-devel] [PATCH 2/4] avcodec/xbmenc: Pre-compute variables once for parse_str_int()

2021-01-31 Thread Jose Da Silva
Some compilers are very intuitive, and others are not so much, so let's pre-compute the variables e and keylen outside the for loop. Ensuring a minor speed increase regardless of if compiler is smart enough to solve this improvement for itself, or not. Signed-off-by: Joe Da Silva --- libavcodec/

[FFmpeg-devel] [PATCH 3/4] avcodec/xbmdec: convert() minor speed increase

2021-01-31 Thread Jose Da Silva
If we test for {0..9} first, we have tested for 10/16th of all possible characters first and avoid testing the remaining 6/16th of all possible characters, which can be either 6/16th lowercase or 6/16th uppercase. Signed-off-by: Joe Da Silva --- libavcodec/xbmdec.c | 10 +- 1 file change

[FFmpeg-devel] [PATCH 4/4] avcodec/xbmdec: get_nibble() minor speed increase, and binary reduction

2021-01-31 Thread Jose Da Silva
Replace av_isxdigit(*ptr) and convert(*ptr) with get_nibble(*ptr) which returns a valid nibble=={0x00..0x0f} or false==255 for all other values. This way we only need to work with *ptr once instead of twice. Removing inline av_isxdigit(x) functions also shrinks executable size. Signed-off-by: Joe

[FFmpeg-devel] [PATCH 1/4] avcodec/xbmenc: substitute end instead of recalculating end

2021-01-31 Thread Jose Da Silva
Minor speed increase, end is calculated before entering parse_str_int(), so let's take advantage of the value and avoid recalculating twice more. This also allows parse_str_int() to work with file size larger than int. Signed-off-by: Joe Da Silva --- libavcodec/xbmdec.c | 8 +++- 1 file chan

Re: [FFmpeg-devel] [PATCH 3/3] avcodec/xbmenc: Allow for making UW images

2021-01-28 Thread Jose Da Silva
This is an incredibly busy dev list. - pretty easy to miss a message in the noise. Thanks for the FYI. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffm

[FFmpeg-devel] [PATCH 3/3] avcodec/xbmenc: Allow for making UW images

2021-01-18 Thread Jose Da Silva
I've run into some bugs where I was downloading a bunch of data and began seeing weird hiccups. For example, javascript promises to allow you to push some very long lines of data, but the hiccups I saw was with data larger than 2k in length (windows) pushed out of a child process stdout piped in

[FFmpeg-devel] [PATCH 2/3] avcodec/xbmenc: xbm Lower memory use

2021-01-18 Thread Jose Da Silva
Two minor memory improvements. First bug reduces memory needed to about 6/7 the needed amount, which allows you to host almost 7 pictures in the same memory needed for 6 Second is a recalculation of the total additional memory for headers etc. size = avctx->height x (linesize * 6 + 1) + (31+32+3

[FFmpeg-devel] [PATCH 1/3] avcodec/xbmenc: Do not add last comma into output

2021-01-18 Thread Jose Da Silva
There is a minor bug in xbm encode which adds a trailing comma at the end of data. This isn't a big problem, but it would be nicer to be more technically true to an array of data (by not including the last comma). This bug fixes the output from something like this (having 4 values): static unsig

[FFmpeg-devel] [PATCH] avcodec/xbmenc: Better xbm memory use

2021-01-10 Thread Jose Da Silva
Small memory reduction which uses approx 6/7th total memory. Assuming \n is 2bytes, we first need {32+33+40+5}=110 but we also need to include the terminating zero => 110+1 = 111 (bug-fix). Then assuming \n is 2bytes, data requires => height * (linesize * 6 + 2) For example, " 0x00, 0x11, 0x22,\n"