Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
![]() |
|
Thread Tools | Search this Thread | Display Modes |
![]() |
#1 | Link |
Registered User
Join Date: Jun 2022
Posts: 161
|
Levels(0,1,128,0,255) - why does it work like that with U and V?
This is the original YUV range without modification (histogram="levels"):
![]() I wanted to cut out only the left half (ranges 0-127 in each planes) and I did it like this: Code:
levels(0,1,128,0,255,coring=false) ![]() And while the luma graph is as expected, U and V have only expanded proportionally to both sides. These graphs don't represent values from 0 to 255? (like luma) When I do: Code:
levels(128,1,255,0,255,coring=false) ![]() What don't I understand? And why am I doing this -- a captured miniDV cassette has a Y range 16-255. I wanted to check if the chroma also exceeds 16-240 range. |
![]() |
![]() |
![]() |
#3 | Link | |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,614
|
iirc. Levels in Avisynth is meant or 'brightness, contrast, and gamma', so it does not change the chroma.
(different story in Vapoursynth, which is why at the beginning folks were confused that is didn't work like Avisynth unless you only process the luma or rgb.) hmm, on the wiki it states: Quote:
Last edited by Selur; 11th April 2025 at 11:37. |
|
![]() |
![]() |
![]() |
#5 | Link | |
Big Bit Savings Now !
Join Date: Feb 2007
Location: close to the wall
Posts: 1,906
|
Quote:
With DV and HDV cam chipsets Y going 16..255 is encountered often, but U,V ? Canopus ADVC-300: Analog Device's Video DAC's ADV7172, ADV7173 implemented modulation range for U,V values is 128±112
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain) "Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..." Last edited by Emulgator; 14th April 2025 at 18:23. |
|
![]() |
![]() |
![]() |
#6 | Link | |
Registered User
Join Date: Aug 2017
Location: Italy
Posts: 144
|
Quote:
AFAIK Chroma manipulations with Levels is undetermined and not suggested. Use ColorYUV to act on U and V channels.
__________________
A channel on S-VHS / VHS capture and AviSynth restoration https://www.youtube.com/channel/UCMs...h1MmNAs7I8nu4g |
|
![]() |
![]() |
![]() |
#8 | Link |
Registered User
Join Date: May 2006
Posts: 4,048
|
Avisynth's Levels() was designed to emulate VirtualDub's Levels filter working in RGB mode. The transform that calculated from the values given to Levels() is applied equally to each RGB channel. The result is that the U and V channels change along with the Y channel. It increases saturation when one increases the contrast.
If you want Y to be affected only use YLevels() which preserves color saturation better. http://avisynth.nl/index.php/Ylevels https://forum.doom9.org/showpost.php...2&postcount=41 Or use Levels() with chroma copyback from the original chroma. Edit: @rgr. The screenshot with histogram of post#2 doesn't make much sense to me. (How) did you manipulate the source? Last edited by Sharc; 12th April 2025 at 09:10. Reason: Link added |
![]() |
![]() |
![]() |
#9 | Link | ||
Registered User
Join Date: Jun 2022
Posts: 161
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#10 | Link | ||
Registered User
Join Date: Jun 2022
Posts: 161
|
Quote:
Y - from 16-255 to 0-255 (or 16-235) U,V - from 16-255 to 0-255 (or 16-235) I expected a simple "Levels (16,1,255,0,255)" to do just that. Quote:
|
||
![]() |
![]() |
![]() |
#11 | Link | |
Registered User
Join Date: Jul 2018
Posts: 569
|
Quote:
Separate planes, apply Ylevels for every plane, combine planes. |
|
![]() |
![]() |
![]() |
#12 | Link | |
Registered User
Join Date: May 2006
Posts: 4,048
|
Quote:
The standard histogram("levels") provides this information. See your very first screenshot. U and V are well within the limits (as usual). It is only Y which exceeds 235 and clips at 255. or use Code:
ColorYUV(analyze=true) Scroll down to the bottom of that page. or use to see the Y,U,V waveforms and Vectorscope: Code:
VideoScope(DrawMode="both",HistoTypeBottom="UV",HistoTypeSide="Y",FrameType="UV") Edit: And if you want to modify YUV data use Code:
ColorYUV(...........) Last edited by Sharc; 14th April 2025 at 16:39. |
|
![]() |
![]() |
![]() |
#13 | Link | |
Registered User
Join Date: Jul 2018
Posts: 1,318
|
Quote:
So Levels for YUV in good case simply do not change anything with UVs (copy). Last edited by DTL; 15th April 2025 at 05:03. |
|
![]() |
![]() |
![]() |
#15 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,135
|
"Isn't it 128/0x80?"
+1.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 14th April 2025 at 21:41. |
![]() |
![]() |
![]() |
#17 | Link |
Registered User
Join Date: Jul 2018
Posts: 1,318
|
Yes - Cb Cr are (colour difference)+128 in ITU BT.601 equations. So its zeroes are at 128 in 8 bit. I fixed that post. I typically make +-1 errors and it cause bugs in software too.
"it's definitely not 129" But 128 is also 129th code value counted as integer from 0. The digital 8bit range of 0..255 (counted/mapped as 0..255 not 1..256) is centered at 255/2=127.5 . And ITU select to round it to 128. So UVs are also +0.5 offsetted from real 255/2 mid value of 8 bit. Last edited by DTL; 15th April 2025 at 05:20. |
![]() |
![]() |
![]() |
#18 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,135
|
I was agreeing with you, and not providing an alternative answer [and I think you know that
![]() and, for 8 bit TV Y levels mid point is, (16 + 235) / 2 = 125.5 # Rounded to 126. and for 8 bit U/V, (16 + 239) / 2 = 127.5 # Rounded to 128.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
![]() |
![]() |
![]() |
#20 | Link | |
Registered User
Join Date: Jun 2022
Posts: 161
|
Quote:
|
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|