Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frame properties #18

Open
realfinder opened this issue Oct 14, 2020 · 10 comments
Open

frame properties #18

realfinder opened this issue Oct 14, 2020 · 10 comments

Comments

@realfinder
Copy link

realfinder commented Oct 14, 2020

Hi, in case you didn't note, but Asd-g added frame properties to MPEG2Dec/D2VSource, and since TIVTC and others used hints hack I think it's time to support frame properties to use it instead of hints if it available

@pinterf
Copy link
Owner

pinterf commented Oct 17, 2020

Yes, I was already looking for that possibility but seemed to be no an hours' work so I postponed.
But it is not forgotten.
(Those hints made me nervous :) and caused many extra hours of debugging. When I was making changes I was usually comparing the results of the old and the new code, and there always were very small differences. It turned out that those different bits came from the hints encoded on the 1st 64 bytes of the frames.)

@realfinder
Copy link
Author

realfinder commented May 2, 2022

with DG (videoh) new test DGDecode now I can do Asd-g/MPEG2DecPlus#9 (comment) so I think it possible to update tfm() to use these properties instead of d2v string input and it int "flags"

it can be done maybe by adding negative to int "flags"

1st "0" will be "If d2v file is used then check the d2v file for illegal transitions and set the order parameter if it
is not already manually set. Also, pass on rff flag duplicate info to
tdecimate. If d2v file is not used then check _FieldOperation property if it 0 then check _RFF, _EncodedFrameTop and _EncodedFrameBottom properties and set _ToDecimate property to 1 if _RFF=1 and the _EncodedFrameTop in previous and current frame is the same number in case of _FieldOrder=1, and _EncodedFrameBottom in previous and current frame is the same in case of _FieldOrder=0"

           -1 - Same as 0, plus use the _ProgressiveFrame=1, _EncodedFrameTop and _EncodedFrameBottom properties for field matching (rematch the top and the bottem based on _EncodedFrameTop and _EncodedFrameBottom)

           -2 - Same as -1, but _ProgressiveFrame not have to be 1 (very much not recommended!)

           -3 - do nothing, I think?

           -4 - same as -1 but soft matches are checked for being combed.  If a soft match is detected
                   as combed then tfm uses its own matching routine for that frame.

           -5 - Same as -4, but soft matches are only checked for being combed around scenechanges.

the "VERY IMPORTANT (MUST READ)" will need to replace "For options 0, 1, 2, 4, and 5 to work correctly" with "For options 0 (if d2v file used), 1, 2, 4, and 5 to work correctly"

edit: the default of int "flags" after this should be 4 if d2v file is used, -4 if d2v file not used

@pinterf
Copy link
Owner

pinterf commented May 2, 2022

Hi! I think by now I'm not even familiar with the terminology - I've encountered with this tfm-tdecimate thing only when modernized the source and I was given test videos and parameters to work with.
So all I can say that pull requests (preferably cleaned up - not ad-hoc trials) are welcome. :(

@videoh
Copy link

videoh commented May 2, 2022

I've been following things and know the jargon so perhaps I'll try my hand at this. Beware however, it won't be a high priority for me.

Is there an actual identifiable upside to making this change?

@pinterf
Copy link
Owner

pinterf commented May 5, 2022

Actually I have started backporting the use-frameproperties-no-hints modifications from VS port. (temporarily with one difference: hints can still be used)

@realfinder
Copy link
Author

@pinterf any news about backporting?

@pinterf
Copy link
Owner

pinterf commented Sep 1, 2022

Most of the changes and backport were done already - except for a variable frame-rate magic - but not polished at all.
For example the role of the usehint parameter is not guarded well and ambigous. In VS version it is only for getting the info from frame properties (VS got rid of the hints), but historically in Avisynth version we use the bit-hints encoded by the lowest bits in the first 32 pixels of the frame. I could not decide what to do: mixed bit hints and frame properties? Use both? Ignore the hints? I was thinking about to stop supporting the old content destructive method.

Why does it take so long time?

I didn't want to upload a 'dirty', not 100% commit, just for showing the present - though almost ready - state. Maybe I'd create a branch and upload the changes I have done already, and someone could test the builds from that work branch.

@realfinder
Copy link
Author

realfinder commented Sep 1, 2022

mixed bit hints and frame properties? Use both?

I think it's better as start is to remove the hints and make test build and it will be better if there are some "hints to/from properties" functions (same as http://avisynth.nl/index.php/ConvertStacked)

if everything ok after test build then we will talk about re-add the hints :) anyway my opinion #32 (comment)

@realfinder
Copy link
Author

except for a variable frame-rate magic

speaking of that, it will be nice if #26 can be done and better with #27

and about the "hint" parameters in TFM and TDecimate I see no problem making them work for either props or hints (but not both in same time of course), as start they only write/read props since hints was removed but later if hints re-added TFM write hints only for avs 2.6 not for avs+ and it's kinda safe to say same thing for TDecimate hint reading

or maybe adding new parameters for props away from "hint" parameters?

@realfinder
Copy link
Author

@pinterf
btw, what is the best/clean way to go of these cases:-

1- backport all tivtc from vs and update it (with #26 and #27) and with "hints to/from properties" functions (similar to http://avisynth.nl/index.php/ConvertStacked) with/without re-add the hints later

2- adding vs change with the current avs one

I think the 1st one better? unless there are compatibility breaking changes in vs port, anyway I'm still waiting for testing build :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants