It is currently Sun Dec 17, 2017 10:10 am

All times are UTC




Post new topic Reply to topic  [ 59 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Mon May 19, 2014 9:43 pm 
Offline
Snes9x White Belt

Joined: Mon May 19, 2014 4:46 pm
Posts: 16
Hi,

just as the title says, this is Snes9x with support for the xBRZ software scaler.
xBRZ is intended as a replacement for HQx and was added as a new scaler for selection in Snes9x's display settings.

Image

For a short comparison between xBRZ and other software scalers, see here:
http://www.vogons.org/viewtopic.php?t=34125

The source is also included, so if there's interest to add xBRZ to the official Snes9x release, the code is here for study.

Binary:
http://www.file-upload.net/download-893 ... Z.zip.html

Source:
http://www.file-upload.net/download-893 ... e.zip.html

Best regards, Zenju

_________________
http://www.freefilesync.org/
http://sourceforge.net/projects/xbrz/


Top
 Profile  
Reply with quote  
PostPosted: Tue May 20, 2014 11:28 pm 
Offline
Grand Poobah
User avatar

Joined: Sat May 15, 2004 4:28 am
Posts: 629
Location: Austin, TX
Moved your topic to what I feel is a more appropriate forum for this type of thing. :)


Top
 Profile  
Reply with quote  
PostPosted: Thu May 22, 2014 4:30 pm 
Offline
Official Win32 Porter/Dev
User avatar

Joined: Thu Aug 30, 2007 10:15 pm
Posts: 594
Hi Zenju,

thank you for taking the time to add this to snes9x. However I can only include it in the official releases (if there ever is another ;)) if you allow an exception for s9x, since its license is not compatible with the GPL.

I'm not a huge fan of adding the TBB dependency, but I could add it as optional behind a define.


Top
 Profile  
Reply with quote  
PostPosted: Thu May 22, 2014 8:24 pm 
Offline
Snes9x White Belt

Joined: Mon May 19, 2014 4:46 pm
Posts: 16
Quote:
allow an exception for s9x

Sure, no problem :) Just let me know when time to implement draws near, and I'll add it to the official sources just like for HqMAME.

Code:
if there ever is another

I truly hope so... but currently I have nothing to complain about 1.53 so far, and it supports all the features that I need. Actually I came from Zsnes and finally switched to Snes9x because I couldn't get Zsnes to compile due to it's assembly heritage. Snes9x OTOH was a breeze to get to compile. Of all the xBRZ implementations in various emulators that I've done, Snes9x was by far the easiest one. That was very nice.

Code:
not a huge fan of adding the TBB dependency

On equal grounds, 4xBRZ and HQ4x show pretty much the same performance numbers. Howver xBRZ as it is right now only supports ARGB input and output. So for Snes9x I had to add two additional conversion steps from and to RGB565. Running all these things multithreaded is a huge perf improvement on my quad-core system. Single-threaded Snes9x has one core busy at about 80% - and emulation seems a little bit choppy sometimes. With TBB I have 4 cores running at only 24% each - emulation with xBRZ is smooth as butter. Since xBRZ is particularily designed to take full advantage of modern CPUs it would be a waste not to use multithreading for the scaling. Whether TBB as a dependency should be added to Snes9x is a different question however. For HqMame I provided xBRZ via a dll which internally uses TBB so that the core MAME source can be oblivious of this implementation detail.

_________________
http://www.freefilesync.org/
http://sourceforge.net/projects/xbrz/


Top
 Profile  
Reply with quote  
PostPosted: Thu May 29, 2014 8:28 pm 
Offline
Snes9x White Belt

Joined: Thu May 29, 2014 8:21 pm
Posts: 3
Hi,

Thank you for adding 4xbrz, best filter available in snes9x at the moment! Do you plan to add 2xbr (my favorite) and 3xbrz too?

Thanks again,

Psychic5


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 04, 2014 1:49 pm 
Offline
Snes9x White Belt

Joined: Thu May 02, 2013 2:33 pm
Posts: 32
I am a tad late to the party...but I have been extensively testing the XBRZ filter...So far...I have not detected any grey lines other filters have made with DKC2 and the lines that even XBR leaves behind are gone....While this filter might not make it into the next version...I'd love to start experimenting on mixing XBRZ with different shaders via .cgp files.....So that being said...do you think you could possibly turn the filter into a .cg shader file as a shader and share the code on this thread?


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 04, 2014 3:44 pm 
Offline
Snes9x White Belt

Joined: Mon May 19, 2014 4:46 pm
Posts: 16
WalMartCartPusher wrote:
do you think you could possibly turn the filter into a .cg shader file as a shader and share the code on this thread?

I don't have experience programming cg shaders, but I guess it would be quite a challenge. xBRZ has been written from scratch in C++ and takes advantage of a lot of C++ features which don't have a direct representation in the shader language. That's unlike xBR which AFAIK was written in shader language first and then ported to C.

