VideoHelp Forum




+ Reply to Thread
Results 1 to 5 of 5
  1. The output file I get from YATTA is formatted for FieldHints and doesn't seem to work with TFM, which I want to use due to better field matching quality. I'm wondering if there's something I can do since their TFM's ovr format is a bit convoluted IMO:

    This is fieldhints format:
    Code:
    0,0,-
    1,1,-
    2,2,-
    4,3,-
    5,4,-
    5,5,-
    6,6,-
    It goes frame by frame matching fields, the first figure are "top" fields the second "bottom". The minus is to output as progressive (not interlaced).

    TFM's ovr is a bit more complicated, here is a link.
    My thought is something like this would work, but I'm not sure how to get from the above to this, even with regex.
    Code:
    0 c
    1 c
    2 c
    4 p
    5 p
    5 c
    6 c
    Quote Quote  
  2. Formerly 'vaporeon800' Brad's Avatar
    Join Date
    Apr 2001
    Location
    Vancouver, Canada
    Search PM
    Doesn't your FieldHint file tell the filter which fields to match for every single field in the source?

    In that case you wouldn't be using TFM's field-match guessing algorithm even if you converted the format to 'TFM ovr'.

    Or are you claiming that the video quality of a "5,4" frame output by FieldHint is somehow worse than a "5 p" from TFM?
    Quote Quote  
  3. Yes, even for the same field matching FieldHint's quality is a bit worse (jagged, aliased...). I'm trying to port the metrics to TFM readable format.
    Quote Quote  
  4. Formerly 'vaporeon800' Brad's Avatar
    Join Date
    Apr 2001
    Location
    Vancouver, Canada
    Search PM
    Apart from TFM being better-optimized (faster), they combine fields the same way.

    FieldHint 0.1 frame-drawing algorithm:
    Code:
    PVideoFrame __stdcall FieldHint::GetFrame(int n, IScriptEnvironment* env)
    {
       PVideoFrame newframe = env->NewVideoFrame(vi);
        PVideoFrame tf = child->GetFrame(ovr[n].tf, env);
        PVideoFrame bf = child->GetFrame(ovr[n].bf, env);
        CopyField(newframe, tf, 0);
        CopyField(newframe, bf, 1);
    [...]
        return newframe;
    }
    
    void FieldHint::CopyField(PVideoFrame& to, PVideoFrame& from, int field)
    {
        const static int planes[] = {PLANAR_Y, PLANAR_U, PLANAR_V};
        int p;
        for(p = 0; p < (vi.IsYV12() ? 3 : 1); p++)
        {
            env->BitBlt(to->GetWritePtr(planes[p]) + to->GetPitch(planes[p])*field,
                        to->GetPitch(planes[p])*2,
                        from->GetReadPtr(planes[p]) + from->GetPitch(planes[p])*field,
                        from->GetPitch(planes[p])*2,
                        from->GetRowSize(planes[p]),
                        (from->GetHeight(planes[p]) + !field) / 2);
        }
    }
    TFM 1.0.5 frame-drawing algorithm:
    Code:
    void TFM::createWeaveFrame(PVideoFrame &dst, PVideoFrame &prv, PVideoFrame &src, 
            PVideoFrame &nxt, IScriptEnvironment *env, int match, int &cfrm, int np)
    {
        if (cfrm == match)
            return;
        int b, plane;
        for (b=0; b<np; ++b)
        {
            if (b == 0) plane = PLANAR_Y;
            else if (b == 1) plane = PLANAR_V;
            else plane = PLANAR_U;
            if (match == 0)
            {
                env->BitBlt(dst->GetWritePtr(plane)+(1-field)*dst->GetPitch(plane),dst->GetPitch(plane)<<1,
                    src->GetReadPtr(plane)+(1-field)*src->GetPitch(plane),src->GetPitch(plane)<<1, 
                    src->GetRowSize(plane),src->GetHeight(plane)>>1);
                env->BitBlt(dst->GetWritePtr(plane)+field*dst->GetPitch(plane),dst->GetPitch(plane)<<1, 
                    prv->GetReadPtr(plane)+field*prv->GetPitch(plane),prv->GetPitch(plane)<<1, 
                    prv->GetRowSize(plane),prv->GetHeight(plane)>>1);
            }
            else if (match == 1)
            {
                env->BitBlt(dst->GetWritePtr(plane),dst->GetPitch(plane),src->GetReadPtr(plane), 
                    src->GetPitch(plane),src->GetRowSize(plane),src->GetHeight(plane));
            }
            else if (match == 2)
            {
                env->BitBlt(dst->GetWritePtr(plane)+(1-field)*dst->GetPitch(plane),dst->GetPitch(plane)<<1,
                    src->GetReadPtr(plane)+(1-field)*src->GetPitch(plane),src->GetPitch(plane)<<1, 
                    src->GetRowSize(plane),src->GetHeight(plane)>>1);
                env->BitBlt(dst->GetWritePtr(plane)+field*dst->GetPitch(plane),dst->GetPitch(plane)<<1, 
                    nxt->GetReadPtr(plane)+field*nxt->GetPitch(plane),nxt->GetPitch(plane)<<1,
                    nxt->GetRowSize(plane),nxt->GetHeight(plane)>>1);
            }
            else if (match == 3)
            {
                env->BitBlt(dst->GetWritePtr(plane)+field*dst->GetPitch(plane),dst->GetPitch(plane)<<1,
                    src->GetReadPtr(plane)+field*src->GetPitch(plane),src->GetPitch(plane)<<1, 
                    src->GetRowSize(plane),src->GetHeight(plane)>>1);
                env->BitBlt(dst->GetWritePtr(plane)+(1-field)*dst->GetPitch(plane),dst->GetPitch(plane)<<1, 
                    prv->GetReadPtr(plane)+(1-field)*prv->GetPitch(plane),prv->GetPitch(plane)<<1, 
                    prv->GetRowSize(plane),prv->GetHeight(plane)>>1);
            }
            else if (match == 4)
            {
                env->BitBlt(dst->GetWritePtr(plane)+field*dst->GetPitch(plane),dst->GetPitch(plane)<<1,
                    src->GetReadPtr(plane)+field*src->GetPitch(plane),src->GetPitch(plane)<<1, 
                    src->GetRowSize(plane),src->GetHeight(plane)>>1);
                env->BitBlt(dst->GetWritePtr(plane)+(1-field)*dst->GetPitch(plane),dst->GetPitch(plane)<<1, 
                    nxt->GetReadPtr(plane)+(1-field)*nxt->GetPitch(plane),nxt->GetPitch(plane)<<1, 
                    nxt->GetRowSize(plane),nxt->GetHeight(plane)>>1);
            }
            else env->ThrowError("TFM:  an unknown error occurred (no such match!)");
        }
        cfrm = match;
    }
    Quote Quote  
  5. I threw a ShowFrameNumbers() to see what was happening, I think it was just a different fieldmatching, probably a wrong fieldmatching on the jagged/aliased frame.

    Sometimes fieldmatching quality is not perfect and comparisons side to side with TFM can reveal this, what I might be overlooked is that this makes up for correct fieldmatching on the long run, further seeking I can see a wrong fieldmatching in the TFM that is not present in FieldHints, so as you showed I'm sure I would get exact results in case TFM were doing the right thing.

    I was almost to drop YATTA for this project seeing that all the decimations were correct, I overlooked fieldmatching accuracy completely. Thanks for confirming the source.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!