|
|
YV12-filter with only 1 loop possible?
i got a problem with yv12 filter writing:
these filters need 2-3 loops
but what if i for example wanna check the luma of a pixel and then change luma and chroma of that pixel based on the result
i would have to do it one loop, right? but how?
thx for any help
E-Male
Something like this:Code:
unsigned char* srcp = src-gt;GetWritePtr();
unsigned char* srcpV = src-gt;GetWritePtr();
unsigned char* srcpU = src-gt;GetWritePtr();
const int src_pitch = src-gt;GetPitch();
const int src_width = src-gt;GetRowSize();
const int src_height = src-gt;GetHeight();
if (vi.IsYV12()) {
const int src_pitchUV = src-gt;GetPitch(PLANAR_U);
const int src_row_sizeUV = src-gt;GetRowSize(PLANAR_U);
const int src_heightUV = src-gt;GetHeight(PLANAR_U);
srcp = src-gt;GetWritePtr(PLANAR_Y);
srcpV = src-gt;GetWritePtr(PLANAR_V);
srcpU = src-gt;GetWritePtr(PLANAR_U);
for (int h=0; h lt; src_height;h++) {
for (int x = 0; x lt; src_width; x+=2) {
// red: Y=82, U=90 and V=240
if (srcp[x] lt; min_luma) {
srcp[x] = 82;
srcp[x+1] = 82;
srcpV[x/2] = 240;
srcpU[x/2] = 90;
}
if (srcp[x] gt; max_luma) {
// green: Y=145, U=54 and V=34
srcp[x] = 145;
srcp[x+1] = 145;
srcpV[x/2] = 34;
srcpU[x/2] = 54;
}
}
srcp += src_pitch;
if (h%2==1) {
srcpV += src_pitchUV;
srcpU += src_pitchUV;
}
}
}
Here the values srcpV and srcpU are assigned twice, but you get the idea.
thx, i'll read through it carefulyl tonight, but seems exactly what i was looking for |
|