12/24/2023 0 Comments Input in iclip![]() Just as in VirtualDub, the "pitch" of a frame buffer is the offset (in bytes) from the beginning of one scan line to the beginning of the next. There is an IsWritable() method which you can call to find out if a buffer is writable or not, and there's a MakeWritable callback to ensure that it is. However, frames you get from other clips via GetFrame may not be writable, in which case GetWritePtr() will return a null pointer. Our filter's dst came from NewVideoFrame, so we can safely call dst->GetWritePtr(). This can sometimes be an inconvenience, as I'll explain later.Īny buffer you get from NewVideoFrame is guaranteed to be writable (as long as you only assign it to one PVideoFrame!). The only drawback is that you can't have two PVideoFrames pointing to a writable buffer. This rule guarantees that as long as you hold on to a PVideoFrame and don't write to it yourself, that frame will remain unchanged. In other words, you can only write to a buffer if no one else might be reading it. The rule about writability is this: A buffer is writable if and only if there is exactly one PVideoFrame pointing to it. In our case the operations are channel-independent so it doesn't matter which plane is processed first.Īll frame buffers are readable, but not all are writable. Note it also works for Y8 since these functions return zero if the plane (PLANAR_U, PLANAR_V) doesn't exist. For filter writers this means that they can write one simple function that is called three times, one for each color channel, assuming that the operations are channel-independent (which is not always the case). Note that in the constructor we excluded the formats which are not planar or not YUV. ![]() Hence srcp and dstp needs to be declared as unsigned char (or BYTE would have been possible too). Such a component (for example an U sample) has a value between 0 and 255 (exactly one byte). Note that we will modify one color component (instead of an entire pixel) at the same time. This is the declaration of the used variables. It's called "InvertNeg", and it produces a photo-negative of the input clip.Ĭlass InvertNeg : public GenericVideoFilter I'll start off with a complete, working Avisynth plugin.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |