Log in

View Full Version : Seikon no Qwaser BDMV


Pages : 1 [2]

Daemon404
13th December 2010, 22:55
@Daemon404
Thanks for the ccc filter, i've take a look at the code, strange behavior to work only on Y...
Nevertheless, code is very simple, and i'll look later to create a VDub filter and add it to my filters.
Maybe some SSE optimisation can be made, but i'll see this later.

What's the point of making it a vdub filter? There is literally no reason to do this. (Tip: VDub can use AviSynth.)

romeyo007
13th December 2010, 23:08
i payed for the DVIndexNV now waiting for them to send me the licence to try the filters

jpsdr
13th December 2010, 23:35
@Daemon404
Because :
- I prefer and want to have it in my VDub filters.
- I want a 64bit version.
- It can be realy be SSE optimised.

Fadeout
14th December 2010, 04:37
If you accept to loose a bit of sharpness you can think of keep it at 1080p (the source is anyway an upscale too):
http://img709.imageshack.us/img709/4758/1301j.png
Not the best result but at least it's more "watchable".


Imho this looks "ok". I haven't seen anyone achieving better.

So mp3dom says how it was made you're set (if it doesn't require to customize every encoding and every segment accurately).

romeyo007
14th December 2010, 05:09
cool I which if he can help me

jpsdr
14th December 2010, 10:38
I'm wondering : If original is 720i, and 1080i has been made by using interlaced interpolation, isn't the best option to trying to go back to original 720i, and after doing IVTC and stay in 720p afterward ? Is there reelay a point to upscaling to 1080p ? From my point of view, you'll simply waste encoding bandwith.
You just have to find a pluggin wich will do 1080i -> 720i, but work in interlaced mode.

Maybe simply an AssumeFieldBased followed by one of the resize function will work.

jpsdr
14th December 2010, 20:28
Here how to resize interlaced to 720.

Global NewHeight=720
Global NewWidth=1280

DirectShowSource("00002.m2ts",fps=29.97)

AssumeTFF()
SeparateFields()

Shift=(Height()/Float(NewHeight/2)-1.0)*0.25 # Field shift correction

Tf=SelectEven().LanczosResize(NewWidth, NewHeight/2, 0, -Shift, Width(), Height())
Bf=SelectOdd().LanczosResize(NewWidth, NewHeight/2, 0, Shift, Width(), Height())
Interleave(Tf, Bf)
Weave()


Replace DirectShowSource line with DGAVC or DGSource.
You can also try different resize methods than Lanczos, to find wich one you prefer.

romeyo007
14th December 2010, 20:39
thank you man i will try that

VFR maniac
14th December 2010, 21:01
Here how to resize interlaced to 720.

Global NewHeight=720
Global NewWidth=1280

DirectShowSource("00002.m2ts",fps=29.97)

AssumeTFF()
SeparateFields()

Shift=(Height()/Float(NewHeight/2)-1.0)*0.25 # Field shift correction

Tf=SelectEven().LanczosResize(NewWidth, NewHeight/2, 0, -Shift, Width(), Height())
Bf=SelectOdd().LanczosResize(NewWidth, NewHeight/2, 0, Shift, Width(), Height())
Interleave(Tf, Bf)
Weave()


Replace DirectShowSource line with DGAVC or DGSource.
You can also try different resize methods than Lanczos, to find wich one you prefer.

No one resize filter defeat Cross-Conversion Correction. (I had tried many resize filters AFAIK.)
That method cannot restore original resolution and are still too bad since interpolation does the extra things.

romeyo007
14th December 2010, 21:09
Oh...!

Blue_MiSfit
15th December 2010, 02:10
jpsdr:
Please stop telling people to use DGAVCDec. This software is deprecated, and was withdrawn by its author (neuron2) for good reason.

Derek

romeyo007
15th December 2010, 02:21
I start using DGIndexeNV

jpsdr
15th December 2010, 11:58
No one resize filter defeat Cross-Conversion Correction. (I had tried many resize filters AFAIK.)
That method cannot restore original resolution and are still too bad since interpolation does the extra things.

I've begun to work to add CCC in my Vdub filters.
Simple implement is made.
ASM SSE optimisation will be a little later.

jpsdr
15th December 2010, 17:01
I've put together a clean room AviSynth port here:
http://japland.org/ccc/ccc_v0.4_avs.zip
Enjoy!


/*
Copyright (c) 2010 daemon404(not at)gmail.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Thanks to the original AviUtl plugin author: http://www.geocities.jp/flash3kyuu/
And to: JEEB and thedot from #darkhold@Rizon
*/

#include "avisynth.h"

/* Macros to make sure luma fits into 0-255 range */
#define CLP(x) ((x > 255) ? 255 : x)
#define ZRC(x) ((x < 0) ? 0 : x)

class CCC : public GenericVideoFilter {
int trackbar;
public:
CCC(PClip _child, int phase) : GenericVideoFilter(_child), trackbar(phase) {};
PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env);
};

PVideoFrame __stdcall CCC::GetFrame(int n, IScriptEnvironment* env) {

/* Copypasta'd from example plugin. */
PVideoFrame src = child->GetFrame(n, env);
PVideoFrame dst = env->NewVideoFrame(vi);

const unsigned char* srcpY = src->GetReadPtr(PLANAR_Y);
const unsigned char* srcpY_orig = srcpY;
const unsigned char* srcpV = src->GetReadPtr(PLANAR_V);
const unsigned char* srcpU = src->GetReadPtr(PLANAR_U);

unsigned char* dstpY = dst->GetWritePtr(PLANAR_Y);
unsigned char* dstpY_orig = dstpY;
unsigned char* dstpV = dst->GetWritePtr(PLANAR_V);
unsigned char* dstpU = dst->GetWritePtr(PLANAR_U);

const int src_pitchUV = src->GetPitch(PLANAR_V);
const int dst_pitchUV = dst->GetPitch(PLANAR_U);

const int row_sizeUV = dst->GetRowSize(PLANAR_U);
const int heightUV = dst->GetHeight(PLANAR_U);


int i, j;
/* These vars hold the offsets to the next 7 lines in bytes.
Stupid way of doing it but whatever. */
int line = dst->GetPitch(PLANAR_Y);
int line2 = 2 * line;
int line3 = 3 * line;
int line4 = 4 * line;
int line5 = 5 * line;
int line6 = 6 * line;
int line7 = 7 * line;
int height = dst->GetHeight(PLANAR_Y);
int width = dst->GetRowSize(PLANAR_Y);

/* Work on 6 luma lines at once, and traverse them horizontally/ */

/* Make sure we don't try and grab lines that don't exist */
for (i=0; i<(6-trackbar); i++)
{
memcpy(dstpY,srcpY,width);
srcpY+=line;
dstpY+=line;
}

for(i = 6; i < (height-7+trackbar); i += 6)
{
/* Apply the phase */
srcpY = &srcpY_orig[line * (i - trackbar)];
dstpY = &dstpY_orig[line * (i - trackbar)];

memcpy(dstpY,srcpY,width);
for(j = 0; j < width; j++)
{
int calc1 = 5 * srcpY[line] - srcpY[-line];
int calc2 = 5 * srcpY[line5] - srcpY[line7];
int calc3 = srcpY[0];
int calc4 = srcpY[line6];
int calc5 = (3 * (srcpY[line4] + srcpY[line2]) - calc3 - calc4) >> 2;
dstpY[line] = ZRC(CLP((calc1 + 2 * calc3) / 6));
dstpY[line2] = ZRC(CLP((calc1 + 2 * calc5) / 6));
dstpY[line3] = ZRC(CLP(calc5));
dstpY[line4] = ZRC(CLP((calc2 + 2 * calc5) / 6));
dstpY[line5] = ZRC(CLP((calc2 + 2 * calc4) / 6));
++srcpY;
++dstpY;
}
}

/* Make sure we don't try and grab lines that don't exist */
srcpY = &srcpY_orig[line*(i-trackbar)];
dstpY = &dstpY_orig[line*(i-trackbar)];
for (j=(i-trackbar); j<height; j++)
{
memcpy(dstpY,srcpY,width);
srcpY+=line;
dstpY+=line;
}


/* Copy over chroma, since it isn't touched. */
for (int y = 0; y < heightUV; y++) {
for (int x = 0; x < row_sizeUV; x++) {
dstpU[x] = srcpU[x];
dstpV[x] = srcpV[x];
}
srcpU += src_pitchUV;
dstpU += dst_pitchUV;
srcpV += src_pitchUV;
dstpV += dst_pitchUV;
}

return dst;
}

