MCPcopy Create free account
hub / github.com/cmauri/eviacam / processPixels

Method processPixels

creavision/videoInput.cpp:1492–1551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1490// ----------------------------------------------------------------------
1491
1492void videoInput::processPixels(unsigned char * src, unsigned char * dst, int width, int height, bool bRGB, bool bFlip){
1493
1494 int widthInBytes = width * 3;
1495 int numBytes = widthInBytes * height;
1496
1497 if(!bRGB){
1498
1499 int x = 0;
1500 int y = 0;
1501
1502 if(bFlip){
1503 for(int y = 0; y < height; y++){
1504 memcpy(dst + (y * widthInBytes), src + ( (height -y -1) * widthInBytes), widthInBytes);
1505 }
1506
1507 }else{
1508 memcpy(dst, src, numBytes);
1509 }
1510 }else{
1511 if(bFlip){
1512
1513 int x = 0;
1514 int y = (height - 1) * widthInBytes;
1515 src += y;
1516
1517 for(int i = 0; i < numBytes; i+=3){
1518 if(x >= width){
1519 x = 0;
1520 src -= widthInBytes*2;
1521 }
1522
1523 *dst = *(src+2);
1524 dst++;
1525
1526 *dst = *(src+1);
1527 dst++;
1528
1529 *dst = *src;
1530 dst++;
1531
1532 src+=3;
1533 x++;
1534 }
1535 }
1536 else{
1537 for(int i = 0; i < numBytes; i+=3){
1538 *dst = *(src+2);
1539 dst++;
1540
1541 *dst = *(src+1);
1542 dst++;
1543
1544 *dst = *src;
1545 dst++;
1546
1547 src+=3;
1548 }
1549 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected