[FFmpeg-user] Filter documentation -- PTSs

Mark Filipak (ffmpeg) markfilipak at bog.us
Mon Feb 15 08:29:42 EET 2021


On 02/15/2021 12:35 AM, Carl Zwanzig wrote:
> On 2/14/2021 5:54 PM, Mark Filipak (ffmpeg) wrote:
>> On 02/14/2021 08:44 PM, Paul B Mahol wrote:
> 
> 
>>> See source code of telecine filter. ...
>> I can't read 'C'.
> 
> You really ought to learn, it's not that hard to _read_ although the context and the data names 
> matter a lot. And there are details that may not be so easy to express in text which then just look 
> like the code.
> 
> 
>>> ... It is doing all calculations avoiding
>>> floats.
>>> But formula in floats are pretty trivial and straightforward to write.
>>
>> Then my request should be easy for you. What is the formula?
> 
> Some of these aren't mere a = b + c formulae, they have decision points in the calculation which 
> aren't readily expressed in algebra.
> 
> You'll see things like this (from vf_telecine.c/filter_frame)
> 

Thanks, Carl,

> frame->pts = (
>       (s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time) +
>       av_rescale(outlink->frame_count_in, s->ts_unit.num, s->ts_unit.den);

Okay. When I see that assignment,

var = (test) ? if_test_true_val : if_test_false_val //this is my favorite way to do a conditional 
assignment though I prefer case statements because it's so easy to assure 100% coverage (and thereby 
avoid bugs).

I don't know what this: 'frame->pts', means. I have written a ton of assembly code for various 
micros and people tell me, "It's easy, Mark. 'frame->pts' is a 'pointer' to memory as in assembly", 
but I don't see the analog of a memory address register in it. If 'pts' is a pointer, then how can 
'frame' be written through that pointer and where does it get written? It's a mystery to me. Or is 
'frame' the pointer and 'pts' the memory location?

I also write complex stuff like 'thisfun(var x=this, var y=that, var z=thatfun(theother))' as a 
convenient alternative to
'thisfun(this, that, thatfun(theother))'
  all the time, but I don't get all the 'pointer' references that have similar types of structures. 
'rescale()' looks like a function, but how can the arguments to a function be doing writes? If 
they're not doing writes, then why do they have variable names: 'outlink' 's' and 's'? And how can 
's' be input twice? Wouldn't their simple list order be enough to identify them for the code local 
to 'rescale()'? In other words, why wouldn't 'rescale()' be
'rescale(->frame_count_in, ->ts_unit.num, ->ts_unit.den)'?
But then, since a variable name (any variable name) *is* a memory reference already, then why 
wouldn't 'rescale()' simply be
'rescale(frame_count_in, ts_unit.num, ts_unit.den)'?

It's my deficiency, but it stops me cold every time I look at 'C' code. My brain just locks up.

> then you need to know what av_rescale does (libavutils/mathematics.c).
> 
> Later,
> 
> z!
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


-- 
Any journey, no matter how long, is just a series of small steps.
"Government is the problem!" -- 1982 and onward.
"_______ is the enemy of the people!" -- 2016 and onward.
"You have to fight like hell or you're not going to have a country!" -- Jan 6, 2021.
It isn't the distance that's important, it's the direction.


More information about the ffmpeg-user mailing list