# AviSynth Exposure plug-in, equivalent to VideoPad/FX Video Effects/Exposure

1. Hi,

Looking for AviSynth or Vdub Exposure plug-in,

I have found an AviSynth plug-in named “Exposure.dll” placed in AviSynth/plugins.
Placed “Exposure.avs” and “Test.avi" in C:/

My first question: is this Exposure plugin the equivalent to VideoPad/FX Video Effects/Exposure
2nd question: Could I somehow load “exposure.dll” in VDub?

Far as I have managed to get comprehending AviSynth?
AviSource("c:\Test.avi")
ConvertToRBG24(clip)

I do not understand how to include settings or see live changes?

--------
Exposure Function for AviSynth 2.5
Written by: Matt Pierce
When objects are rendered in 3D, lighting is often calculated by taking a sum of the light striking a surface, then modulating that by the surface color and the cosine of the angle between the surface and the light (so that direct light is "brighter" than indirect light).
The result is a mathematically accurate value (relatively accurate, at least) representing the amount of light at any individual pixel.
One problem with this method is that we are accustomed to seeing video recorded on a digital CCD or CMOS sensor or physical film.
Recording technologies such as these react to light along what is called a response curve.

A Mathematical Solution
The exposure function takes pixel values representing the amount of light and maps them to a response curve.
pixel brightness = e-amount of light
But of course, what we know about cameras is that if you expose the film for a longer amount of time, the camera will collect more light.
Expose the film for less time and the camera will collect less light.
To add this to the exposure function, we just multiple the amount of time by the amount of light being reflected off the surface.
pixel brightness = e-(amount of light • exposure time)
In this case, exposure time is actually a percentage of the original simulated exposure time - but since realtime videogames aren't calibrated to real-world light values, it's all a bit of guess-work.

Major caveat: Modern realtime videogames almost universally use HDR values to calculate lighting, then use an exposure function to map those values to clamped pixel brightnesses. Using this filter on games that use HDR lighting will result in overly-harsh images akin to pointing a camera at a TV.

The Exposure Function Plugin
This AviSynth 2.5 plugin provides functions related to the ExposureFunction.

The following functions work for RGB24 clips only.
Use ConvertToRGB24(clip) for videos in RGB32 or YUV.

clip ExposureFunction(clip, float exposure, boolean normalize)
Applies the Exposure Function to the image in a "dumb" manner.
• exposure: The intended exposure adjustment (usable exposure adjustment values are between 0.5 and 5.0)
• normalize: If true, the output values will be mapped to [0-255] regardless of their absolute brightnesses.

clip AutoExposure(clip, float min, float max, float step, int interval, float brightness)
Evaluates the image and selects an exposure adjustment value automatically.
• min: the minimum exposure adjustment value (default: 0.5)
• max: the maximum exposure adjustment value (default: 5.0)
• step: the maximum amount the exposure adjustment value can change within an interval (default: 2.0)
• interval: how many frames should elapse before the image is checked and a new ideal exposure adjustment is found (default: 10)
• brightness: the overall image brightness [0, 1] that the function should attempt to reach (default: 0.5)

-------------------------------------------

Also having trouble using VDub Intelligent Brightness in AviSynth?
VD_inbright(0, 215, 100, 100, 215, 1, 1, 215, 1)
------

Settings.vdscript
VirtualDub.audio.SetSource(1);
VirtualDub.audio.SetMode(0);
VirtualDub.audio.SetInterleave(1,500,1,0,0);
VirtualDub.audio.SetClipMode(1,1);
VirtualDub.audio.SetEditMode(1);
VirtualDub.audio.SetConversion(0,0,0,0,0);
VirtualDub.audio.SetVolume();
VirtualDub.audio.SetCompression();
VirtualDub.audio.EnableFilterGraph(0);
VirtualDub.video.SetInputFormat(0);
VirtualDub.video.SetOutputFormat(7);
VirtualDub.video.SetMode(3);
VirtualDub.video.SetSmartRendering(0);
VirtualDub.video.SetPreserveEmptyFrames(0);
VirtualDub.video.SetFrameRate2(0,0,1);
VirtualDub.video.SetIVTC(0, 0, 0, 0);
VirtualDub.video.SetCompression();
VirtualDub.SaveFormatAVI();
VirtualDub.SaveAudioFormat("");
VirtualDub.video.filters.BeginUpdate();
VirtualDub.video.filters.Clear();
VirtualDub.video.filters.instance[0].Config(0, 215, 100, 100, 215, 1, 1, 215, 1);
VirtualDub.video.filters.EndUpdate();
VirtualDub.audio.filters.Clear();

-------------------------------------------

Done the best I can, but need some help.
Thanks.
Charles
2. Avisynth scripts are used by opening them in a host program, eg. Virtualdub2.
Open the Virtualdub2 window and drag your script icon onto the window.

The way to call this function is noted in the blurb above:

Code:
```clip ExposureFunction(clip, float exposure, boolean normalize)

Applies the Exposure Function to the image in a "dumb" manner.
• exposure: The intended exposure adjustment (usable exposure adjustment values are between 0.5 and 5.0)
• normalize: If true, the output values will be mapped to [0-255] regardless of their absolute brightnesses.

clip AutoExposure(clip, float min, float max, float step, int interval, float brightness)

Evaluates the image and selects an exposure adjustment value automatically.
• min: the minimum exposure adjustment value (default: 0.5)
• max: the maximum exposure adjustment value (default: 5.0)
• step: the maximum amount the exposure adjustment value can change within an interval (default: 2.0)
• interval: how many frames should elapse before the image is checked and a new ideal exposure adjustment is found (default: 10)
• brightness: the overall image brightness [0, 1] that the function should attempt to reach (default: 0.5)```
3. Un-needed post
4. Intelligent Brightness works a Treat.

AviSource("c:\Test.avi")
ConvertToRGB32()
VD_inbright(0, 215, 100, 100, 215, 1, 1, 215, 1)

--------------------------

No errors, but dosen't Seems to be doing anything

AviSource("c:\Test.avi")
ConvertToRGB24
ExposureFunction(exposure=2, normalize=false)
# AutoExposure(min=0.5, max=5.0, step=2, interval=1, brightness=0.5)

I have just used the hash to disable the unused function?

-----

If anybody has experience with the Exposure plugin, I would love to here your thoughts on use.

My aim is to reduce Exposure Similar to:
VideoPad / FX Video Effects / Exposure (setting at -0.01)

Might need another type of Exposure plugin to achieve this, any ideas?
Thanks for any input.
5. I don't use videopad, but reducing "exposure" is probably the same or very close to the "levels" filter in vdub2 or avisynth

In vdub2 , add the levels filter, hit show preview. Drag the bottom right slider which corresponds to "output black"

In avisynth you just type the commands; you can use vdub2 script editor to preview (hit f5 to refresh), or use avspmod for "live" preview with a minimalistic GUI with sliders too

If exposure -0.01 corresponds to -1% , you'd set the output black to about 252 or 253 , but adjust it to your tastes. It's not clear if that's a gamma corrected or linear scale

In avisynth it would look like
Levels(0,1,255,0,252,false)

Statistics