The better way is as Jell showed!
Just do open your orig source using Vdub and choose its internal Vdubfilter "Levels" .... go and pick a "sample" (tab in the filter) in a scene ....
a) .... where its very very dark
and move the left cursor that right until it touches the left end of the histogram.
b) .... where its very shining bright (like an explosion) and move the right cursor to the left until it touches the right end of the histogram.
Values should be like this
5_______1.000________245
0____________________255
First cursor bar is the full proporional modification range of the RGB/Luma
Second bar is the range which will be delivered of that resulting Luma in total of the stream.
So maybe you want to correct all your luma up to its peaks, ok, it looks nice BUT legal TV values do not allow that range between 0 and 255 and thats why you "can" correct" this afterwards as a whole. BUT we don't do that in VDub here!
So just not the values in order of appearance.
5,1.0,245,0,255
Then enter your AVS Script and put the Levels() Command
Levels(5,1.0,245,0,255)
Thats it!
And you don't need here to modify the last (0,255) values as Levels() now got the safe option "Coring" integratet which preserves a full TV legal luma range of 16-235
But caution! The image on aPC screen generally does appear more dark than in comparison to your Tv afterwards ..... that's why I would NOT change the gamma (1.0) value in levels. just a hint!