View Full Version : Port request: HQ2X magnification filter
Chainmax
3rd May 2006, 17:41
HQ2X (http://www.hiend3d.com/hq2x.html) is a filter commonly used in emulation to blow up an image to a multiple of its size. Its effect is somewhat similar to that of EEDI2 but apparently works best on low resolution pictures with large areas of solid color. I was wondering if someone could port HQ2X and try to make it into a general purpose resizer, or at least implement more magnitude modes (i.é: HQnX where n would be 1.0 +/- 0.1*k).
hanfrunz
3rd May 2006, 21:19
wow the sourcecode is very-weird. A lot of "case"-statements :) I may need some time, but i could do it. But, if there is someone who has more time and is willing to do it, please do.
hanfrunz
EDIT1: mmmhhh the example code works only with 16bit/pixel pictures. So i think we should consider a complete rewrite of the algo.
Chainmax
3rd May 2006, 23:53
Don't sweat it, a straight port of hq2x itself will suffice :). The image's color depth can easily be changed in Avisynth.
foxyshadis
4th May 2006, 01:02
I just noticed ffdshow has it as a resize filter, along with 2xsai and variants. So you could make an ffdshow profile that just doubles the size via hq2x, otherwise does no processing, and call it in avs with ffdshow("hq2x") or whatever you name the preset. You incur a bit of the wrath of ffdshow overhead, but at least it's already optimized and working.
Chainmax
4th May 2006, 01:22
It does? Great! :) I then ask if someone could try to make it into a general purpose resizer, or at least implement more magnitude modes (i.é: HQnX where n would be 1.0 +/- 0.1*k).
hanfrunz
4th May 2006, 18:01
ffdshow has it? cool, then we can maybe use that code for an avisynth-filter.
Revgen
5th May 2006, 19:53
ffdshow can be used as an avisynth filter via ffavisynth. But a standalone HQ2x filter may be faster.
CeeJay.dk
9th May 2006, 01:50
You could also implement HQ2x in D3D or OpenGL shaders.
http://www.si-gamer.net/gulikoza/dosbox.html have some D3D resizing shaders
Also see http://www.shadertech.com/contest/ and look for
Jaewon Jung's Smart Texture Filtering OpenGL shader
Pete Bernert makes the popular Pete's OpenGL2 PSX GPU for PSX emulators and it features the ability to use OpenGL shaders
It comes with shaders of its own :
http://www.pbernert.com/html/gpu.htm
And there are many more on the forums .. many of them are advanced resizers :
http://www.razyboard.com/system/index.php?id=pete_bernert&forumid=266904
Also check out avishader.dll - A avisynth plugin that allows the use of D3D .fx shaders - made by Antitorgo. http://forum.doom9.org/showthread.php?t=86793
His page is here .. it hosts the lastest version :
http://www.blosser.org/d9/
bill_baroud
9th May 2006, 22:28
i did it some time ago, but it was really quick'n'dirty....
http://forum.doom9.org/showthread.php?t=70740&highlight=HQ2x
(use the search button luke ;))
Chainmax
10th May 2006, 00:24
That sounds like another good base for this.
morsa
13th May 2006, 01:44
I did it (or at least quite simillar) like 2 years ago.
Look for Scale2X here at this forum.
Here it is:
http://forum.doom9.org/showthread.php?t=71360&highlight=scale2x
Chainmax
13th May 2006, 02:05
I've known about your port since you released it here, but look at the page I linked to in the OP and you'll see that HQ2X is a lot better than Scale2X.
morsa
13th May 2006, 02:51
In fact the comparison among Scale2X, 2xSaI and HQ2X shows that Scale2X preserves texture much better than the other two.
Anyway I guess it just depends on what kind of source you have, right?
Anyway I wasn't saying anything in favour of my crappy stuff.I just pointed to it in case its source could help.
thoralf
13th May 2006, 17:18
ffdshow can be used as an avisynth filter via ffavisynth.
how exactly do i get this to work?
my avs doesn't know neither ffavisynth() nor ffdshow("preset"), i'm running 2.57.
would be great if someone could fill me in here ...
thank you,
thoralf.
foxyshadis
13th May 2006, 19:25
When you install ffdshow, make sure that you choose avisynth under application plugins. It'll ask you for the avisynth plugin folder, but should detect the autoload folder anyway. That'll install ffavisynth.dll in there. Then you should be able to use ffdshow("preset").
thoralf
13th May 2006, 20:47
thanks.
I tried with the latest build from x264.nl (04-20), which seems to be broken in this regard: aviynth states that
Plugin [path]ffaviynth.dll is not an avisynth 2.5 plugin.
whose builds are you using? i don't feel like trying all of them ...
thank you,
thoralf.
Revgen
13th May 2006, 21:58
You need to use LoadCPlugin in order to load newer avisynth versions.
Just type:
LoadCPlugin("yourdrive:\yourfolder\ffavisynth.dll")
foxyshadis
13th May 2006, 22:20
Oh yeah, forgot that, sorry. Oh, and one other thing I forgot, in case you're on topic - apparently you can't resize through ffavisynth. At least, it wouldn't for me. Bah.
thoralf
14th May 2006, 11:16
thank you, working fine now. resizing is imho better done in avs anyway ...
with kind regards,
thoralf.
danpos
15th May 2006, 04:19
You need to use LoadCPlugin in order to load newer avisynth versions.
Just type:
LoadCPlugin("yourdrive:\yourfolder\ffavisynth.dll")
You're (almost) absolutely right: we've to call ffavisynth.dll with LoadCPlugin call but not loading avisynth_c.dll prior for do it. Please don't get me wrong but this isn't clear in your post (and me as just as a dumb was trying loading avisynth_c.dll and after that calling ffavisynth.dll with LoadCPlugin). I did a ffavisynth.avsi where I wrote
LoadCPlugin("C:\Arquivos de programas\AviSynth 2.5\plugins\ffavisynth.dll")
into it and put it at avisynth's plugin folder for autoloading ... (yep, it's dumb but it works a treat ;) ).
Oh yeah, forgot that, sorry. Oh, and one other thing I forgot, in case you're on topic - apparently you can't resize through ffavisynth. At least, it wouldn't for me. Bah.
I guess that (maybe) be the ffdshow build that you own. Doing a search I found a ... post of your here (http://forum.doom9.org/showthread.php?p=786130#post786130) where you provided a link to download a build of ffdshow (sse machine). I did the download, installed the ffdshow, built a profile with resize (h2qx chosen) and voilą!! It worked like a charm although the source that I've tested out be a very crappy one.
JFYI friends. :)
Cheers,
Dogway
23rd May 2010, 05:37
I had this thread on favourites, so to finish and answer it `Orum made a great port for avisynth here (http://forum.doom9.org/showthread.php?t=154674).
Someone wondering why do I revive an old thread, well, to make them autoconclusive, that is this thread is well refered and the simple option of not closing threads after a no-post span time allows it.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.