Lines Matching refs:buf

167 void checkPixel(const CpuConsumer::LockedBuffer &buf,
170 switch(buf.format) {
173 uint16_t *bPtr = (uint16_t*)buf.data;
174 bPtr += y * buf.stride + x;
192 uint8_t *bPtr = (uint8_t*)buf.data;
193 bPtr += y * buf.stride + x;
200 uint16_t *bPtr = ((uint16_t*)buf.data) + y * buf.stride + x;
207 uint8_t *bPtr = (uint8_t*)buf.data;
208 bPtr += (y * buf.stride + x) * bytesPerPixel;
216 ADD_FAILURE() << "Unknown format for check:" << buf.format;
223 void fillYV12Buffer(uint8_t* buf, int w, int h, int stride);
227 void fillGreyscaleBuffer(T* buf, int w, int h, int stride, int bpp) {
242 buf[yuvTexOffsetY + (y * yuvTexStrideY) + x] = intensity;
256 void fillRgba8888Buffer(uint8_t* buf, int w, int h, int stride)
272 buf[(y*stride + x)*bytesPerPixel + 0] = r;
273 buf[(y*stride + x)*bytesPerPixel + 1] = g;
274 buf[(y*stride + x)*bytesPerPixel + 2] = b;
275 buf[(y*stride + x)*bytesPerPixel + 3] = 255;
283 void fillBayerRawBuffer(uint8_t* buf, int w, int h, int stride) {
284 ALOGVV("fillBayerRawBuffer: %p with %d x %d, stride %d", buf, w, h ,stride);
289 uint16_t *bPtr1 = ((uint16_t*)buf) + stride*y;
309 void checkGreyscaleBuffer(const CpuConsumer::LockedBuffer &buf) {
310 uint32_t w = buf.width;
311 uint32_t h = buf.height;
316 checkPixel(buf, 0, 0, 191);
317 checkPixel(buf, 1, 0, 191);
318 checkPixel(buf, 0, 1, 191);
319 checkPixel(buf, 1, 1, 191);
322 checkPixel(buf, blockWidth, 0, 63);
323 checkPixel(buf, blockWidth + 1, 0, 63);
324 checkPixel(buf, blockWidth, 1, 63);
325 checkPixel(buf, blockWidth + 1, 1, 63);
328 checkPixel(buf, 0, blockHeight, 63);
329 checkPixel(buf, 1, blockHeight, 63);
330 checkPixel(buf, 0, blockHeight + 1, 63);
331 checkPixel(buf, 1, blockHeight + 1, 63);
334 checkPixel(buf, blockWidth, blockHeight, 191);
335 checkPixel(buf, blockWidth + 1, blockHeight, 191);
336 checkPixel(buf, blockWidth, blockHeight + 1, 191);
337 checkPixel(buf, blockWidth + 1, blockHeight + 1, 191);
343 checkPixel(buf, w-1, h-1, pixelValue);
346 void checkRgba8888Buffer(const CpuConsumer::LockedBuffer &buf) {
347 uint32_t w = buf.width;
348 uint32_t h = buf.height;
353 checkPixel(buf, 0, 0, 191, 63, 63);
354 checkPixel(buf, 1, 0, 191, 63, 63);
355 checkPixel(buf, 0, 1, 191, 63, 63);
356 checkPixel(buf, 1, 1, 191, 63, 63);
359 checkPixel(buf, blockWidth, 0, 63, 191, 63);
360 checkPixel(buf, blockWidth + 1, 0, 63, 191, 63);
361 checkPixel(buf, blockWidth, 1, 63, 191, 63);
362 checkPixel(buf, blockWidth + 1, 1, 63, 191, 63);
365 checkPixel(buf, 0, blockHeight, 63, 191, 63);
366 checkPixel(buf, 1, blockHeight, 63, 191, 63);
367 checkPixel(buf, 0, blockHeight + 1, 63, 191, 63);
368 checkPixel(buf, 1, blockHeight + 1, 63, 191, 63);
371 checkPixel(buf, blockWidth, blockHeight, 63, 63, 191);
372 checkPixel(buf, blockWidth + 1, blockHeight, 63, 63, 191);
373 checkPixel(buf, blockWidth, blockHeight + 1, 63, 63, 191);
374 checkPixel(buf, blockWidth + 1, blockHeight + 1, 63, 63, 191);
383 checkPixel(buf, w-1, h-1, r, g, b);
387 void checkBayerRawBuffer(const CpuConsumer::LockedBuffer &buf) {
388 uint32_t w = buf.width;
389 uint32_t h = buf.height;
394 checkPixel(buf, 0, 0, 1000, 200, 200);
395 checkPixel(buf, 1, 0, 1000, 200, 200);
396 checkPixel(buf, 0, 1, 1000, 200, 200);
397 checkPixel(buf, 1, 1, 1000, 200, 200);
400 checkPixel(buf, blockWidth, 0, 200, 200, 1000);
401 checkPixel(buf, blockWidth + 1, 0, 200, 200, 1000);
402 checkPixel(buf, blockWidth, 1, 200, 200, 1000);
403 checkPixel(buf, blockWidth + 1, 1, 200, 200, 1000);
406 checkPixel(buf, 0, blockHeight, 200, 1000, 200);
407 checkPixel(buf, 1, blockHeight, 200, 1000, 200);
408 checkPixel(buf, 0, blockHeight + 1, 200, 1000, 200);
409 checkPixel(buf, 1, blockHeight + 1, 200, 1000, 200);
412 checkPixel(buf, blockWidth, blockHeight, 1000, 1000, 1000);
413 checkPixel(buf, blockWidth + 1, blockHeight, 1000, 1000, 1000);
414 checkPixel(buf, blockWidth, blockHeight + 1, 1000, 1000, 1000);
415 checkPixel(buf, blockWidth + 1, blockHeight + 1, 1000, 1000, 1000);
423 checkPixel(buf, w-1, h-1, maxR, maxG, maxB);
426 void checkAnyBuffer(const CpuConsumer::LockedBuffer &buf, int format) {
429 checkBayerRawBuffer(buf);
432 checkGreyscaleBuffer<uint8_t>(buf);
435 checkGreyscaleBuffer<uint16_t>(buf);
438 checkRgba8888Buffer(buf);
489 sp<GraphicBuffer> buf(GraphicBuffer::from(anb));
491 *stride = buf->getStride();
495 err = buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
503 fillBayerRawBuffer(img, params.width, params.height, buf->getStride());
507 buf->getStride(), /*bpp*/8);
511 params.height, buf->getStride(),
515 fillRgba8888Buffer(img, params.width, params.height, buf->getStride());
522 err = buf->unlock();
530 err = anw->queueBuffer(anw.get(), buf->getNativeBuffer(), -1);