[FFmpeg-devel] [PATCH] remove unused and broken test program in libavutil/base64.c
Stefano Sabatini
stefano.sabatini-lala
Sun Feb 1 19:06:21 CET 2009
On date Saturday 2009-01-31 22:08:26 +0100, Michael Niedermayer encoded:
> On Sat, Jan 31, 2009 at 07:08:41PM +0100, Stefano Sabatini wrote:
> > On date Saturday 2009-01-31 01:11:00 +0100, Michael Niedermayer encoded:
> > > On Sat, Jan 31, 2009 at 12:26:20AM +0100, Stefano Sabatini wrote:
> > > > On date Friday 2009-01-30 17:06:22 +0100, Michael Niedermayer encoded:
> > > > > On Fri, Jan 30, 2009 at 12:46:36AM +0100, Stefano Sabatini wrote:
> > > > [...]
> > > > > > I think I addressed all the points.
> > > > > >
> > > > > > Round 5:
> > > > > > ------------------8<----------------------8<-------------------------
> > > > > > #ifdef TEST
> > > > > > #include "mem.h"
> > > > > > #include "lfg.h"
> > > > > >
> > > > > > #undef printf
> > > > > >
> > > > > > #define MAX_DATA_SIZE 1024
> > > > > > #define MAX_ENCODED_SIZE 2048
> > > > > >
> > > > >
> > > > > > #define SHOW_STUFF(stuff) show_stuff ? (const char *)stuff : "[...]"
> > > > >
> > > > > please explain wat this is supposed to be good for?
> > > >
> > > > Yes, here there is the first lines of the output:
> > > >
> > > > Encoding/decoding tests
> > > > Encoding data with size 0 bytes ''... encoded as ''... passed!
> > > > Encoding data with size 1 bytes '1'... encoded as 'MQ=='... passed!
> > > > Encoding data with size 2 bytes '22'... encoded as 'MjI='... passed!
> > > > Encoding data with size 3 bytes '333'... encoded as 'MzMz'... passed!
> > > > Encoding data with size 4 bytes '4444'... encoded as 'NDQ0NA=='... passed!
> > > > Encoding data with size 5 bytes '55555'... encoded as 'NTU1NTU='... passed!
> > > > Encoding data with size 6 bytes '666666'... encoded as 'NjY2NjY2'... passed!
> > > > Encoding data with size 7 bytes 'abc:def'... encoded as 'YWJjOmRlZg=='... passed!
> > > > Encoding data with size 0 bytes '[...]'... encoded as '[...]'... passed!
> > > > Encoding data with size 968 bytes '[...]'... encoded as '[...]'... passed!
> > > > Encoding data with size 780 bytes '[...]'... encoded as '[...]'... passed!
> > > > Encoding data with size 647 bytes '[...]'... encoded as '[...]'... passed!
> > > > ...
> > > >
> > > > For the data with a reference encoded string I think it is a good idea
> > > > to show how the data is encoded, in case of problem the hacker should
> > > > be able to immediately spot where the problem is.
> > > >
> > > > For the other ones the length of the encoded string is usually too
> > > > long and it is too awkward to display it, but no strong opinion on
> > > > this, just tell how do you prefer it.
> > >
> > > hmm ok, ive not conciously registererd that this was run with several hundread
> > > bytes.
> > > >
> > > > > [...]
> > > > > > printf("\nDecoding tests on invalid data\n");
> > > > > > {
> > > > > > uint8_t data[32];
> > > > > > const char *encoded[] = { "M", "M=M=", "MQ===" };
> > > > >
> > > > > why is this splited off and not in the main table?
> > > >
> > > > I believe this test cannot be reduced to the previous one, here we're
> > > > just *decoding* and checking for validity.
> > >
> > > if(A) A -> decode, cmp B
> > > if(B) B -> encode, cmp A
> > >
> > > B being NULL
> > >
> > > am i missing something?
> >
> > The test is an encoding/decoding test, not a decoding/encoding test,
> > we could maybe find some trick to make encode_decode_test() act as a
> > decoding invalidity test, but this:
> >
> > 1) would increase complexity of a program meant to be simple
> > 2) it's not worth the trouble
>
> a if(B) is hardly more complex than to duplicate the whole check
Well we have:
test_encode_decode:
D -> E, cmp (E, E'), E -> D', cmp (D, D')
the second test is:
E -> D, if decode successfull -> fail
I cannot see an immediate way to reduce the second test to the first
one, if there is I think it would most likely make the code more
complex, maybe I'm wrong.
> also about SHOW_STUFF() it shouldnt be there and you shouldnt print
> anything at all if things are ok, just print what does not produce the
> expected output or an OK at the end
> if a 1kb case mismatches it should be printed as well
OK, done, but printing data will show non-printable chars, is this a
problem?
> > > [...]
> > > > --
> > > > FFmpeg = Fostering and Fundamental Murdering Peaceful Educated Guru
> > >
> > > are you aware that some of these are semantically contradictionary?
> >
> > Yes, and FFmpeg itself has some internal contradictions ;-),
> > furthermore semantic checkers are a little expensive these days...
>
> really?
>
> download some book in ascii txt format
> grep for a word starting with f
> then grep for "<1word> f"
> then grep for "<2word> m"
> then grep for "<3word> p"
> ...
>
> the result should be less boring i hope :)
> at least each consecutive word pair would be semantically valid even if
> longer chains may not be
Well, I followed your suggestion (check the attached script),
unfortunately is not easy to find such a words chain even in large
books, for example check this:
perl make-word-chain.pl -b ~/opt/moby.txt -w ffmpeg -n 100 -m 3
For Few Mortals
For Fedallah Ever Glad
Frequently Found Except
Fine Fellow Gets
Follow Me Particular Grounds
For Few Miles
For Few Minutes
Far From Me Pointed Extremity
For Flask Might Pretty Generally
Fiery Face Plainly
For Few Minutes
>From Few Miles
For Fear Eavesdroppers
For Few Minutes Past
>From Me Plates
For Few Minutes Past
Fastened End Gentleman
Fin For Many Great
>From Foreign Parts
For Far More Perilous
Flying From Patrolling
>From First Moved
For Fedallah Gazed
Fish Made Great
>From Me Prick Ears
For Forty Men Perceive
>From First Men Employed
Flew Forward End Gentleman
Fixed Eyes Gleaming
For Form Gable
For Forty Men Go
Fainting Fit Emblem
>From First Man Paused
Flashing Eyes Gazed
Also there don't seem to be many of such complete word chain occurrences:
$ perl /home/stefano/src/Sandbox/Perl/make-word-chain.pl -b ~/opt/moby.txt -w ffmpeg -n 10000 -m 6 | sort | uniq
Face From My Poor Eyes Gazed
Fain Feel My Poor Eyes Gazed
Fain Feel My Poor Eyes Glowing
Fair For My Poor Eyes Gazed
Famous For My Poor Eyes Gleaming
Fancy For My Poor Eyes Gleaming
Far From My Poor Eyes Gazed
Far From My Poor Eyes Grown
Features From My Poor Eyes Gleaming
Feet For My Poor Eyes Gazed
Feet For My Poor Eyes Gleaming
Feet From My Poor Eyes Gazed
Feet From My Poor Eyes Gleaming
Fell From My Poor Eyes Gazed
Fell From My Poor Eyes Gleaming
Fin For Me Pointed End Gentleman
Fish From My Poor Eyes Gazed
Fish From My Poor Eyes Grown
Fit For My Poor Eyes Gleaming
Fled From My Poor Eyes Gazed
Flukes From Me Pointed End Gentleman
Flukes From My Poor Eyes Gleaming
Food For My Poor Eyes Gleaming
For Flask Might Prove Either Great
Forth From My Poor Eyes Gazed
Forth From My Poor Eyes Gleaming
Foundations For My Poor Eyes Gleaming
Fully Feel My Poor Eyes Gleaming
and most seem involve the poor eyes, which is rather pertinent
since FFmpeg deals with video after all.
Using the relaxed mode help to increase the number of occurrences:
$ perl make-word-chain.pl -b ~/opt/moby.txt -w ffmpeg -n 200 -m 6 -r
oF Five Minutes Past thE lonG
itselF oF Many sPecies arE Good
oF itselF Must Play bEtween Given
Full oF theM uP thE seGment
Far From Me uP likE liGhtning
>From beFore hiM uPon thE howlinG
Far oFf froM sPending thE larGest
Fat Fish Made uP thEir sonG
For Five More esPecially thosE thinGs
Fighting For hiM Pass thE stranGer
halF oF theM uP thE cominG
circumFerences oF My sPine nEver Grant
oF aFter hiM uP whatEver maGic
Followed aFter Many sPerm whalE drauGhtsmen
Far oFf froM Persons whosE Green
oF itselF Must Properly bE enraGed
Feet For alMost uPon onE cleavinG
oF aFter hiM uP thE wiGht
Few oF More sPecial businEss enouGh
Enjoy ;-).
Regards.
--
FFmpeg = Flames From My Poor Eyes Gleaming
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-new-base64-test.patch
Type: text/x-diff
Size: 3432 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090201/73fa2b6f/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: make-word-chain.pl
Type: text/x-perl
Size: 2551 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090201/73fa2b6f/attachment.pl>
More information about the ffmpeg-devel
mailing list