_________________
http://www.freefilesync.org/
http://sourceforge.net/projects/xbrz/


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 05, 2014 10:18 am 
Offline
Snes9x White Belt

Joined: Thu Jun 05, 2014 9:58 am
Posts: 3
I just created an account to say... Thank you so much for this! :D I've been waiting for months for someone to add xBRZ to ANY snes emulator. If I knew how to code I would have added it myself when I discovered xBRZ months ago.

I do have a problem though. I can't use it! :( I have a 2.5ghz dual core processor that's not quite fast enough to run 4xBRZ. I don't know how difficult it would be to add 2xBRZ and 3xBRZ, but I;m sure a lot of others, including myself, would greatly appreciate it. I think I might be able to use 3xBRZ smoothly, but not sure.

If you could do this for the emulator community. It would be greatly appreciated.

If I wasn't dirt poor. I'd even pay you some money to do it.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 05, 2014 11:18 am 
Offline
Snes9x White Belt

Joined: Mon May 19, 2014 4:46 pm
Posts: 16
Aaron6537 wrote:
how difficult it would be to add 2xBRZ and 3xBRZ


Actually, easy :) I've added 2xBRZ and 3xBRZ:

Snes9x-1.53-xBRZ-2014-06-05.zip
Snes9x-1.53-xBRZ-2014-06-05-source.zip

_________________
http://www.freefilesync.org/
http://sourceforge.net/projects/xbrz/


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 05, 2014 1:20 pm 
Offline
Snes9x White Belt

Joined: Thu May 29, 2014 8:21 pm
Posts: 3
Thank you!

I really appreciate!


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 05, 2014 2:45 pm 
Offline
Snes9x White Belt

Joined: Thu Jun 05, 2014 9:58 am
Posts: 3
Oh my god! Thank you! Thank you! Thank you so much! Your awesome. I'm testing it right now. Not having very good results unfortunately. :(

Not sure what to do. Except for frame skipping. Automatic skipping one frame jumps the FPS from 42 up to 60.
It works perfectly for me with Kega Fusion 3.63 and xBRZ plugins made by milo1012. Maybe Snes9x uses more CPU than Kega Fusion.

Here's his plugins and source if your interested in checking it out. Look at the comments for his xBRZ url.
http://www.emucr.com/2013/04/kega-fusion-plugins-20130427.html
Latest xBRZ plugins and source from his comment.
http://en.file-upload.net/download-8825725/_xBRZ_Kega_Fusion_Plugin_RPI_1.1.zip.html

Not sure how you do it but maybe milo1012's version is much faster than the version you added. Maybe you can use his source to create faster and multithreaded versions.
Just trying to help you improve it to run on older computers. Thanks for letting me see what DKC and Mario looked like.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 05, 2014 4:12 pm 
Offline
Snes9x White Belt

Joined: Mon May 19, 2014 4:46 pm
Posts: 16
The kega version of xBRZ claims to be 2-8 % faster than the original code, so it's probably the differences between kega and snes9x that explain perf. Technically the kega xBRZ code does pretty much the same thing, except for needlessly giving up on encapsulation by undoing function calls that the compiler inlines easily, littering the code with magic numbers and removing some dead code that was never used anyway. Reading a book on modern C++ programming principles would not have hurt here [/end of rant] ;)

_________________
http://www.freefilesync.org/
http://sourceforge.net/projects/xbrz/


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 05, 2014 4:55 pm 
Offline
Snes9x White Belt

Joined: Thu Jun 05, 2014 9:58 am
Posts: 3
Ummm..... Lol. I only have a vague idea of what your talking about there but what I can say is I just updated my Kega xBRZ plugin and can now use the 3xBRZ multithreaded version instead of the 2xBRZ multithreaded version. The Snes9x xBRZ I can't even use 2xBRZ without adding 1 frame skip to it.

Maybe there is something to this Kega xBRZ plugin or do you reallly think Kega and Snes9x itself is what makes the speed difference?

By the way, I think my brain draws the line when it comes to coding. It's never gonna happen. Tried C# video tutorials once. Watched about 10 training videos. My brain stopped right after learning a little bit about operations, iterations, expressions, arrays, and statements. :oops:


Top
 Profile  
Reply with quote  
PostPosted: Mon Jun 23, 2014 12:47 pm 
Offline
Snes9x White Belt

Joined: Mon Jun 23, 2014 12:12 pm
Posts: 2
Greetings,

Zenju, I registered just to thank you for this amazing release. After extensive testing I decided to replace my old hodgepodge of output processing options and shaders with your xbrz implementation. Now the graphics look much cleaner, without the unappealing features of the hqx.

It's all subjective, of course, but when it comes to graphics, subjectivity is the name of the game. Uncomputable qualia*, here we go ;)

