TIVTC icon indicating copy to clipboard operation
TIVTC copied to clipboard

Frame properties

Open TbtBI opened this issue 3 years ago • 18 comments

Hi. After TDeint and tfm/tdecimate the frame property "_FieldBased" isn't changed (2/1->0).

TbtBI avatar Feb 19 '22 06:02 TbtBI

I can confirm this.

FranceBB avatar Feb 19 '22 10:02 FranceBB

True, no frame property handling at all. Neither has such feature in TIVTC nor in AviSynth+. And there are some hidden data-encoded-in-lower-bits method for other data which we also have to get rid of and replace with frame properties. VS port of TIVTC (but not TDeint) did some initiatives on using frame propertiesm this is all I know of the topic. AviSynth environment has an additional compatibility drawback that it must also match with the existing clip properties.

pinterf avatar Feb 19 '22 11:02 pinterf

now we got 2 issues with same content https://github.com/pinterf/TIVTC/issues/18

realfinder avatar Feb 26 '22 21:02 realfinder

some hidden data-encoded-in-lower-bits method for other data which we also have to get rid of and replace with frame properties.

I think "get rid" is not a good solution as a start, I think it's better to see if there are frame property or not, if no frame property then hints hack is used as usual

also same as http://avisynth.nl/index.php/ConvertStacked , we may need "hints hack <> frame property" converter, there are MergeHints() in tivtc and some independent plugins like http://avisynth.nl/index.php/TelecideHints already

realfinder avatar Feb 26 '22 21:02 realfinder

Last year TIVTC was ported to VapourSynth, they have already made the complete transition to frame properties. It has to be 'only' backported while maintaining compatibility with old bit-hint stuff.

pinterf avatar Feb 27 '22 07:02 pinterf

Just for the record: In VapourSynth port - https://github.com/dubhater/vapoursynth-tivtc which was based on my version frame properties are handled fine, The old bit-hint hack is completely removed of course. Some handled properties appear in TFM::putFrameProperties, others are set in various places. List of handled properties: https://github.com/dubhater/vapoursynth-tivtc/blob/master/src/internal.h#L23

Relevant commits:

https://github.com/dubhater/vapoursynth-tivtc/commit/6c6424a3506eed47617a4f17fe2c06efd240b790 https://github.com/dubhater/vapoursynth-tivtc/commit/42ee26104773601db59589da39d24a1567930ef2 https://github.com/dubhater/vapoursynth-tivtc/commit/f6886a47ae563f663a2c1bc39199c1d1bdb9e5f3 https://github.com/dubhater/vapoursynth-tivtc/commit/e967d3fb6e45a7046ba5e6a0634da1c9b4a81491

Unfortunately (for us) other things were modernized/rewritten as well, so a one-by-one backport is no longer possible.

pinterf avatar May 03 '22 09:05 pinterf

Please look at the first test build, which includes frame properties used by the VS port. https://github.com/pinterf/TIVTC/releases/tag/v1.0.27test1

pinterf avatar Sep 15 '22 08:09 pinterf

seems ok, I always love how your test build work ok even if you said that you didn't test it at all :)

but with https://www.mediafire.com/file/q2q0a64yosh79rz/INTRO.demuxed.m2v/file there are small diff

D2VSource("INTRO.demuxed.d2v")
tfm.TDecimate
a=last

LoadPlugin("TIVTC.dll")
D2VSource("INTRO.demuxed.d2v")
tfm.TDecimate
mt_makediff(last,a,u=3,v=3)
Mt_lut("x 128 = 128 255 ?",u=3,v=3)
#~ propShow(8)

not in all frames but with some like 2322 (after ivtc)

edit: I don't think it's a bug (rather than difference due to updates) but it might be, tfm part are 100% same aside from hints diffs in the top left, also I will be glad to see updates for https://github.com/pinterf/TIVTC/issues/26 and https://github.com/pinterf/TIVTC/issues/27

realfinder avatar Sep 15 '22 19:09 realfinder

btw, the op problem ("_FieldBased" isn't changed (2/1->0)) still there

realfinder avatar Sep 15 '22 20:09 realfinder

I simply didn't have time to test, but of course I tried not to release a version which I knew there are fully unfinished parts (there was a couple of them which I left open; that's why I had some work with it last week and that was the reason I had not released this test earlier). I appreciate your help in testing, you have much broader insight in the topic than I have.

TDeint is still unmodified, since it was not ported along with TIVTC to VapourSynth, so I didn't have ready-made modifications which I could simply pull and integrate into Avisynth code. If the property handling in TIVTC filters work, then credits go to dubhater, I just tried to backport the code properly and mix it with the existing hint handling. If there is a difference though, it must be investigated whether it is a backport bug or the result of a bug which was meanwhile fixed.

pinterf avatar Sep 16 '22 07:09 pinterf

yes I know that TDeint still not updated, but I think tfm should at least in most cases change _FieldBased to 0

realfinder avatar Sep 16 '22 11:09 realfinder

Now _FieldBased is only read, and if exists, it gets priority over Avisynth's GetParity function. I don't know how and when can we set it to any value for sure. The property is not written is VapourSynth port.

pinterf avatar Sep 16 '22 12:09 pinterf

maybe the VapourSynth port not complete yet? from what I see it manly only removed hints hack and replace it with props

anyway it's safe to make tfm write _FieldBased as 0 (since we got _Combed for pp 0 and 1), same for TDeint

and I will ping @videoh @dubhater @myrsloik to see if they got another opinions

realfinder avatar Sep 16 '22 12:09 realfinder

Technically you should probably only set _FieldBased=0 after adjusting the chroma for the slightly different position. 99.99% of users won't care so setting _FieldBased=0 is correct too I guess.

myrsloik avatar Sep 16 '22 12:09 myrsloik

that only in 60i sections (_Combed=1) with 4:2:0, right? https://forum.doom9.org/showthread.php?p=1849482#post1849482 edit: I think the 30i/p sections also affected

the pure hard telecined part affected? or it depends on the source and how they did the telecine?

realfinder avatar Sep 16 '22 13:09 realfinder

ok, I did read about chroma case, it seems kinda rare case and it can be anything from what I asked above, so it safe to set _FieldBased=0 in non 420 chroma, also in case of 420 and _ProgressiveFrame=1 frames

realfinder avatar Sep 16 '22 15:09 realfinder

Sorry, I'm ignorant and did not follow developments in other areas. Namely I need help on the _ProgressiveFrame. And another question, should this property be deleted or set (if not exists) after the filter (and which filter)?

pinterf avatar Sep 19 '22 09:09 pinterf

https://github.com/Asd-g/MPEG2DecPlus/issues/9#issuecomment-1114049020 it tell how the frame was encoded in the stream

if there are no _ProgressiveFrame then tfm should act as usual (as there are no _ProgressiveFrame), you can delete it in tfm output but just in case better to leave it or delete it in TDecimate

realfinder avatar Sep 19 '22 16:09 realfinder