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 |
|
|
#1 | Link |
|
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
VAQ: Making Xvid's Adaptive Quantization Not Suck
I was bored, so I spent 15 minutes and wrote this patch to port x264's new VAQ to Xvid.
I haven't tested it much (only on this video), but it seems to work surprisingly well, despite MPEG-4 ASP's drastic limitations on quantizer deltas. Patch [updated with minor fixes] Xvidcore.dll [updated with latest patch] To use it with Virtualdub or any VfW interface, just overwrite the XvidCore.dll in your /Windows/System32 or similar with the one I have provided. To activate VAQ, just check off the Adaptive Quantization box; it replaces the normal luminance masking. Note that I could not get it working correctly with mencoder; for some reason libavcodec seems to have its own lumimasking library that's overriding my patch. It works with xvid_encraw and VfW though... Have fun! Last edited by Dark Shikari; 23rd February 2008 at 01:37. |
|
|
|
|
|
#4 | Link | |
|
Registered User
Join Date: Jul 2002
Posts: 587
|
Quote:
|
|
|
|
|
|
|
#7 | Link |
|
Registered User
Join Date: Feb 2007
Location: ::1
Posts: 1,236
|
Awesome!
But I SO wish you had done this before I backed up a bunch of stuff to Xvid ![]() Squid_80, please do. I will test if I get any time, which is most likely as I have this week off. Dark Shikari, can this Xvidcore be used against any version of the Xvid codec? I have a recent build of 1.2.-127. |
|
|
|
|
|
#8 | Link | |
|
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Quote:
|
|
|
|
|
|
|
#10 | Link | |
|
Registered User
Join Date: Feb 2006
Posts: 1,076
|
Quote:
I'd allmost wish you'd be bored more often. .... But on the other hand ... If you do things like these VAQ-patches for X264 & Xvid while bored ... i'd hate to think of things you could do while really interested ![]() ![]() Anyway,just a question; Could this same patch / idea be ported to Hank's HCEnc MPEG2 encoder ? I use that one quite often to make (author) DVD's. I use Hanks luminance-adative code, wich works surprisingly well. But that code works only on "darker" scenes, not on flat(ter) scenes like the VAQ does. I would be really interested in such a feature
Last edited by G_M_C; 22nd February 2008 at 09:51. |
|
|
|
|
|
|
#11 | Link | |
|
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Quote:
![]() All I need is a link to the source. Well x264's took quite a while--but once I had it working I can easily port it to any other similar encoder with very little work. |
|
|
|
|
|
|
#12 | Link |
|
HCenc author
Join Date: Nov 2003
Location: Netherlands
Posts: 570
|
I'm already working on it for some time, the general idea is about the same, variance based.
Will be in the next HCenc release. Just had a look at the implementation in Xvid, well, I'm a C n00b but when I do something like this in Fortran it will overflow on high luminance values: Code:
for (k = 0; k < 16; k++)
for (l = 0; l < 16; l++)
{
int val = ptr[k*data->current.stride[0] + l];
sum += val;
sum_of_squares += val * val;
}
/* Variance = SSD - SAD^2 / (numpixels) */
int variance = sum_of_squares - sum * sum / 256;
__________________
HCenc at: http://hank315.nl |
|
|
|
|
|
#14 | Link |
|
warpsharpened
Join Date: Feb 2007
Posts: 787
|
I think that patch isn't really proper (at least it didn't work for me).
After some slight editing of it though I managed to get it to work (with a fuzz with the last hunk, but I checked the luminance_masking.c and everything was patched correctly) Now off to test. I think the patch doesn't have that debug line Dark was talking about so I'll post a build in a bit I guess and see if that helps (it's only a debug line though so does it really matter?) Edit: Build: http://www.fileducky.com/qRILYtae/ It's built with pthreads enabled. Last edited by TheRyuu; 22nd February 2008 at 17:48. |
|
|
|
|
|
#15 | Link | |
|
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Quote:
Only my build has it.
|
|
|
|
|
|
|
#16 | Link | |
|
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Quote:
The maximum value that sum can reach is 255*256... so yes, you are right; sum*sum could overflow a signed integer. The correction would be to make sum and ssd unsigned integers. |
|
|
|
|
![]() |
| Tags |
| xvid aq, xvid vaq |
| Thread Tools | |
| Display Modes | |
|
|