Closed adinapoli closed 2 years ago
Ok, I have managed to get it to work. In case somebody finds it useful, my approach was mostly correct but I wrongly assumed that loop was iterating by rows, whereas the scan was done by columns (silly me), and this is exactly what yprecal
buys us, the ability to precalculate the next pixel columwise.
All good, closing it.
Hello @ddennedy ,
apologies for opening an issue, it just seemed quicker and with better support for posting code snippets 😉 . I am trying to do something conceptually simple: I need to take the input frame that is addressed by the
uint32_t *in
pointer in theupdate
callback and drop thealpha
out of it.Bigger context: I need to call a (Python) library (via the C interpreter) that accepts only images without the alpha channel or, to be more precise, a
numpy
array as a matrix of triples(R,G,B)
. My cunning plan was to mostly copy what thecartoon
filter was doing and take from there. In particular, I thought about the following:sizeof(char) * (frame_width * frame_height * 3)
, where eachr
,g
,b
value would be stored as a separate char, as opposed as a single int32 integer like the input frame;r
,g
,b
out of the input pixel, store it in my memory chunk contiguously;out
frame.This seems to "kinda work", but I get a grayscale image, and by dumping the
numpy
matrix on stdout is clear I am doing something silly. Super stripped down version of the code:I am opening this ticket as I would like to understand where is the hole in my reasoning and why this mysterious
yprecal
array even work. As said it was shamelessly stolen bycartoon
and is initialised like this in the constructor:It seems some way of mapping between "screen space" and some other kind of coordinate system, but I am afraid this is beyond my level of ffmpeg/frei0r expertise.
Thanks in advance 😉