Thread: Avisynth+
View Single Post
Old 27th October 2016, 14:34   #2494  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,314
Quote:
Originally Posted by jpsdr View Post
Is something like this still working with all these new format/size, or should i do otherwise ?
Code:
const int src_width = vi.IsPlanar() ? vi.width : vi.BytesFromPixels(vi.width);
If otherwise, what should i do ?

It depends, what do you want to do with it?

For non-planar sources BytesFromPixels(1) will return
RGB24: 3
RGB32: 4
RGB48: 6
RGB64: 8
YUY2: 2

If you want to get the byte size of a row (within one plane for planar or the whole packed line for old RGB formats), by using BytesFromPixels(width) you will get the occupied bytes of one row.

I suppose you use it in resampler, this is how it is used there:
int work_width = vi.IsPlanar() ? vi.width : vi.BytesFromPixels(vi.width) / pixelsize
where pixelsize is vi.ComponentSize() (1 for 8 bits, 2 for 10-16 bits, 4 for float)
pinterf is offline