Expand description
Up-sampling routines
The main upsampling method is a bi-linear interpolation or a “triangle
filter “ or libjpeg turbo fancy_upsampling which is a good compromise
between speed and visual quality
§The filter
Each output pixel is made from (3*A+B)/4 where A is the original
pixel closer to the output and B is the one further.
+---+---+
| A | B |
+---+---+
+-+-+-+-+
| |P| | |
+-+-+-+-+§Horizontal Bi-linear filter
|---+-----------+---+
|   |           |   |
| A | |p1 | p2| | B |
|   |           |   |
|---+-----------+---+
For a horizontal bi-linear it’s trivial to implement,
A becomes the input closest to the output.
B varies depending on output.
- For odd positions, input is the 
nextpixel after A - For even positions, input is the 
previousvalue before A. 
We iterate in a classic 1-D sliding window with a window of 3.
For our sliding window approach, A is the 1st and B is either the 0th term or 2nd term
depending on position we are writing.(see scalar code).
For vector code see module sse for explanation.
§Vertical bi-linear.
Vertical up-sampling is a bit trickier.
+----+----+
| A1 | A2 |
+----+----+
+----+----+
| p1 | p2 |
+----+-+--+
+----+-+--+
| p3 | p4 |
+----+-+--+
+----+----+
| B1 | B2 |
+----+----+For p1
A1is given a weight of3andB1is given a weight of 1.
For p3
B1is given a weight of3andA1is given a weight of 1
§Horizontal vertical downsampling/chroma quartering.
Carry out a vertical filter in the first pass, then a horizontal filter in the second pass.
Modules§
- scalar 🔒