Giter VIP home page Giter VIP logo

filters_mister's Introduction

First Release: If you have any previous Filters made by ghogan42/soltan_g42 then you should clear out your Filters folder before using these releases. Otherwise you will have many duplicate filters. The renaming was necessary for accuracy and consistency in the naming scheme.

For clean sharp output -- Use Gaussian_Sharp_04 or Gaussian_Sharp_05 (formally poorly named as sharp_bilinear and even_sharper_bilinear)

Introduction

In November 2018, a feature was added to MiSTer to allow the the video scaler to load filter coefficients for arbitrary interpolation filters. This allows MiSTer to scale it's output over HDMI with common image scaling algorithms such as Bicubic as well as other scaling algorithms better suited for enlarging pixel graphics. Additionally, some special effects such as scanlines and lcd effects can implemented through filter coeffcients.

How to use filter coeffcients

To use any of the pre-made filter coefficients (or your own) you need

  • An updated version of MiSTer (Main_MiSTer). The first release with support was MiSTer_20181116.
  • A supported core. Most cores released after November 16, 2018 have support for filter coefficients. This includes SNES, NES, Genesis, Sega Master System/Game Gear, PC Engine/Turbo Grafx 16, and Coleco. More cores with support will be available in the future.
  • At least one set of coefficients in a text file. Each set of filter coefficients goes in a file with a ".txt" extension. All of your filters need to be in a /Filters subdirectory of your MiSTer sd card root. Currently the best place to get a pack of working filters is to download the filter pack here: Filters_20181203.zip

Once you have updated MiSTer and Cores and your filter coefficients in the right place you simply

  • Start a supported core
  • Go to page 2 of the core's OSD menu and under HDMI Scaler: change the option from "Filter - Internal" to "Filter - Custom"
  • The option below "Filter - Custom" should now be enabled and will allow you to choose your filter from the files in your /Filters folder.

Frequently Asked Questions

Q: Why would I want to use custom filter coefficients?

A: There are many reasons. To get better/different quality than the internal scaler is the main reason. To use scanline or lcd effects is another.

Q: Doesn't MiSTer already have scanlines through the "Scandoubler FX" option in the OSD?

A: Yes, but the scanlines available with "Scandoubler FX" are aligned to the scandoubled image and the scanlines through the filter coefficients are aligned to the original pixels in the scanline. So you achieve better scanlines with filter coefficients in most cases.

Q: How does this relate to the earlier "coeff.txt" support available in some cores or the "NN" builds that support nearest neighbor scaling?

A: The "NN" builds were hardcoded to perform Nearest Neighbor upscaling only. Nearest Neighbor scaling is available as a set of filter coefficients. The "coeff.txt" builds were the frst attempts by Sorgelig to implemment support for custom filter coefficients in MiSTer. There was no support in the OSD for choosing the filter in these older builds. These newer builds replace those older builds.

Q: Where do I get sets of Filter Coefficients?

A: This is the official place to get these filters as of Dec 03, 2018

What do some filters look like?

Many filters exist already. Here are samples of just a few:

Gaussian_Sharp_05:

Gaussian_Sharp_05

Normal 30% Scanlines:

Normal 30% Scanlines

LCD Effect (No Blur):

LCD Effect (No Blur)

Technial Information

The VIP scaler implements a generic 4 tap, 16 phase polyphase filter. Details are on page 189 of the VIP scaler docs here: Intel VIP Scaler Doc

The Zipcores Application Notes pdf explains the workings of the filter much better than the ALtera/Intel docs: Zipcores Application Notes

Most of the currently available filter coefficients were generated with the Matlab code here: https://github.com/ghogan42/Filter-Coefficients-For-MiSTer

Tips for understanding the MiSTer filter coefficient text files:

  • There are separate coefficients for horizontal and vertical scaling.
  • Each row of the Filter Text File list the coefficients for taps T0, T1, T2, T3 for a paricular phase.
  • The first row is phase 0 and corresponds to the center of tap T1.
  • The ninth row is phase 8 and corresponds to the halfway point between T1 and T1 (so it's the pixel edge between T1 and T2).
  • Then last row is phase 15 and corresponds to 15/16th of the way from T1 to T2 (so one phase before the center T2).

Sample Coefficient Set. Note the following:

  • This is a 2 tap filter because we only have non-zero coefficients for taps T1 and T2
  • The vertical coefficients don't sum to 128 for the middle phases. Since they sum to less than 128, the output will be darker. That's how scanlines are implemented.
# range -128..128
# sum of line must not exceed the range!

# Sharp Bilinear on x-axis and y-axis
# 40% Scanlines on y-axis

# horizontal coefficients
   0, 128,   0,   0
   0, 128,   0,   0
   0, 127,   1,   0
   0, 125,   3,   0
   0, 120,   8,   0
   0, 112,  16,   0
   0, 101,  27,   0
   0,  85,  43,   0
   0,  64,  64,   0
   0,  43,  85,   0
   0,  27, 101,   0
   0,  16, 112,   0
   0,   8, 120,   0
   0,   3, 125,   0
   0,   1, 127,   0
   0,   0, 128,   0

# vertical coefficients
   0, 128,   0,   0
   0, 126,   1,   0
   0, 116,   5,   0
   0, 102,  10,   0
   0,  86,  16,   0
   0,  71,  21,   0
   0,  57,  26,   0
   0,  46,  31,   0
   0,  38,  38,   0
   0,  31,  46,   0
   0,  26,  57,   0
   0,  21,  71,   0
   0,  16,  86,   0
   0,  10, 102,   0
   0,   5, 116,   0
   0,   1, 126,   0

filters_mister's People

Contributors

ghogan42 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.