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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Today's Posts Search

Reply
 
Thread Tools Search this Thread
Old 11th April 2014, 22:42   #1  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Possible bug in the vmetric calculation code in telecide()

This possible bug is in the vmetric calculation code, in decomb524src.zip/Telecide.cpp, in Telecide::CalculateMetrics(), line 938:
Code:
			for (y = 0; y < hover2 - 4; y+=4)
			{
				/* Exclusion band. Good for ignoring subtitles. */
				if (y0 == y1 || y < y0/2 || y > y1/2)
				{
					for (x = 0; x < wover2;)
					{
						index = (y/BLKSIZE)*xblocks + x/BLKSIZE; // <--- line 938
						// Test combination with current frame.
						tmp1 = ((long)currbot0[x] + (long)currbot2[x]);
						diff = abs((((long)currtop0[x] + (long)currtop2[x] + (long)currtop4[x])) - (tmp1 >> 1) - tmp1);
						if (diff > nt)
						{
							c += diff;
It looks like it's using the same block size of 24×24 both for luma and for chroma. With a common 720×480 image, this results in 600 luma blocks and 150 chroma blocks (per chroma plane). This means that the sums calculated for all 150 chroma blocks each get added to the sums calculated for the first 150 luma blocks, leading to somewhat wrong vmetrics (higher than they should be).

I think adjusting the block size to take subsampling into account should fix this.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 11th April 2014, 23:19   #2  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,868
Patches welcome.
Guest is offline   Reply With Quote
Old 12th April 2014, 09:19   #3  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Code:
--- Telecide.cpp	2012-11-24 10:09:04.000000000 +0200
+++ Telecide.cpp	2014-04-12 11:05:51.433706672 +0300
@@ -935,7 +935,7 @@
 				{
 					for (x = 0; x < wover2;)
 					{
-						index = (y/BLKSIZE)*xblocks + x/BLKSIZE;
+						index = (y/(BLKSIZE/2))*xblocks + x/(BLKSIZE/2);
 						// Test combination with current frame.
 						tmp1 = ((long)currbot0[x] + (long)currbot2[x]);
 						diff = abs((((long)currtop0[x] + (long)currtop2[x] + (long)currtop4[x])) - (tmp1 >> 1) - tmp1);
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 12th April 2014, 15:54   #4  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,868
Thanks! I'll slipstream it into 5.2.4 as I don't really have time to make a whole formal release.
Guest is offline   Reply With Quote
Reply


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 19:11.


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