Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 52 additions & 34 deletions include/openastro/video/formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,40 +27,58 @@
#ifndef OPENASTRO_CAMERA_FORMATS_H
#define OPENASTRO_CAMERA_FORMATS_H

#define OA_PIX_FMT_RGB24 1
#define OA_PIX_FMT_BGR24 2
#define OA_PIX_FMT_GREY8 3
#define OA_PIX_FMT_GRAY8 3
#define OA_PIX_FMT_GREY16BE 4
#define OA_PIX_FMT_GRAY16BE 4
#define OA_PIX_FMT_GREY16LE 5
#define OA_PIX_FMT_GRAY16LE 5
#define OA_PIX_FMT_BGGR8 6
#define OA_PIX_FMT_RGGB8 7
#define OA_PIX_FMT_GBRG8 8
#define OA_PIX_FMT_GRBG8 9
#define OA_PIX_FMT_BGGR16LE 10
#define OA_PIX_FMT_BGGR16BE 11
#define OA_PIX_FMT_RGGB16LE 12
#define OA_PIX_FMT_RGGB16BE 13
#define OA_PIX_FMT_GBRG16LE 14
#define OA_PIX_FMT_GBRG16BE 15
#define OA_PIX_FMT_GRBG16LE 16
#define OA_PIX_FMT_GRBG16BE 17
#define OA_PIX_FMT_RGB48BE 18
#define OA_PIX_FMT_RGB48LE 19
#define OA_PIX_FMT_BGR48BE 20
#define OA_PIX_FMT_BGR48LE 21

#define OA_PIX_FMT_YUV444P 22
#define OA_PIX_FMT_YUV422P 23
#define OA_PIX_FMT_YUV420P 24
#define OA_PIX_FMT_YUV410P 25
#define OA_PIX_FMT_YUYV 27
#define OA_PIX_FMT_UYVY 28
#define OA_PIX_FMT_YUV420 29
#define OA_PIX_FMT_YUV411 30
#define OA_PIX_FMT_YUV410 31
#define DEFINE_OA_PIX_FMT(OA_PIX_FMT) \
OA_PIX_FMT(RGB24) \
OA_PIX_FMT(BGR24) \
OA_PIX_FMT(GREY8) \
OA_PIX_FMT(GREY16BE) \
OA_PIX_FMT(GREY16LE) \
OA_PIX_FMT(BGGR8) \
OA_PIX_FMT(RGGB8) \
OA_PIX_FMT(GBRG8) \
OA_PIX_FMT(GRBG8) \
OA_PIX_FMT(BGGR16LE) \
OA_PIX_FMT(BGGR16BE) \
OA_PIX_FMT(RGGB16LE) \
OA_PIX_FMT(RGGB16BE) \
OA_PIX_FMT(GBRG16LE) \
OA_PIX_FMT(GBRG16BE) \
OA_PIX_FMT(GRBG16LE) \
OA_PIX_FMT(GRBG16BE) \
OA_PIX_FMT(RGB48BE) \
OA_PIX_FMT(RGB48LE) \
OA_PIX_FMT(BGR48BE) \
OA_PIX_FMT(BGR48LE) \
\
OA_PIX_FMT(YUV444P) \
OA_PIX_FMT(YUV422P) \
OA_PIX_FMT(YUV420P) \
OA_PIX_FMT(YUV410P) \
OA_PIX_FMT(YUYV) \
OA_PIX_FMT(UYVY) \
OA_PIX_FMT(YUV420) \
OA_PIX_FMT(YUV411) \
OA_PIX_FMT(YUV410) \


#define OA_PIX_FMT_GRAY8 OA_PIX_FMT_GREY8
#define OA_PIX_FMT_GRAY16BE OA_PIX_FMT_GREY16BE
#define OA_PIX_FMT_GRAY16LE OA_PIX_FMT_GREY16LE


#define ENUM(FMT) OA_PIX_FMT_##FMT,
enum { OA_PIX_FMT_NONE = 0,
DEFINE_OA_PIX_FMT(ENUM)
OA_PIX_FMT_MAX };

#define STRING(FMT) #FMT,
static const char *oa_pix_fmt_strings[] = {
"error", DEFINE_OA_PIX_FMT(STRING)
};


#define OA_PIX_FMT_STRING(x) \
oa_pix_fmt_strings[x>0 && x<OA_PIX_FMT_MAX ? x : 0]

#define OA_ISGREYSCALE(x) \
(( x == OA_PIX_FMT_GREY8 ) || ( x == OA_PIX_FMT_GREY16BE ) || \
Expand Down
15 changes: 15 additions & 0 deletions oacapture/mainWindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,12 @@ MainWindow::~MainWindow()
delete capturedValue;
delete fpsActualValue;
delete fpsMaxValue;
delete pixelFormatValue;
delete progressBar;
delete capturedLabel;
delete fpsActualLabel;
delete fpsMaxLabel;
delete pixelFormatLabel;
if ( state.camera ) {
delete state.camera;
}
Expand Down Expand Up @@ -1194,6 +1196,8 @@ MainWindow::createStatusBar ( void )
tempLabel->setText ( tr ( "Temp (F)" ));
}
tempLabel->setFixedWidth ( 60 );
pixelFormatLabel = new QLabel ( tr ( "Pixel format" ));
pixelFormatLabel->setFixedWidth ( 80 );
fpsMaxLabel = new QLabel ( tr ( "FPS (max)" ));
fpsMaxLabel->setFixedWidth ( 65 );
fpsActualLabel = new QLabel ( tr ( "FPS (actual)" ));
Expand All @@ -1209,6 +1213,8 @@ MainWindow::createStatusBar ( void )

tempValue = new QLabel ( "" );
tempValue->setFixedWidth ( 30 );
pixelFormatValue = new QLabel ( "" );
pixelFormatValue->setFixedWidth ( 70 );
fpsMaxValue = new QLabel ( "0" );
fpsMaxValue->setFixedWidth ( 30 );
fpsActualValue = new QLabel ( "0" );
Expand All @@ -1220,6 +1226,8 @@ MainWindow::createStatusBar ( void )

statusLine->addPermanentWidget ( tempLabel );
statusLine->addPermanentWidget ( tempValue );
statusLine->addPermanentWidget ( pixelFormatLabel );
statusLine->addPermanentWidget ( pixelFormatValue );
statusLine->addPermanentWidget ( fpsMaxLabel );
statusLine->addPermanentWidget ( fpsMaxValue );
statusLine->addPermanentWidget ( fpsActualLabel );
Expand Down Expand Up @@ -1856,6 +1864,13 @@ MainWindow::quit ( void )
}


void
MainWindow::setPixelFormatValue ( int format )
{
pixelFormatValue->setText ( QString( OA_PIX_FMT_STRING( format )));
}


void
MainWindow::showFPSMaxValue ( int value )
{
Expand Down
3 changes: 3 additions & 0 deletions oacapture/mainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class MainWindow : public QMainWindow
void clearTemperature ( void );
void resetTemperatureLabel ( void );
void clearDroppedFrames ( void );
void setPixelFormatValue ( int );
void showFPSMaxValue ( int );
void clearFPSMaxValue ( void );
void setNightStyleSheet ( QWidget* );
Expand Down Expand Up @@ -97,6 +98,7 @@ class MainWindow : public QMainWindow
QProgressBar* progressBar;
QLabel* capturedValue;
QLabel* droppedValue;
QLabel* pixelFormatValue;
QLabel* fpsMaxValue;
QLabel* fpsActualValue;
QStatusBar* statusLine;
Expand Down Expand Up @@ -128,6 +130,7 @@ class MainWindow : public QMainWindow
oaTimerDevice** timerDevs;

QLabel* tempLabel;
QLabel* pixelFormatLabel;
QLabel* fpsMaxLabel;
QLabel* fpsActualLabel;
QLabel* capturedLabel;
Expand Down
7 changes: 5 additions & 2 deletions oacapture/previewWidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ PreviewWidget::setVideoFramePixelFormat ( int format )
videoFramePixelFormat = format;
expectedSize = config.imageSizeX * config.imageSizeY *
OA_BYTES_PER_PIXEL( videoFramePixelFormat );
state.mainWindow->setPixelFormatValue( format );
}


Expand Down Expand Up @@ -426,7 +427,8 @@ PreviewWidget::processFlip ( void* imageData, int length, int format )
processFlip24BitColour ( data, length );
break;
default:
qWarning() << __FUNCTION__ << " unable to flip format " << format;
qWarning() << __FUNCTION__ << " unable to flip format " <<
OA_PIX_FMT_STRING(format);
break;
}
}
Expand Down Expand Up @@ -1025,6 +1027,7 @@ PreviewWidget::formatToCfaPattern ( int format )
return OA_DEMOSAIC_GRBG;
break;
}
qWarning() << "Invalid format in" << __FUNCTION__;
qWarning() << "Invalid format (" << OA_PIX_FMT_STRING(format) <<
") in" << __FUNCTION__;
return 0;
}
6 changes: 4 additions & 2 deletions oalive/viewWidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,8 @@ ViewWidget::processFlip ( void* imageData, int length, int format )
processFlip24BitColour ( data, length );
break;
default:
qWarning() << __FUNCTION__ << " unable to flip format " << format;
qWarning() << __FUNCTION__ << " unable to flip format " <<
OA_PIX_FMT_STRING( format );
break;
}
}
Expand Down Expand Up @@ -1340,7 +1341,8 @@ ViewWidget::formatToCfaPattern ( int format )
return OA_DEMOSAIC_GRBG;
break;
}
qWarning() << "Invalid format in" << __FUNCTION__;
qWarning() << "Invalid format (" << OA_PIX_FMT_STRING( format ) <<
") in" << __FUNCTION__;
return 0;
}

Expand Down