Format code

This commit is contained in:
jfmcarreira committed 2021-02-13 03:12:28 +00:00
1 parent 669f3db250
commit 11bf3f6bfd
64 files changed
+233 -223

No files matched your search

+1 -1
View File
@@ -27,9 +27,9 @@
#define __CALYPDEFS_H__
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <iterator>
typedef unsigned short ClpPel; ///< 16-bit pixel type
typedef unsigned char ClpByte;
+8 -7
View File
@@ -24,13 +24,13 @@
#include "CalypFrame.h"
#include <cassert>
#include <cmath>
#include "LibMemory.h"
#include "PixelFormats.h"
#include "config.h"
#include <cassert>
#include <cmath>
#ifdef USE_OPENCV
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
@@ -507,7 +507,7 @@ ClpPel CalypFrame::operator()( unsigned int ch, unsigned int xPos, unsigned int
{
retValue = d->m_pppcInputPel[ch][yPos][xPos];
if( !absolute && d->m_bHasNegativeValues )
retValue = retValue - int(d->m_uiHalfPelValue);
retValue = retValue - int( d->m_uiHalfPelValue );
}
return ClpPel( retValue );
}
@@ -735,7 +735,8 @@ void CalypFrame::fillRGBBuffer()
{
#define PEL_ARGB( a, r, g, b ) ( ( a & 0xff ) << 24 ) | ( ( r & 0xff ) << 16 ) | ( ( g & 0xff ) << 8 ) | ( b & 0xff )
#define PEL_RGB( r, g, b ) PEL_ARGB( 0xffu, r, g, b )
#define CLAMP_YUV2RGB( X ) X = X < 0 ? 0 : X > 255 ? 255 : X;
#define CLAMP_YUV2RGB( X ) X = X < 0 ? 0 : X > 255 ? 255 : \
X;
#define YUV2RGB( iY, iU, iV, iR, iG, iB ) \
iR = iY + ( ( 1436 * ( iV - 128 ) ) >> 10 ); \
iG = iY - ( ( 352 * ( iU - 128 ) + 731 * ( iV - 128 ) ) >> 10 ); \
@@ -1147,12 +1148,12 @@ double CalypFrame::getEntropy( unsigned channel, unsigned int start, unsigned in
for( unsigned b = start; b <= end; b++ )
{
if (d->m_puiHistogram[indexStart + b] == 0)
if( d->m_puiHistogram[indexStart + b] == 0 )
continue;
double prob = d->m_puiHistogram[indexStart + b] / numValues;
entropy -= prob * log2(prob);
entropy -= prob * log2( prob );
}
return entropy;
-1
View File
@@ -299,7 +299,6 @@ public:
*/
CalypPixel getPixel( unsigned int xPos, unsigned int yPos ) const;
/**
* Get pixel value at coordinates
* in the desired color space
+1 -1
View File
@@ -164,7 +164,7 @@ public:
* Module API version 3
*/
virtual CalypFrame* getProcessedFrame() { return m_pcOutputFrame; }
virtual bool needFrame() { return m_iFrameBufferCount == 0? true : false; };
virtual bool needFrame() { return m_iFrameBufferCount == 0 ? true : false; };
virtual bool flush()
{
m_iFrameBufferCount = 0;
+6 -4
View File
@@ -23,7 +23,6 @@
*/
#include "CalypFrame.h"
#include "PixelFormats.h"
#include "config.h"
@@ -51,9 +50,12 @@ static inline void yuvToRgb( const int& iY, const int& iU, const int& iV, int& i
iR = iY + ( ( 1436 * ( iV - 128 ) ) >> 10 );
iG = iY - ( ( 352 * ( iU - 128 ) + 731 * ( iV - 128 ) ) >> 10 );
iB = iY + ( ( 1812 * ( iU - 128 ) ) >> 10 );
iR = iR < 0 ? 0 : iR > 255 ? 255 : iR;
iG = iG < 0 ? 0 : iG > 255 ? 255 : iG;
iB = iB < 0 ? 0 : iB > 255 ? 255 : iB;
iR = iR < 0 ? 0 : iR > 255 ? 255 :
iR;
iG = iG < 0 ? 0 : iG > 255 ? 255 :
iG;
iB = iB < 0 ? 0 : iB > 255 ? 255 :
iB;
}
static inline void rgbToYuv( const int& iR, const int& iG, const int& iB, int& iY, int& iU, int& iV )
+30 -30
View File
@@ -56,9 +56,9 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
1,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV420P ),
{
{0, 0, 1}, /* Y */
{1, 0, 1}, /* U */
{2, 0, 1}, /* V */
{ 0, 0, 1 }, /* Y */
{ 1, 0, 1 }, /* U */
{ 2, 0, 1 }, /* V */
},
},
},
@@ -73,9 +73,9 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV422P ),
{
{0, 0, 1}, /* Y */
{1, 0, 1}, /* U */
{2, 0, 1}, /* V */
{ 0, 0, 1 }, /* Y */
{ 1, 0, 1 }, /* U */
{ 2, 0, 1 }, /* V */
},
},
},
@@ -90,9 +90,9 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV444P ),
{
{0, 0, 1}, /* Y */
{1, 0, 1}, /* U */
{2, 0, 1}, /* V */
{ 0, 0, 1 }, /* Y */
{ 1, 0, 1 }, /* U */
{ 2, 0, 1 }, /* V */
},
},
},
@@ -107,9 +107,9 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUYV422 ),
{
{0, 1, 1}, /* Y */
{0, 3, 2}, /* U */
{0, 3, 4}, /* V */
{ 0, 1, 1 }, /* Y */
{ 0, 3, 2 }, /* U */
{ 0, 3, 4 }, /* V */
},
},
},
@@ -123,7 +123,7 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0,
0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_GRAY8 ),
{{0, 0, 1}}, /* Y */
{ { 0, 0, 1 } }, /* Y */
},
},
{
@@ -137,9 +137,9 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_NONE ),
{
{0, 0, 1}, /* R */
{1, 0, 1}, /* G */
{2, 0, 1}, /* B */
{ 0, 0, 1 }, /* R */
{ 1, 0, 1 }, /* G */
{ 2, 0, 1 }, /* B */
},
},
},
@@ -154,9 +154,9 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_RGB24 ),
{
{0, 2, 1}, /* R */
{0, 2, 2}, /* G */
{0, 2, 3}, /* B */
{ 0, 2, 1 }, /* R */
{ 0, 2, 2 }, /* G */
{ 0, 2, 3 }, /* B */
},
},
},
@@ -171,9 +171,9 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_BGR24 ),
{
{0, 2, 3}, /* R */
{0, 2, 2}, /* G */
{0, 2, 1}, /* B */
{ 0, 2, 3 }, /* R */
{ 0, 2, 2 }, /* G */
{ 0, 2, 1 }, /* B */
},
},
},
@@ -188,10 +188,10 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_RGBA ),
{
{0, 3, 1}, /* R */
{0, 3, 2}, /* G */
{0, 3, 3}, /* B */
{0, 3, 4}, /* A */
{ 0, 3, 1 }, /* R */
{ 0, 3, 2 }, /* G */
{ 0, 3, 3 }, /* B */
{ 0, 3, 4 }, /* A */
},
},
},
@@ -206,10 +206,10 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_BGRA ),
{
{0, 3, 3}, /* R */
{0, 3, 2}, /* G */
{0, 3, 1}, /* B */
{0, 3, 4}, /* A */
{ 0, 3, 3 }, /* R */
{ 0, 3, 2 }, /* G */
{ 0, 3, 1 }, /* B */
{ 0, 3, 4 }, /* A */
},
},
},
+2 -2
View File
@@ -25,10 +25,10 @@
#ifndef __PIXELFORMATS_H__
#define __PIXELFORMATS_H__
#include "CalypFrame.h"
#include <map>
#include "CalypFrame.h"
#define CHROMA_RESAMPLING( X ) ( ( ( X + 1 ) >> 1 ) << 1 )
#define CHROMARATIO( SIZE, RATIO ) ( RATIO > 1 ? ( ( SIZE + 1 ) / RATIO ) : SIZE )
+3 -3
View File
@@ -24,13 +24,13 @@
#include "StreamHandlerLibav.h"
#include <cstdio>
#include <iostream>
#include "CalypFrame.h"
#include "LibMemory.h"
#include "PixelFormats.h"
#include <cstdio>
#include <iostream>
#if( ( LIBAVCODEC_VERSION_MAJOR > 57 ) || ( LIBAVCODEC_VERSION_MAJOR == 57 ) && ( LIBAVCODEC_VERSION_MINOR >= 37 ) )
#define FF_SEND_RECEIVE_API
#define FF_USER_CODEC_PARAM
+1
View File
@@ -27,6 +27,7 @@
#define __STREAMHANDLERLIBAV_H__
#include <inttypes.h>
#include <string>
#include <vector>
+3 -3
View File
@@ -24,11 +24,11 @@
#include "StreamHandlerOpenCV.h"
#include "CalypFrame.h"
#include "LibMemory.h"
#include <cstdio>
#include <opencv2/opencv.hpp>
#include "CalypFrame.h"
#include "LibMemory.h"
#if CV_MAJOR_VERSION >= 3
#include <opencv2/videoio.hpp>
#endif
+3 -3
View File
@@ -24,12 +24,12 @@
#include "StreamHandlerPortableMap.h"
#include "CalypFrame.h"
#include "LibMemory.h"
#include <cmath>
#include <cstdio>
#include "CalypFrame.h"
#include "LibMemory.h"
std::vector<CalypStreamFormat> StreamHandlerPortableMap::supportedReadFormats()
{
INI_REGIST_CALYP_SUPPORTED_FMT;
+2 -2
View File
@@ -24,11 +24,11 @@
#include "StreamHandlerRaw.h"
#include <cstdio>
#include "CalypFrame.h"
#include "LibMemory.h"
#include <cstdio>
std::vector<CalypStreamFormat> StreamHandlerRaw::supportedReadFormats()
{
INI_REGIST_CALYP_SUPPORTED_FMT;