AVSValue __cdecl Create_CCC(AVSValue args, void* user_data, IScriptEnvironment* env) {

/* Make sure the phase range is valid. */
if( args[1].AsInt(1) < 0 || args[1].AsInt(1) > 5 )
env->ThrowError("ccc: phase must be in the range 0-5.");

return new CCC(args[0].AsClip(), args[1].AsInt(1));
}

extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env) {
env->AddFunction("ccc", "c[phase]i", Create_CCC, 0);
return "CCC: Cross-Conversion Correction";
}


This should be a little faster, and sure of not goinf out of frame end of frame.
In the original code, height - 7 <= i cannot assure the fact that dstpY[line5] would still be in the picture.
If i=h-1 and trackab=0, you have troubles i think.

jpsdr
15th December 2010, 19:26
I've made some test on Seikon with CCC, phase value wich give best result is 0.

romeyo007
15th December 2010, 19:42
I'm done from exams so I'm ready to work on the encoding anyone like to instruct me to get the best result talk to me on kira-fansub@live.com
thanks

Daemon404
15th December 2010, 23:03
This should be a little faster, and sure of not goinf out of frame end of frame.
In the original code, height - 7 <= i cannot assure the fact that dstpY[line5] would still be in the picture.
If i=h-1 and trackab=0, you have troubles i think.

I already switched over to memcpy() for that stuff as well as fixed a bug where the bottom 'trackbar' lines would not be displayed. I just haven't released it yet. I've also ported the 720 output mode.

The but you mention about i=h-1 is irrelevant, since my plugin is NOT SUPPOSED TO BE RUN ON ANYTHING BUT THINGS WITH EXACTLY 1080 HEIGHT, and thus i can never equal h-1 (actually it can never h-1 ever, because i is always even, and h-1 is always odd (since yv12 must be mod2)). The original AviUtl plugin is designed the same way. Read the original readme. It is specifically designed to only be run on things with a height of 1080 pixels. The equations are hardcoded to ONLY work on that. There is no reason to run it on anything else.

