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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th March 2017, 06:19   #1  |  Link
moiennepe
Registered User
 
Join Date: Mar 2016
Posts: 2
Edges affected by the background?

Hi all, there is a celluloid animation DVD mpeg2/vob source that looks like:
Y-ch:
The edge on a lighter background has Y value 120~150 (contrast 50+),
and the one on a darker BG has value 30~50 (constract 3~5).

I think this is caused by the "subpixels" (see github.com/Tetrachrome/subpixel). Those edges are actually pure black on the original CEL / printed screenshots.

I wrote some C# code to process them and here's the result:
source:
processed:


Looking for AVS equivalents (especially to grab the dark, low-constract ones), or suggestions to improve the code below.



Code:
		
   public static void litas(string ismh)
			{
				byte[] iqmat = File.ReadAllBytes(ismh);
				Array.Copy(iqmat,fariat,720*480+0xF);			
				iqmat=iqmat.Skip(0xF).ToArray();
   //iqmat, kuzn, fariat fyy byte[]
				
			for(int k=2;k<480-2;k++)
			{
				for(int i=2;i<720-2;i++)
				{
					Array.Copy(iqmat,(k-2)*720+i-2,kuzn,0,5);
					Array.Copy(iqmat,(k-1)*720+i-2,kuzn,5,5);
					Array.Copy(iqmat,(k)*720+i-2,kuzn,10,5);
					Array.Copy(iqmat,(k+1)*720+i-2,kuzn,15,5);
					Array.Copy(iqmat,(k+2)*720+i-2,kuzn,20,5);
					byte mithliq = kuzn.Max();
					//Maximum
					
					int ha3al = ((mithliq-iqmat[k*720+i])*1000);
					ha3al/=mithliq;
					//amplified
					
					if(ha3al>255)
						ha3al=255;
					//clamp	
				
					fariat[0xF+k*720+i]= (byte)(255-ha3al); //invert

				}
			}
			
				//TODO
			//========

			for(int k=2;k<480-2;k++)
			{
				for(int i=2;i<720-2;i++)
				{
					Array.Copy(fariat,0xf+(k-2)*720+i-2,kuzn,0,5);
					Array.Copy(fariat,0xf+(k-1)*720+i-2,kuzn,5,5);
					Array.Copy(fariat,0xf+(k)*720+i-2,kuzn,10,5);
					Array.Copy(fariat,0xf+(k+1)*720+i-2,kuzn,15,5);
					Array.Copy(fariat,0xf+(k+2)*720+i-2,kuzn,20,5);
					byte mithliq = kuzn.Min();
					
					if(mithliq>0x70&&iqmat[k*720+i]>0x70)  //120? 60?
							fariat[0xF+k*720+i]=0xff;
					
				}
			}
			//=======
			
			File.WriteAllBytes("haq\\"+ismh,fariat);
			
			}
moiennepe is offline   Reply With Quote
Reply

Tags
dvd, edge detection, old anime

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:16.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.