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. |
|
|
Thread Tools | Search this Thread | Display Modes |
21st March 2011, 22:46 | #41 | Link |
Registered User
Join Date: Feb 2004
Posts: 1,348
|
If the avisynth linear interpolators could use an infinite sinc kernel, and and the input to the interpolator is a perfectly bandlimited signal capable of being properly sampled at the destination resolution, then the support width calculations used by avisynth guarantee perfect reconstruction at the destination resolution, and any other arbitrary resolution that does not cause sub-critical sampling to occur.
In my opinion, it is overall the best compromise. Avisynth resizers certainly look much better then the abysmal interpolators used on most dvds; said dvds either being blurred to hell, with accompanying gibbs artifacts or have aliasing everywhere. |
23rd March 2011, 13:30 | #42 | Link |
Registered User
Join Date: May 2008
Posts: 40
|
I think that YV12 output is a bit broken at the moment, and there are visible artefacts, in particular they are pretty obvious near reds border.
But, well, let's make screenshots speak. ResampleHQ(1280,720,"YV12","TV.709","TV.709",false,198,22,-48,-164) http://www.cbland.net/images4/ResampleHQYV12.png around the red circle there are obvious problems with the resampler output Spline36Resize(1280,720,198,22,-48,-164) http://www.cbland.net/images4/SplineYV12.png on the other hand Spline36's output is perfect and if we convert to RGB32 ResampleHQ(1280,720,"RGB32","TV.709","TV.709",false,198,22,-48,-164) http://www.cbland.net/images4/ResampleHQRGB32.png there are no more artefacts Spline36Resize(1280,720,198,22,-48,-164).ConverttoRGB32(matrix="Rec709") http://www.cbland.net/images4/SplineRGB32.png Spline is good as well. Using different matrix/crop/dither did not change the outcome at all. |
24th March 2011, 10:22 | #45 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,352
|
Yes, I can confirm it, YV12 is totally broken. Even the next line outputs wrong results:
# converting from RGB to YV12 ResampleHQ(DSTCOLORSPACE="YV12",dither=false)
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread Last edited by Dogway; 24th March 2011 at 11:32. |
24th March 2011, 10:35 | #46 | Link | |
Registered User
Join Date: May 2008
Posts: 40
|
Sure.
http://www.cbland.net/images4/notresampled.png Quote:
Now that you can even specify the matrix used to convert from YV12 to RGB32 during playback is basically the swiss knife of avisynth ^^ |
|
25th March 2011, 01:07 | #47 | Link |
Grand Fruitioner
Join Date: Mar 2004
Location: Chicago, IL
Posts: 115
|
This is turning out to be a tricky problem to solve. It occurs whenever sub-sampled YUV is converted between gamma-compressed and linear.
You can't go directly from YUV -> linear YUV. You need to do YUV -> RGB -> linear RGB -> linear YUV. When it is sub-sampled, you run into the same problem run-of-the-mill renderers do: when converting to RGB the chroma isn't rescaled nicely, but simply point sampled. I wanted to avoid rescaling gamma-compressed chroma, but I'm not sure if that's possible now. Any clever ideas? |
25th March 2011, 02:47 | #48 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
could the gamma resize be just done on the luma only? chroma exists in chroma-land where gamma makes no sense...
or perhaps the gamma can happen on the chroma channels using a correspondingly subsampled luma channel to convert them to intermediate chroma channels. that might work.
__________________
sucking the life out of your videos since 2004 |
25th March 2011, 04:16 | #49 | Link | |
Grand Fruitioner
Join Date: Mar 2004
Location: Chicago, IL
Posts: 115
|
Quote:
I thought of sub-sampling luma too, but I haven't tried it yet. Will report back in a bit |
|
25th March 2011, 07:54 | #50 | Link |
Registered Developer
Join Date: Sep 2006
Posts: 9,140
|
Resampling luma will change the luma and chroma value of every pixel. So if you want resampling to be done with proper quality, I don't think you have any chance of avoiding doing proper chroma upsampling as a first step. Of course that means that the output of your filter should probably be either RGB or YCbCr 4:4:4 because otherwise chroma will lose quality. For chroma upsampling I'd suggest a soft filter to avoid aliasing artifacts.
|
25th March 2011, 14:25 | #51 | Link |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
If the final output is to be YV12, the chroma accuracy could potentially be improved by having a separate chroma conversion path using resampled luma. Instead of effectively doing this:
YV12->YV24->sRGB->linear RGB->resample->sRGB->YV24->YV12 which involves chroma resampling as both the first and last steps, do this: YV12->YV24->sRGB->linear RGB->resample->sRGB->luma and YV12->resample luma to chroma grid->sRGB->linear RGB->resample to destn chroma grid->sRGB->chroma Whether this would make a visible difference, I don't know. |
26th March 2011, 19:03 | #52 | Link | |
Registered User
Join Date: Nov 2004
Location: Poland
Posts: 2,843
|
Quote:
This has also chroma problems- not as visible as direct YV12, but visible enough. Andrew |
|
30th March 2011, 02:07 | #53 | Link |
Grand Fruitioner
Join Date: Mar 2004
Location: Chicago, IL
Posts: 115
|
Got caught up in Crysis 2 for most of this past week -- it's like a frakkin' Michael Bay movie in all the right ways.
I'm going full-speed on ResampleHQ now. Should have something new up in the next couple days. |
5th April 2011, 19:09 | #55 | Link |
Registered Developer
Join Date: Sep 2006
Posts: 9,140
|
Ok, here goes:
Code:
float Cubic(float distance, float param1, float param2) // return cubic weight coefficients { float P0, P1, P2, P3; float result = 0; if (distance <= 2.0f) { if (distance < 1.0f) { P0 = (+ 1.0f - 1.0f/3.0f * param1 - 0.0f * param2); P1 = 0; P2 = (- 3.0f + 2.0f * param1 + 1.0f * param2); P3 = (+ 2.0f - 3.0f/2.0f * param1 - 1.0f * param2); } else { P0 = (- 0.0f + 4.0f/3.0f * param1 + 4.0f * param2); P1 = (+ 0.0f - 2.0f * param1 - 8.0f * param2); P2 = (- 0.0f + 1.0f * param1 + 5.0f * param2); P3 = (+ 0.0f - 1.0f/6.0f * param1 - 1.0f * param2); } result = P0 + P1 * distance + P2 * distance * distance + P3 * distance * distance * distance; } return result; } float GetFilterCoeffs(float distance, RESAMPLING_FILTER filter) // return coeffecients for the specified resampling filter { float result = 0; switch (filter) { case rfCatmullRom : case rfBicubic50 : result = Cubic(distance, 0.00f, 0.50f); break; case rfBicubic60 : result = Cubic(distance, 0.00f, 0.60f); break; case rfBicubic75 : result = Cubic(distance, 0.00f, 0.75f); break; case rfSoftCubic100 : result = Cubic(distance, 1.00f, 0.00f); break; case rfSoftCubic80 : result = Cubic(distance, 0.80f, 0.20f); break; case rfSoftCubic70 : result = Cubic(distance, 0.70f, 0.30f); break; case rfSoftCubic60 : result = Cubic(distance, 0.60f, 0.40f); break; case rfSoftCubic50 : result = Cubic(distance, 0.50f, 0.50f); break; case rfMitchell : result = Cubic(distance, 1.0f/3.0f, 1.0f/3.0f); break; [...] Last edited by madshi; 5th April 2011 at 19:13. |
5th April 2011, 19:37 | #56 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Looks like that is just the same as Avisynth's BicubicResize, where param1 and param2 represent the b and c arguments.
Then, in the 'soft' settings, used with 0.5<= b <=1 and c = 1-b. Quote:
|
|
5th April 2011, 21:50 | #58 | Link | ||
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Quote:
Code:
result = P0 + distance * (P1 + distance * (P2 + distance * P3)); |
||
7th April 2011, 03:18 | #60 | Link |
Registered User
Join Date: Mar 2004
Posts: 889
|
Found an interesting diagram about cubic resizers: http://www.imagemagick.org/Usage/resize/#mitchell
|
Thread Tools | Search this Thread |
Display Modes | |
|
|