Now I'm just hopping this marvelous scaler will be incorporated in the latest test build, so I can experiment with cg shaders (on this version I always get the CG runtime unavailable messsage).

Anyway, thanks a lot for your hard work. It does not go unnoticed or unnapreciated!

* j/k - I'd never claim that qualia are uncomputable, even if I don't subscribe to ITT


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 24, 2014 8:14 pm 
Offline
Official Win32 Porter/Dev
User avatar

Joined: Thu Aug 30, 2007 10:15 pm
Posts: 594
I've finally had time last weekend and added xbrz: snes9x_testbuild_24062014.zip

I rolled my on threaded implementation to remove the TBB dependency and also had to make some small modifications to the xbrz code to keep VS2008 compatibility. Hope that's ok (commit).


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 25, 2014 3:40 am 
Offline
Snes9x White Belt

Joined: Mon Jun 23, 2014 12:12 pm
Posts: 2
Thanks a lot for your work OV2. I've tested your release, and it works just as expected. After playing around with a few shaders, I found my [local] maxima: 4XBRZ + CRT-Caligari's shader. Here are some comparison screenshots, if anyone is interested:

1. No Filter, No Shader, No Bilinear Filtering

2. No Filter, No Shader, BF

3. 4XBRZ Filter, No Shader, No BF

4. 4XBRZ Filter, CRT-Caligari Shader, No BF

Zenju, thanks again for implementing this! You should do it for ScummVM as well :mrgreen:


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 25, 2014 10:37 am 
Offline
Snes9x White Belt

Joined: Mon May 19, 2014 4:46 pm
Posts: 16
OV2 wrote:
I've finally had time last weekend and added xBRZ.

It's looking good! I've done a very quick review of the code and have two remarks:

Code:
num_xbrz_threads = sysinfo.dwNumberOfProcessors * 2;

I think the "*2" should be removed. On my machine this creates 8 threads, but I only have 4 CPU cores with no hyperthreading capability. But even with hyperthreading this seems like oversubscription.

Code:
stretchImage32To16

Ideally this scaling should be executed as a bilinear filter on the graphics card. This would get rid of additional artifacts that are introduced by the simple nearest neighbor stretching algorithm. But I don't know if this is already possible in Snes9x.

_________________
http://www.freefilesync.org/
http://sourceforge.net/projects/xbrz/


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 25, 2014 11:50 am 
Offline
Snes9x White Belt

Joined: Thu May 29, 2014 8:21 pm
Posts: 3
OV2 wrote:
I've finally had time last weekend and added xbrz: snes9x_testbuild_24062014.zip

I rolled my on threaded implementation to remove the TBB dependency and also had to make some small modifications to the xbrz code to keep VS2008 compatibility. Hope that's ok (commit).


Can you add 2xbrz and 3xbrz too, as they are missing in your compile?
You can find Zenju's source with 2xbrz and 3xbrz above.

Thanks!


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 26, 2014 10:13 am 
Offline
Official Win32 Porter/Dev
User avatar

Joined: Thu Aug 30, 2007 10:15 pm
Posts: 594
Here is a version with 2x/3x: snes9x_testbuild_25062014.zip

Zenju wrote:
I think the "*2" should be removed. On my machine this creates 8 threads, but I only have 4 CPU cores with no hyperthreading capability. But even with hyperthreading this seems like oversubscription.
I think I did that to get closer to your task granularity, but I guess you're right since this is CPU-bound.

Zenju wrote:
Code:
stretchImage32To16

Ideally this scaling should be executed as a bilinear filter on the graphics card. This would get rid of additional artifacts that are introduced by the simple nearest neighbor stretching algorithm. But I don't know if this is already possible in Snes9x.
Usually there should be no streching, only the 32to16 conversion, unless it's a high res game. It would be nice to simply switch to 32bit textures for xbrz, but the current design doesn't support that.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 26, 2014 2:01 pm 
Offline
Snes9x White Belt

Joined: Mon May 19, 2014 4:46 pm
Posts: 16
Quote:
I think I did that to get closer to your task granularity, but I guess you're right since this is CPU-bound.

The best multithreaded solution would be of course to have a task scheduler (like Intel TBB - hopefully this will be a standard C++ library maybe with C++17) and chop everything into tiny little pieces. In the absence of that using twice the number of threads than cores could be seen as a compromise. Anyway, I did a quick performance comparison between 4 and 8 threads on my 4 core machine and couldn't find any noticible perf difference.

Quote:
Usually there should be no streching, only the 32to16 conversion

Okay, it seems there is a second nearest neighbor stretching happening when "Display Settings -> General ->Stretch Image" is checked. It would be great if this step could be done as biliinear filter: at least for xBRZ this introduces quite a number of artifacts. Compare stretched vs unstretched 4xBRZ:
Image

_________________
http://www.freefilesync.org/
http://sourceforge.net/projects/xbrz/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 59 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group