1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

Coding - Isolate long attached comments for clang-format #259

Automatically update code with clang-format disabling for avoiding formatting.
You can check the python script in GitHub PR
This commit is contained in:
dpasukhi
2025-01-16 20:15:29 +00:00
parent 9a6854774d
commit f91655b0c5
475 changed files with 1380 additions and 8 deletions

View File

@@ -403,7 +403,9 @@ namespace
case Image_Format_RGB: return GUID_WICPixelFormat24bppRGB;
case Image_Format_BGR: return GUID_WICPixelFormat24bppBGR;
case Image_Format_Gray: return GUID_WICPixelFormat8bppGray;
// clang-format off
case Image_Format_Alpha: return GUID_WICPixelFormat8bppGray; // GUID_WICPixelFormat8bppAlpha
// clang-format on
case Image_Format_Gray16: return GUID_WICPixelFormat16bppGray;
case Image_Format_GrayF: // GUID_WICPixelFormat32bppGrayFloat
case Image_Format_AlphaF:

View File

@@ -101,7 +101,9 @@ protected:
Standard_Integer mySizeY; //!< surface height
Image_Format myBaseFormat; //!< base (uncompressed) pixel format
Image_CompressedFormat myFormat; //!< compressed format
// clang-format off
Standard_Boolean myIsCompleteMips; //!< flag indicating complete mip map level set (up to 1x1 resolution)
// clang-format on
};

View File

@@ -140,9 +140,11 @@ protected:
Handle(Image_PixMap) myImageRef; //!< reference image to compare (from)
Handle(Image_PixMap) myImageNew; //!< new image to compare (to)
// clang-format off
Standard_Real myColorTolerance; //!< tolerance for equality check (0..1, 0 - any not equal, 1 - opposite colors)
Standard_Boolean myIsBorderFilterOn; //!< perform algorithm with border effect filter
// clang-format on
//! coordinates of different pixels, packed in one int using 16-bit integers to save memory
NCollection_Vector<Standard_Integer> myDiffPixels;

View File

@@ -309,7 +309,9 @@ Quantity_ColorRGBA Image_PixMap::ColorFromRawPixel (const Standard_Byte* theRawV
case Image_Format_GrayF:
{
const Standard_ShortReal& aPixel = *reinterpret_cast<const Standard_ShortReal*> (theRawValue);
// clang-format off
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel, aPixel, aPixel, 1.0f)); // opaque
// clang-format on
}
case Image_Format_AlphaF:
{
@@ -334,12 +336,14 @@ Quantity_ColorRGBA Image_PixMap::ColorFromRawPixel (const Standard_Byte* theRawV
case Image_Format_RGBF:
{
const Image_ColorRGBF& aPixel = *reinterpret_cast<const Image_ColorRGBF*> (theRawValue);
// clang-format off
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), aPixel.b(), 1.0f)); // opaque
}
case Image_Format_BGRF:
{
const Image_ColorBGRF& aPixel = *reinterpret_cast<const Image_ColorBGRF*> (theRawValue);
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), aPixel.b(), 1.0f)); // opaque
// clang-format on
}
case Image_Format_GrayF_half:
{

View File

@@ -476,8 +476,10 @@ public:
const uint32_t m = (theHalf & 0x03FF) << 13; // mantissa
FloatUint32 mf, aRes;
mf.Float32 = (float )m;
// clang-format off
const uint32_t v = mf.UInt32 >> 23; // evil log2 bit hack to count leading zeros in denormalized format
aRes.UInt32 = (theHalf & 0x8000)<<16 | (e != 0) * ((e + 112) << 23 | m) | ((e == 0) & (m != 0)) * ((v - 37) << 23 | ((m << (150 - v)) & 0x007FE000)); // sign : normalized : denormalized
// clang-format on
return aRes.Float32;
}
@@ -488,11 +490,13 @@ public:
union FloatUint32 { float Float32; uint32_t UInt32; };
FloatUint32 anInput;
anInput.Float32 = theFloat;
// clang-format off
const uint32_t b = anInput.UInt32 + 0x00001000; // round-to-nearest-even: add last bit after truncated mantissa
const uint32_t e = (b & 0x7F800000) >> 23; // exponent
const uint32_t m = b & 0x007FFFFF; // mantissa; in line below: 0x007FF000 = 0x00800000-0x00001000 = decimal indicator flag - initial rounding
return (uint16_t)((b & 0x80000000) >> 16 | (e > 112) * ((((e - 112) << 10) & 0x7C00) | m >> 13)
| ((e < 113) & (e > 101)) * ((((0x007FF000 + m) >> (125 - e)) + 1) >> 1) | (e > 143) * 0x7FFF); // sign : normalized : denormalized : saturate
// clang-format on
}
protected:

View File

@@ -197,7 +197,9 @@ public:
protected:
// clang-format off
Standard_Byte* myTopRowPtr; //!< pointer to the topmost row (depending on scanlines order in memory)
// clang-format on
public:

View File

@@ -56,7 +56,9 @@ public:
protected:
NCollection_Array1<bool> myFormats; //!< list of supported formats
// clang-format off
Standard_Boolean myHasCompressed; //!< flag indicating that some compressed image formats are supported
// clang-format on
};

View File

@@ -330,8 +330,10 @@ Standard_Boolean Image_VideoRecorder::openVideoCodec (const Image_VideoParams& t
|| aCodecCtx->codec == avcodec_find_encoder_by_name ("libx264"))
{
// use CRF (Constant Rate Factor) as best single-pass compressing method
// clang-format off
av_dict_set (&anOptions, "crf", "20", 0); // quality 18-28, 23 is default (normal), 18 is almost lossless
av_dict_set (&anOptions, "preset", "slow", 0); // good compression (see also "veryslow", "ultrafast")
// clang-format on
// live-capturing
//av_dict_set (&anOptions, "qp", "0", 0); // instead of crf

View File

@@ -39,9 +39,11 @@ struct SwsContext;
//! Please refer to FFmpeg documentation for defining text values.
struct Image_VideoParams
{
// clang-format off
TCollection_AsciiString Format; //!< [optional] video format (container), if empty - will be determined from the file name
TCollection_AsciiString VideoCodec; //!< [optional] codec identifier, if empty - default codec from file format will be used
TCollection_AsciiString PixelFormat; //!< [optional] pixel format, if empty - default codec pixel format will be used
// clang-format on
Standard_Integer Width; //!< [mandatory] video frame width
Standard_Integer Height; //!< [mandatory] video frame height
Standard_Integer FpsNum; //!< [mandatory] framerate numerator