I'm probably doing something wrong but right now I don't know what :/
My goal is to scale a grafic by x4. So I thought I'd call the HQx2 scaler twice. The scaler is initialized with the Pixelformat at this point, BufferA/B are Byte-Vectors.
The first call to scale works as expected, the seconds triggers an AV. My naive expectation was, that BufferA contains a pictures exactly twice as large as the source when the second scale is called, so I'd just multiply all arguments by 2. That's probably wrong, though?
EDIT: Using the "normal" scaler, the code below works as expected in this stepordner. So it seems to be something with the hq scaler I'm not doing right?
Code: Select all
void *RivenVideo::ScaleFrame(const void *Pixels, int Pitch, int Height, int BytesPerPixel) {
int Size = Height * Pitch * 4* 4;
int srcPitch = Pitch;
int srcWidth = Pitch / BytesPerPixel;
int srcHeight = Height;
BufferA.reserve(Size);
BufferB.reserve(Size);
if (Scaler) {
Scaler->setFactor(2);
Scaler->scale((const uint8 *)Pixels, srcPitch, BufferA.data(), srcPitch * 2, srcWidth, srcHeight, 0, 0);
Scaler->scale((const uint8 *)BufferA.data(), srcPitch*2, BufferB.data(), srcPitch * 4, srcWidth*2, srcHeight*2, 0, 0);
return BufferB.data();
} else {
//fallback
}
}