(and FYI, I did compensate for the trackbar in my local version (part of the bug fix for it not processing the whole thing). Just hasn't been released yet.)

Basically: your point is moot.

P.S. You neglected to use memcpy to copy over the chroma, which could benefit a lot from it. (you also made the code ugly)

P.S.S You forgot to include the header that actually has memcpy in it. Nice Job!

I'm going to release updated dll and code, as well as 720 output version later today.

jpsdr
15th December 2010, 23:21
The but you mention about i=h-1 is irrelevant, since my plugin is NOT SUPPOSED TO BE RUN ON ANYTHING BUT THINGS WITH EXACTLY 1080 HEIGHT

In that case, shouldn't you throw an error if height is different from 1080, the same you do if phase is out of [0,5] ?


I'm going to release updated dll and code, as well as 720 output version later today.

Wonderfull, thanks for your work.

Daemon404
15th December 2010, 23:34
In that case, shouldn't you throw an error if height is different from 1080, the same you do if phase is out of [0,5] ?

Actually, you are correct. I'm going to add this in.

jpsdr
17th December 2010, 18:25
I've updated my VDub filters with CCC.
x64 version is SSE optimized.
You can get them here (http://rapidshare.com/files/437857369/Filtres_JPSDR.rar).

jpsdr
19th December 2010, 10:15
mp3dom and VRF Maniac said that even recent anime are not always at 1080(i or p).
My question : I've bought the japanese Blu-Ray of Kiddy Grade and Full Metal Panic.
Is the probability high that they are upscaled to 1080, and, in that case, if i'm doing my own work, a 720p video will finaly be enough ?

Of course, on older anime on film, question is not to ask, because... it was a film...

JEEB
19th December 2010, 10:59
mp3dom and VRF Maniac said that even recent anime are not always at 1080(i or p).
99.9% of aired anime isn't really 1080i/1080p, and just upscaled to the given resolution.

Original resolution can be everything between 480i/p and 720p, usually. Bones stuff is mostly 540p, f.ex. (IIRC only one NHK-related production from Bones is 720p, and for that one NHK gave out the hardware). It really varies depending on the studio.

My question : I've bought the japanese Blu-Ray of Kiddy Grade and Full Metal Panic.
Is the probability high that they are upscaled to 1080, and, in that case, if i'm doing my own work, a 720p video will finaly be enough ?
First animated series made for TV that were made (and aired) in some kind of HD'ish resolution were Sola and some other anime I can't remember. This was in 2007. For satellite/cable I've heard that WOWOW-produced King Gainer (2002) might've been produced in a HD'ish resolution, but I don't think there's a public HD mastered source of it available anywhere to prove it.

Original FMP airing was back in 2002. This puts it into the age of "We got into digital, welcome to 480i/p."

Kiddy Grade is of the same age, airing between 2002-2003.

In a nutshell, even if they had the cells/film rolls they would hardly be worth even 720p, I would say. The blu-rays? Definitely 480i/p upscaled to 1080i/p for the customers to think what great quality they are buying. Just pray to your local deity that they didn't use Q-TEC for the mastering process, which would basically mean "professional warpsharp" on your image + something along the lines of bilinear resize.

jpsdr
19th December 2010, 11:15
I'm 99.99% sure that Kiddy Grade and FMP are not made with cells, and so there is no film, and only digital/computer masters.

JEEB
19th December 2010, 11:51
I'm 99.99% sure that Kiddy Grade and FMP are not made with cells, and so there is no film, and only digital/computer masters.

Yes, which I meant with the "This puts it into the age of "We got into digital, welcome to 480i/p."" part.

The last part's first sentence was meant to amplify that "even if they happened to have the damn cells/film (in the case it was miraculously made in cells/film, which it most certainly isn't), it would barely be worth X".

Anyways, you asked a question, I answered. Neither of those are going to be even close to high definition if you get your hands on the sources. BDs are upscaled, and as I said -- just pray it wasn't Q-TEC who mastered them.

(Also, I'm still surprised that this thread is in the H.264/AAC subforum, it's mostly been about avisynth usage with the given source)

mp3dom
19th December 2010, 14:10
All the FMP series are upscaled. In anime the upscale is quite common unless you're watching recent shows (which could anyway be an upscale but from an higher source like 720p or 540p) or watching old animation from film. At least now they're working with pure 24p (23.976p) without fancy cadence or mixing 24p and 60i/30p. In general, recent anime movies are true 1080p or the source is near to 1080p.
Keep in mind that even quite recent shows (for example Suzumiya Haruhi 1st series - that is out now in BD thanks to Q-TEC upscale, or Gurren Lagann) are in plain SD. Bluray in that case will be an upscale.
The only title that I'm aware of being completely re-done was Serial Experiments Lain. It was redone/re-take from cells, with CG completely redone from scratch.

jpsdr
19th December 2010, 15:14
Anyways, you asked a question, I answered.

Yes, thanks.

jpsdr
20th December 2010, 09:57
Any idea about Macross Frontier TV serie ? I've also the japanese Blu-Ray, but i hope if upscaled, production was at least at 720p...

TheRyuu
22nd December 2010, 06:00
I've updated my VDub filters with CCC.
x64 version is SSE optimized.
You can get them here (http://rapidshare.com/files/437857369/Filtres_JPSDR.rar).

Just use /Qax and avoid a billion different builds.

jpsdr
22nd December 2010, 09:53
No, my intend is to have optimizest builds. I prefer to have 10 builds /Qx, than one /Qax, if the /Qx could be (in theory) better/faster, even if it's only a little.

Daemon404
25th December 2010, 04:44
http://forum.doom9.org/showthread.php?t=158696

Enjoy.

mp3dom
25th December 2010, 15:51
Thank you very much!