Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-10-10 10:19:55 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-10-10 14:04:51 +0300
commit2abfcebb0eb7989e3d1e7d03f37ecf5c088210af (patch)
treee7a1ad5912b4661d4ece743f4f7fd86e6bf4d3c4 /source/blender/imbuf
parentc735aca42e9f5961fec7e5d5fc196b5bd6b85f56 (diff)
Cleanup: use C comments for descriptive text
Follow our code style guide by using C-comments for text descriptions.
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/intern/IMB_anim.h8
-rw-r--r--source/blender/imbuf/intern/anim_movie.c4
-rw-r--r--source/blender/imbuf/intern/cineon/logImageCore.c2
-rw-r--r--source/blender/imbuf/intern/dds/BlockDXT.cpp172
-rw-r--r--source/blender/imbuf/intern/dds/BlockDXT.h82
-rw-r--r--source/blender/imbuf/intern/dds/Color.h2
-rw-r--r--source/blender/imbuf/intern/dds/ColorBlock.cpp30
-rw-r--r--source/blender/imbuf/intern/dds/ColorBlock.h4
-rw-r--r--source/blender/imbuf/intern/dds/DirectDrawSurface.cpp160
-rw-r--r--source/blender/imbuf/intern/dds/DirectDrawSurface.h48
-rw-r--r--source/blender/imbuf/intern/dds/FlipDXT.cpp114
-rw-r--r--source/blender/imbuf/intern/dds/Image.cpp4
-rw-r--r--source/blender/imbuf/intern/dds/Image.h2
-rw-r--r--source/blender/imbuf/intern/dds/PixelFormat.h66
-rw-r--r--source/blender/imbuf/intern/dds/Stream.cpp10
-rw-r--r--source/blender/imbuf/intern/dds/Stream.h8
-rw-r--r--source/blender/imbuf/intern/dds/dds_api.cpp6
-rw-r--r--source/blender/imbuf/intern/oiio/openimageio_api.cpp2
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp29
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_multi.h2
-rw-r--r--source/blender/imbuf/intern/scaling.c2
21 files changed, 386 insertions, 371 deletions
diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h
index babff5c34cd..1239d3881de 100644
--- a/source/blender/imbuf/intern/IMB_anim.h
+++ b/source/blender/imbuf/intern/IMB_anim.h
@@ -32,9 +32,9 @@
# include <windows.h>
# include <windowsx.h>
-# undef AVIIF_KEYFRAME // redefined in AVI_avi.h
-# undef AVIIF_LIST // redefined in AVI_avi.h
-#endif /* _WIN32 */
+# undef AVIIF_KEYFRAME /* redefined in AVI_avi.h */
+# undef AVIIF_LIST /* redefined in AVI_avi.h */
+#endif /* _WIN32 */
#include <ctype.h>
#include <stdio.h>
@@ -117,7 +117,7 @@ struct anim {
int firstvideo;
int pfileopen;
PAVIFILE pfile;
- PAVISTREAM pavi[MAXNUMSTREAMS]; // the current streams
+ PAVISTREAM pavi[MAXNUMSTREAMS]; /* the current streams */
PGETFRAME pgf;
#endif
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index f5ae602946e..d825b20f5f2 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -82,7 +82,7 @@
# include <libswscale/swscale.h>
# include "ffmpeg_compat.h"
-#endif // WITH_FFMPEG
+#endif /* WITH_FFMPEG */
int ismovie(const char *UNUSED(filepath))
{
@@ -467,7 +467,7 @@ static ImBuf *avi_fetchibuf(struct anim *anim, int position)
if (lpbi) {
ibuf = IMB_ibImageFromMemory(
(const unsigned char *)lpbi, 100, IB_rect, anim->colorspace, "<avi_fetchibuf>");
- // Oh brother...
+ /* Oh brother... */
}
}
}
diff --git a/source/blender/imbuf/intern/cineon/logImageCore.c b/source/blender/imbuf/intern/cineon/logImageCore.c
index 74a0684c35c..446f360a3e7 100644
--- a/source/blender/imbuf/intern/cineon/logImageCore.c
+++ b/source/blender/imbuf/intern/cineon/logImageCore.c
@@ -1689,7 +1689,7 @@ static int convertLogElementToRGBA(
if (dstIsLinearRGB) {
/* convert data from sRGB to Linear RGB via lut */
float *lut = getSrgbToLinLut(logElement);
- src_ptr = dst; // no error here
+ src_ptr = dst; /* no error here */
dst_ptr = dst;
for (i = 0; i < logImage->width * logImage->height; i++) {
*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp
index 8978b823e2a..2d9c300a147 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.cpp
+++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp
@@ -25,28 +25,28 @@
* Original license from NVIDIA follows.
*/
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
+/* Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE. */
#include <BlockDXT.h>
#include <ColorBlock.h>
@@ -59,32 +59,32 @@
uint BlockDXT1::evaluatePalette(Color32 color_array[4]) const
{
- // Does bit expansion before interpolation.
+ /* Does bit expansion before interpolation. */
color_array[0].b = (col0.b << 3) | (col0.b >> 2);
color_array[0].g = (col0.g << 2) | (col0.g >> 4);
color_array[0].r = (col0.r << 3) | (col0.r >> 2);
color_array[0].a = 0xFF;
- // @@ Same as above, but faster?
- // Color32 c;
- // c.u = ((col0.u << 3) & 0xf8) | ((col0.u << 5) & 0xfc00) | ((col0.u << 8) & 0xf80000);
- // c.u |= (c.u >> 5) & 0x070007;
- // c.u |= (c.u >> 6) & 0x000300;
- // color_array[0].u = c.u;
+ /* @@ Same as above, but faster?
+ * Color32 c;
+ * c.u = ((col0.u << 3) & 0xf8) | ((col0.u << 5) & 0xfc00) | ((col0.u << 8) & 0xf80000);
+ * c.u |= (c.u >> 5) & 0x070007;
+ * c.u |= (c.u >> 6) & 0x000300;
+ * color_array[0].u = c.u; */
color_array[1].r = (col1.r << 3) | (col1.r >> 2);
color_array[1].g = (col1.g << 2) | (col1.g >> 4);
color_array[1].b = (col1.b << 3) | (col1.b >> 2);
color_array[1].a = 0xFF;
- // @@ Same as above, but faster?
- // c.u = ((col1.u << 3) & 0xf8) | ((col1.u << 5) & 0xfc00) | ((col1.u << 8) & 0xf80000);
- // c.u |= (c.u >> 5) & 0x070007;
- // c.u |= (c.u >> 6) & 0x000300;
- // color_array[1].u = c.u;
+ /* @@ Same as above, but faster?
+ * c.u = ((col1.u << 3) & 0xf8) | ((col1.u << 5) & 0xfc00) | ((col1.u << 8) & 0xf80000);
+ * c.u |= (c.u >> 5) & 0x070007;
+ * c.u |= (c.u >> 6) & 0x000300;
+ * color_array[1].u = c.u; */
if (col0.u > col1.u) {
- // Four-color block: derive the other two colors.
+ /* Four-color block: derive the other two colors. */
color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3;
color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3;
color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3;
@@ -98,16 +98,16 @@ uint BlockDXT1::evaluatePalette(Color32 color_array[4]) const
return 4;
}
- // Three-color block: derive the other color.
+ /* Three-color block: derive the other color. */
color_array[2].r = (color_array[0].r + color_array[1].r) / 2;
color_array[2].g = (color_array[0].g + color_array[1].g) / 2;
color_array[2].b = (color_array[0].b + color_array[1].b) / 2;
color_array[2].a = 0xFF;
- // Set all components to 0 to match DXT specs.
- color_array[3].r = 0x00; // color_array[2].r;
- color_array[3].g = 0x00; // color_array[2].g;
- color_array[3].b = 0x00; // color_array[2].b;
+ /* Set all components to 0 to match DXT specs. */
+ color_array[3].r = 0x00; /* color_array[2].r; */
+ color_array[3].g = 0x00; /* color_array[2].g; */
+ color_array[3].b = 0x00; /* color_array[2].b; */
color_array[3].a = 0x00;
return 3;
@@ -115,7 +115,7 @@ uint BlockDXT1::evaluatePalette(Color32 color_array[4]) const
uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const
{
- // Does bit expansion before interpolation.
+ /* Does bit expansion before interpolation. */
color_array[0].b = (3 * col0.b * 22) / 8;
color_array[0].g = (col0.g << 2) | (col0.g >> 4);
color_array[0].r = (3 * col0.r * 22) / 8;
@@ -129,7 +129,7 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const
int gdiff = color_array[1].g - color_array[0].g;
if (col0.u > col1.u) {
- // Four-color block: derive the other two colors.
+ /* Four-color block: derive the other two colors. */
color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8;
color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256;
color_array[2].b = ((2 * col0.b + col1.b) * 22) / 8;
@@ -143,22 +143,22 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const
return 4;
}
- // Three-color block: derive the other color.
+ /* Three-color block: derive the other color. */
color_array[2].r = ((col0.r + col1.r) * 33) / 8;
color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256;
color_array[2].b = ((col0.b + col1.b) * 33) / 8;
color_array[2].a = 0xFF;
- // Set all components to 0 to match DXT specs.
- color_array[3].r = 0x00; // color_array[2].r;
- color_array[3].g = 0x00; // color_array[2].g;
- color_array[3].b = 0x00; // color_array[2].b;
+ /* Set all components to 0 to match DXT specs. */
+ color_array[3].r = 0x00; /* color_array[2].r; */
+ color_array[3].g = 0x00; /* color_array[2].g; */
+ color_array[3].b = 0x00; /* color_array[2].b; */
color_array[3].a = 0x00;
return 3;
}
-// Evaluate palette assuming 3 color block.
+/* Evaluate palette assuming 3 color block. */
void BlockDXT1::evaluatePalette3(Color32 color_array[4]) const
{
color_array[0].b = (col0.b << 3) | (col0.b >> 2);
@@ -171,20 +171,20 @@ void BlockDXT1::evaluatePalette3(Color32 color_array[4]) const
color_array[1].b = (col1.b << 3) | (col1.b >> 2);
color_array[1].a = 0xFF;
- // Three-color block: derive the other color.
+ /* Three-color block: derive the other color. */
color_array[2].r = (color_array[0].r + color_array[1].r) / 2;
color_array[2].g = (color_array[0].g + color_array[1].g) / 2;
color_array[2].b = (color_array[0].b + color_array[1].b) / 2;
color_array[2].a = 0xFF;
- // Set all components to 0 to match DXT specs.
- color_array[3].r = 0x00; // color_array[2].r;
- color_array[3].g = 0x00; // color_array[2].g;
- color_array[3].b = 0x00; // color_array[2].b;
+ /* Set all components to 0 to match DXT specs. */
+ color_array[3].r = 0x00; /* color_array[2].r; */
+ color_array[3].g = 0x00; /* color_array[2].g; */
+ color_array[3].b = 0x00; /* color_array[2].b; */
color_array[3].a = 0x00;
}
-// Evaluate palette assuming 4 color block.
+/* Evaluate palette assuming 4 color block. */
void BlockDXT1::evaluatePalette4(Color32 color_array[4]) const
{
color_array[0].b = (col0.b << 3) | (col0.b >> 2);
@@ -197,7 +197,7 @@ void BlockDXT1::evaluatePalette4(Color32 color_array[4]) const
color_array[1].b = (col1.b << 3) | (col1.b >> 2);
color_array[1].a = 0xFF;
- // Four-color block: derive the other two colors.
+ /* Four-color block: derive the other two colors. */
color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3;
color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3;
color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3;
@@ -211,11 +211,11 @@ void BlockDXT1::evaluatePalette4(Color32 color_array[4]) const
void BlockDXT1::decodeBlock(ColorBlock *block) const
{
- // Decode color block.
+ /* Decode color block. */
Color32 color_array[4];
evaluatePalette(color_array);
- // Write color block.
+ /* Write color block. */
for (uint j = 0; j < 4; j++) {
for (uint i = 0; i < 4; i++) {
uint idx = (row[j] >> (2 * i)) & 3;
@@ -226,11 +226,11 @@ void BlockDXT1::decodeBlock(ColorBlock *block) const
void BlockDXT1::decodeBlockNV5x(ColorBlock *block) const
{
- // Decode color block.
+ /* Decode color block. */
Color32 color_array[4];
evaluatePaletteNV5x(color_array);
- // Write color block.
+ /* Write color block. */
for (uint j = 0; j < 4; j++) {
for (uint i = 0; i < 4; i++) {
uint idx = (row[j] >> (2 * i)) & 3;
@@ -266,10 +266,10 @@ inline void BlockDXT1::flip2()
void BlockDXT3::decodeBlock(ColorBlock *block) const
{
- // Decode color.
+ /* Decode color. */
color.decodeBlock(block);
- // Decode alpha.
+ /* Decode alpha. */
alpha.decodeBlock(block);
}
@@ -342,30 +342,30 @@ void AlphaBlockDXT5::evaluatePalette(uint8 alpha[8]) const
void AlphaBlockDXT5::evaluatePalette8(uint8 alpha[8]) const
{
- // 8-alpha block: derive the other six alphas.
- // Bit code 000 = alpha0, 001 = alpha1, others are interpolated.
+ /* 8-alpha block: derive the other six alphas.
+ * Bit code 000 = alpha0, 001 = alpha1, others are interpolated. */
alpha[0] = alpha0();
alpha[1] = alpha1();
- alpha[2] = (6 * alpha[0] + 1 * alpha[1]) / 7; // bit code 010
- alpha[3] = (5 * alpha[0] + 2 * alpha[1]) / 7; // bit code 011
- alpha[4] = (4 * alpha[0] + 3 * alpha[1]) / 7; // bit code 100
- alpha[5] = (3 * alpha[0] + 4 * alpha[1]) / 7; // bit code 101
- alpha[6] = (2 * alpha[0] + 5 * alpha[1]) / 7; // bit code 110
- alpha[7] = (1 * alpha[0] + 6 * alpha[1]) / 7; // bit code 111
+ alpha[2] = (6 * alpha[0] + 1 * alpha[1]) / 7; /* bit code 010 */
+ alpha[3] = (5 * alpha[0] + 2 * alpha[1]) / 7; /* bit code 011 */
+ alpha[4] = (4 * alpha[0] + 3 * alpha[1]) / 7; /* bit code 100 */
+ alpha[5] = (3 * alpha[0] + 4 * alpha[1]) / 7; /* bit code 101 */
+ alpha[6] = (2 * alpha[0] + 5 * alpha[1]) / 7; /* bit code 110 */
+ alpha[7] = (1 * alpha[0] + 6 * alpha[1]) / 7; /* bit code 111 */
}
void AlphaBlockDXT5::evaluatePalette6(uint8 alpha[8]) const
{
- // 6-alpha block.
- // Bit code 000 = alpha0, 001 = alpha1, others are interpolated.
+ /* 6-alpha block.
+ * Bit code 000 = alpha0, 001 = alpha1, others are interpolated. */
alpha[0] = alpha0();
alpha[1] = alpha1();
- alpha[2] = (4 * alpha[0] + 1 * alpha[1]) / 5; // Bit code 010
- alpha[3] = (3 * alpha[0] + 2 * alpha[1]) / 5; // Bit code 011
- alpha[4] = (2 * alpha[0] + 3 * alpha[1]) / 5; // Bit code 100
- alpha[5] = (1 * alpha[0] + 4 * alpha[1]) / 5; // Bit code 101
- alpha[6] = 0x00; // Bit code 110
- alpha[7] = 0xFF; // Bit code 111
+ alpha[2] = (4 * alpha[0] + 1 * alpha[1]) / 5; /* Bit code 010 */
+ alpha[3] = (3 * alpha[0] + 2 * alpha[1]) / 5; /* Bit code 011 */
+ alpha[4] = (2 * alpha[0] + 3 * alpha[1]) / 5; /* Bit code 100 */
+ alpha[5] = (1 * alpha[0] + 4 * alpha[1]) / 5; /* Bit code 101 */
+ alpha[6] = 0x00; /* Bit code 110 */
+ alpha[7] = 0xFF; /* Bit code 111 */
}
void AlphaBlockDXT5::indices(uint8 index_array[16]) const
@@ -418,7 +418,7 @@ void AlphaBlockDXT5::flip4()
{
uint64 *b = (uint64 *)this;
- // @@ The masks might have to be byte swapped.
+ /* @@ The masks might have to be byte swapped. */
uint64 tmp = (*b & (uint64)(0x000000000000FFFFLL));
tmp |= (*b & (uint64)(0x000000000FFF0000LL)) << 36;
tmp |= (*b & (uint64)(0x000000FFF0000000LL)) << 12;
@@ -432,7 +432,7 @@ void AlphaBlockDXT5::flip2()
{
uint *b = (uint *)this;
- // @@ The masks might have to be byte swapped.
+ /* @@ The masks might have to be byte swapped. */
uint tmp = (*b & 0xFF000000);
tmp |= (*b & 0x00000FFF) << 12;
tmp |= (*b & 0x00FFF000) >> 12;
@@ -442,19 +442,19 @@ void AlphaBlockDXT5::flip2()
void BlockDXT5::decodeBlock(ColorBlock *block) const
{
- // Decode color.
+ /* Decode color. */
color.decodeBlock(block);
- // Decode alpha.
+ /* Decode alpha. */
alpha.decodeBlock(block);
}
void BlockDXT5::decodeBlockNV5x(ColorBlock *block) const
{
- // Decode color.
+ /* Decode color. */
color.decodeBlockNV5x(block);
- // Decode alpha.
+ /* Decode alpha. */
alpha.decodeBlock(block);
}
@@ -541,7 +541,7 @@ void BlockATI2::flip2()
void BlockCTX1::evaluatePalette(Color32 color_array[4]) const
{
- // Does bit expansion before interpolation.
+ /* Does bit expansion before interpolation. */
color_array[0].b = 0x00;
color_array[0].g = col0[1];
color_array[0].r = col0[0];
@@ -565,11 +565,11 @@ void BlockCTX1::evaluatePalette(Color32 color_array[4]) const
void BlockCTX1::decodeBlock(ColorBlock *block) const
{
- // Decode color block.
+ /* Decode color block. */
Color32 color_array[4];
evaluatePalette(color_array);
- // Write color block.
+ /* Write color block. */
for (uint j = 0; j < 4; j++) {
for (uint i = 0; i < 4; i++) {
uint idx = (row[j] >> (2 * i)) & 3;
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.h b/source/blender/imbuf/intern/dds/BlockDXT.h
index 83cc147c76c..1fefa7c739d 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.h
+++ b/source/blender/imbuf/intern/dds/BlockDXT.h
@@ -25,28 +25,28 @@
* Original license from NVIDIA follows.
*/
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
+/* Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE. */
#pragma once
@@ -131,28 +131,28 @@ struct BlockDXT3 {
/** DXT5 alpha block. */
struct AlphaBlockDXT5 {
- // uint64 unions do not compile on all platforms
+ /* uint64 unions do not compile on all platforms */
#if 0
union {
struct {
- uint64 alpha0 : 8; // 8
- uint64 alpha1 : 8; // 16
- uint64 bits0 : 3; // 3 - 19
- uint64 bits1 : 3; // 6 - 22
- uint64 bits2 : 3; // 9 - 25
- uint64 bits3 : 3; // 12 - 28
- uint64 bits4 : 3; // 15 - 31
- uint64 bits5 : 3; // 18 - 34
- uint64 bits6 : 3; // 21 - 37
- uint64 bits7 : 3; // 24 - 40
- uint64 bits8 : 3; // 27 - 43
- uint64 bits9 : 3; // 30 - 46
- uint64 bitsA : 3; // 33 - 49
- uint64 bitsB : 3; // 36 - 52
- uint64 bitsC : 3; // 39 - 55
- uint64 bitsD : 3; // 42 - 58
- uint64 bitsE : 3; // 45 - 61
- uint64 bitsF : 3; // 48 - 64
+ uint64 alpha0 : 8; /* 8 */
+ uint64 alpha1 : 8; /* 16 */
+ uint64 bits0 : 3; /* 3 - 19 */
+ uint64 bits1 : 3; /* 6 - 22 */
+ uint64 bits2 : 3; /* 9 - 25 */
+ uint64 bits3 : 3; /* 12 - 28 */
+ uint64 bits4 : 3; /* 15 - 31 */
+ uint64 bits5 : 3; /* 18 - 34 */
+ uint64 bits6 : 3; /* 21 - 37 */
+ uint64 bits7 : 3; /* 24 - 40 */
+ uint64 bits8 : 3; /* 27 - 43 */
+ uint64 bits9 : 3; /* 30 - 46 */
+ uint64 bitsA : 3; /* 33 - 49 */
+ uint64 bitsB : 3; /* 36 - 52 */
+ uint64 bitsC : 3; /* 39 - 55 */
+ uint64 bitsD : 3; /* 42 - 58 */
+ uint64 bitsE : 3; /* 45 - 61 */
+ uint64 bitsF : 3; /* 48 - 64 */
};
uint64 u;
};
diff --git a/source/blender/imbuf/intern/dds/Color.h b/source/blender/imbuf/intern/dds/Color.h
index 4a9202617f5..03d49391e59 100644
--- a/source/blender/imbuf/intern/dds/Color.h
+++ b/source/blender/imbuf/intern/dds/Color.h
@@ -25,7 +25,7 @@
* Original license from NVIDIA follows.
*/
-// This code is in the public domain -- castanyo@yahoo.es
+/* This code is in the public domain -- <castanyo@yahoo.es> */
#pragma once
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp
index f2e8e0b0313..7c8b7c1d345 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.cpp
+++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp
@@ -25,20 +25,20 @@
* Original license from NVIDIA follows.
*/
-// This code is in the public domain -- castanyo@yahoo.es
+/* This code is in the public domain - <castanyo@yahoo.es> */
#include <ColorBlock.h>
#include <Common.h>
#include <Image.h>
#if 0
-// Get approximate luminance.
+/* Get approximate luminance. */
inline static uint colorLuminance(Color32 c)
{
return c.r + c.g + c.b;
}
-// Get the euclidean distance between the given colors.
+/* Get the euclidean distance between the given colors. */
inline static uint colorDistance(Color32 c0, Color32 c1)
{
return (c0.r - c1.r) * (c0.r - c1.r) + (c0.g - c1.g) * (c0.g - c1.g) +
@@ -83,9 +83,9 @@ void ColorBlock::init(uint w, uint h, const uint *data, uint x, uint y)
const uint bw = MIN(w - x, 4U);
const uint bh = MIN(h - y, 4U);
- // Blocks that are smaller than 4x4 are handled by repeating the pixels.
- // @@ That's only correct when block size is 1, 2 or 4, but not with 3. :(
- // @@ Ideally we should zero the weights of the pixels out of range.
+ /* Blocks that are smaller than 4x4 are handled by repeating the pixels.
+ * @@ That's only correct when block size is 1, 2 or 4, but not with 3. :(
+ * @@ Ideally we should zero the weights of the pixels out of range. */
for (uint i = 0; i < 4; i++) {
const int by = i % bh;
@@ -104,9 +104,9 @@ void ColorBlock::init(uint w, uint h, const float *data, uint x, uint y)
const uint bw = MIN(w - x, 4U);
const uint bh = MIN(h - y, 4U);
- // Blocks that are smaller than 4x4 are handled by repeating the pixels.
- // @@ That's only correct when block size is 1, 2 or 4, but not with 3. :(
- // @@ Ideally we should zero the weights of the pixels out of range.
+ /* Blocks that are smaller than 4x4 are handled by repeating the pixels.
+ * @@ That's only correct when block size is 1, 2 or 4, but not with 3. :(
+ * @@ Ideally we should zero the weights of the pixels out of range. */
uint srcPlane = w * h;
@@ -120,7 +120,7 @@ void ColorBlock::init(uint w, uint h, const float *data, uint x, uint y)
Color32 &c = color(e, i);
c.r = uint8(255 * CLAMP(data[idx + 0 * srcPlane],
0.0f,
- 1.0f)); // @@ Is this the right way to quantize floats to bytes?
+ 1.0f)); /* @@ Is this the right way to quantize floats to bytes? */
c.g = uint8(255 * CLAMP(data[idx + 1 * srcPlane], 0.0f, 1.0f));
c.b = uint8(255 * CLAMP(data[idx + 2 * srcPlane], 0.0f, 1.0f));
c.a = uint8(255 * CLAMP(data[idx + 3 * srcPlane], 0.0f, 1.0f));
@@ -204,7 +204,7 @@ uint ColorBlock::countUniqueColors() const
{
uint count = 0;
- // @@ This does not have to be o(n^2)
+ /* @@ This does not have to be o(n^2) */
for (int i = 0; i < 16; i++) {
bool unique = true;
for (int j = 0; j < i; j++) {
@@ -326,7 +326,7 @@ void ColorBlock::boundsRange(Color32 *start, Color32 *end) const
}
}
- // Offset range by 1/16 of the extents
+ /* Offset range by 1/16 of the extents */
Color32 inset;
inset.r = (maxColor.r - minColor.r) >> 4;
inset.g = (maxColor.g - minColor.g) >> 4;
@@ -377,7 +377,7 @@ void ColorBlock::boundsRangeAlpha(Color32 *start, Color32 *end) const
}
}
- // Offset range by 1/16 of the extents
+ /* Offset range by 1/16 of the extents */
Color32 inset;
inset.r = (maxColor.r - minColor.r) >> 4;
inset.g = (maxColor.g - minColor.g) >> 4;
@@ -403,7 +403,7 @@ void ColorBlock::boundsRangeAlpha(Color32 *start, Color32 *end) const
/** Sort colors by abosolute value in their 16 bit representation. */
void ColorBlock::sortColorsByAbsoluteValue()
{
- // Dummy selection sort.
+ /* Dummy selection sort. */
for (uint a = 0; a < 16; a++) {
uint max = a;
Color16 cmax(m_color[a]);
@@ -462,7 +462,7 @@ void ColorBlock::sortColors(const Vector3 &axis)
luma_array[i] = dot(vec, axis);
}
- // Dummy selection sort.
+ /* Dummy selection sort. */
for (uint a = 0; a < 16; a++) {
uint min = a;
for (uint b = a + 1; b < 16; b++) {
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.h b/source/blender/imbuf/intern/dds/ColorBlock.h
index 98b4c9cb40a..0271c7964b8 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.h
+++ b/source/blender/imbuf/intern/dds/ColorBlock.h
@@ -43,12 +43,12 @@ struct ColorBlock {
void init(uint w, uint h, const uint *data, uint x, uint y);
void init(uint w, uint h, const float *data, uint x, uint y);
- void swizzle(uint x, uint y, uint z, uint w); // 0=r, 1=g, 2=b, 3=a, 4=0xFF, 5=0
+ void swizzle(uint x, uint y, uint z, uint w); /* 0=r, 1=g, 2=b, 3=a, 4=0xFF, 5=0 */
bool isSingleColor(Color32 mask = Color32(0xFF, 0xFF, 0xFF, 0x00)) const;
bool hasAlpha() const;
- // Accessors
+ /* Accessors */
const Color32 *colors() const;
Color32 color(uint i) const;
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
index 7ec059607c5..3e459934db7 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
@@ -25,36 +25,36 @@
* Original license from NVIDIA follows.
*/
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
+/* Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE. */
#include <BlockDXT.h>
#include <DirectDrawSurface.h>
#include <PixelFormat.h>
-#include <math.h> // sqrt
-#include <stdio.h> // printf
-#include <stdlib.h> // malloc
+#include <math.h> /* sqrt */
+#include <stdio.h> /* printf */
+#include <stdlib.h> /* malloc */
#include <sys/types.h>
/*** declarations ***/
@@ -76,13 +76,15 @@ static const uint FOURCC_RXGB = DDS_MAKEFOURCC('R', 'X', 'G', 'B');
static const uint FOURCC_ATI1 = DDS_MAKEFOURCC('A', 'T', 'I', '1');
static const uint FOURCC_ATI2 = DDS_MAKEFOURCC('A', 'T', 'I', '2');
-// static const uint FOURCC_A2XY = DDS_MAKEFOURCC('A', '2', 'X', 'Y');
+#if 0 /* Valid but currently unused. */
+static const uint FOURCC_A2XY = DDS_MAKEFOURCC('A', '2', 'X', 'Y');
+#endif
static const uint FOURCC_DX10 = DDS_MAKEFOURCC('D', 'X', '1', '0');
static const uint FOURCC_UVER = DDS_MAKEFOURCC('U', 'V', 'E', 'R');
-// 32 bit RGB formats.
+/* 32 bit RGB formats. */
static const uint D3DFMT_R8G8B8 = 20;
static const uint D3DFMT_A8R8G8B8 = 21;
static const uint D3DFMT_X8R8G8B8 = 22;
@@ -100,25 +102,33 @@ static const uint D3DFMT_X8B8G8R8 = 33;
static const uint D3DFMT_G16R16 = 34;
static const uint D3DFMT_A2R10G10B10 = 35;
-// static const uint D3DFMT_A16B16G16R16 = 36;
+#if 0 /* Valid but currently unused. */
+static const uint D3DFMT_A16B16G16R16 = 36;
+#endif
-// Palette formats.
-// static const uint D3DFMT_A8P8 = 40;
-// static const uint D3DFMT_P8 = 41;
+/* Palette formats. */
+#if 0 /* Valid but currently unused. */
+static const uint D3DFMT_A8P8 = 40;
+static const uint D3DFMT_P8 = 41;
+#endif
-// Luminance formats.
+/* Luminance formats. */
static const uint D3DFMT_L8 = 50;
-// static const uint D3DFMT_A8L8 = 51;
-// static const uint D3DFMT_A4L4 = 52;
+#if 0 /* Valid but currently unused. */
+static const uint D3DFMT_A8L8 = 51;
+static const uint D3DFMT_A4L4 = 52;
+#endif
static const uint D3DFMT_L16 = 81;
-// Floating point formats
-// static const uint D3DFMT_R16F = 111;
-// static const uint D3DFMT_G16R16F = 112;
-// static const uint D3DFMT_A16B16G16R16F = 113;
-// static const uint D3DFMT_R32F = 114;
-// static const uint D3DFMT_G32R32F = 115;
-// static const uint D3DFMT_A32B32G32R32F = 116;
+/* Floating point formats */
+#if 0 /* Valid but currently unused. */
+static const uint D3DFMT_R16F = 111;
+static const uint D3DFMT_G16R16F = 112;
+static const uint D3DFMT_A16B16G16R16F = 113;
+static const uint D3DFMT_R32F = 114;
+static const uint D3DFMT_G32R32F = 115;
+static const uint D3DFMT_A32B32G32R32F = 116;
+#endif
static const uint DDSD_CAPS = 0x00000001U;
static const uint DDSD_PIXELFORMAT = 0x00001000U;
@@ -154,11 +164,11 @@ static const uint DDPF_PALETTEINDEXED8 = 0x00000020U;
static const uint DDPF_LUMINANCE = 0x00020000U;
static const uint DDPF_ALPHAPREMULT = 0x00008000U;
-// Custom NVTT flags.
+/* Custom NVTT flags. */
static const uint DDPF_NORMAL = 0x80000000U;
static const uint DDPF_SRGB = 0x40000000U;
-// DX10 formats.
+/* DX10 formats. */
enum DXGI_FORMAT {
DXGI_FORMAT_UNKNOWN = 0,
@@ -526,7 +536,7 @@ const FormatDescriptor s_d3dFormats[] = {
const uint s_d3dFormatCount = sizeof(s_d3dFormats) / sizeof(s_d3dFormats[0]);
-} // namespace
+} /* namespace */
static uint findD3D9Format(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
{
@@ -555,9 +565,9 @@ DDSHeader::DDSHeader()
this->reserved[i] = 0;
}
- // Store version information on the reserved header attributes.
+ /* Store version information on the reserved header attributes. */
this->reserved[9] = FOURCC_NVTT;
- this->reserved[10] = (2 << 16) | (1 << 8) | (0); // major.minor.revision
+ this->reserved[10] = (2 << 16) | (1 << 8) | (0); /* major.minor.revision */
this->pf.size = 32;
this->pf.flags = 0;
@@ -658,7 +668,7 @@ void DDSHeader::setPitch(uint pitch)
void DDSHeader::setFourCC(uint8 c0, uint8 c1, uint8 c2, uint8 c3)
{
- // set fourcc pixel format.
+ /* set fourcc pixel format. */
this->pf.flags = DDPF_FOURCC;
this->pf.fourcc = DDS_MAKEFOURCC(c0, c1, c2, c3);
@@ -671,7 +681,7 @@ void DDSHeader::setFourCC(uint8 c0, uint8 c1, uint8 c2, uint8 c3)
void DDSHeader::setFormatCode(uint32 code)
{
- // set fourcc pixel format.
+ /* set fourcc pixel format. */
this->pf.flags = DDPF_FOURCC;
this->pf.fourcc = code;
@@ -689,7 +699,7 @@ void DDSHeader::setSwizzleCode(uint8 c0, uint8 c1, uint8 c2, uint8 c3)
void DDSHeader::setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
{
- // Make sure the masks are correct.
+ /* Make sure the masks are correct. */
if ((rmask & gmask) || (rmask & bmask) || (rmask & amask) || (gmask & bmask) ||
(gmask & amask) || (bmask & amask)) {
printf("DDS: bad RGBA masks, pixel format not set\n");
@@ -713,7 +723,7 @@ void DDSHeader::setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask
}
if (bitcount == 0) {
- // Compute bit count from the masks.
+ /* Compute bit count from the masks. */
uint total = rmask | gmask | bmask | amask;
while (total != 0) {
bitcount++;
@@ -721,7 +731,7 @@ void DDSHeader::setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask
}
}
- // D3DX functions do not like this:
+ /* D3DX functions do not like this: */
this->pf.fourcc = 0; // findD3D9Format(bitcount, rmask, gmask, bmask, amask);
#if 0
if (this->pf.fourcc) {
@@ -872,9 +882,9 @@ DirectDrawSurface::DirectDrawSurface(unsigned char *mem, uint size) : stream(mem
{
mem_read(stream, header);
- // some ATI2 compressed normal maps do not have their
- // normal flag set, so force it here (the original nvtt don't do
- // this, but the decompressor has a -forcenormal flag)
+ /* Some ATI2 compressed normal maps do not have their
+ * normal flag set, so force it here (the original nvtt don't do
+ * this, but the decompressor has a -forcenormal flag). */
if (header.pf.fourcc == FOURCC_ATI2) {
header.setNormalFlag(true);
}
@@ -928,12 +938,12 @@ bool DirectDrawSurface::isSupported() const
header.pf.fourcc != FOURCC_DXT3 && header.pf.fourcc != FOURCC_DXT4 &&
header.pf.fourcc != FOURCC_DXT5 && header.pf.fourcc != FOURCC_RXGB &&
header.pf.fourcc != FOURCC_ATI1 && header.pf.fourcc != FOURCC_ATI2) {
- // Unknown fourcc code.
+ /* Unknown fourcc code. */
return false;
}
}
else if ((header.pf.flags & DDPF_RGB) || (header.pf.flags & DDPF_LUMINANCE)) {
- // All RGB and luminance formats are supported now.
+ /* All RGB and luminance formats are supported now. */
}
else {
return false;
@@ -941,12 +951,12 @@ bool DirectDrawSurface::isSupported() const
if (isTextureCube() &&
(header.caps.caps2 & DDSCAPS2_CUBEMAP_ALL_FACES) != DDSCAPS2_CUBEMAP_ALL_FACES) {
- // Cubemaps must contain all faces.
+ /* Cubemaps must contain all faces. */
return false;
}
if (isTexture3D()) {
- // @@ 3D textures not supported yet.
+ /* @@ 3D textures not supported yet. */
return false;
}
@@ -971,7 +981,7 @@ bool DirectDrawSurface::hasAlpha() const
return false;
}
- // @@ Here we could check the ALPHA_PIXELS flag, but nobody sets it. (except us?)
+ /* @@ Here we could check the ALPHA_PIXELS flag, but nobody sets it. (except us?) */
return true;
}
@@ -1072,7 +1082,7 @@ void DirectDrawSurface::mipmap(Image *img, uint face, uint mipmap)
uint w = width();
uint h = height();
- // Compute width and height.
+ /* Compute width and height. */
for (uint m = 0; m < mipmap; m++) {
w = MAX(1U, w / 2);
h = MAX(1U, h / 2);
@@ -1088,7 +1098,7 @@ void DirectDrawSurface::mipmap(Image *img, uint face, uint mipmap)
}
if (header.hasDX10Header()) {
- // So far only block formats supported.
+ /* So far only block formats supported. */
readBlockImage(img);
}
else {
@@ -1101,8 +1111,8 @@ void DirectDrawSurface::mipmap(Image *img, uint face, uint mipmap)
}
}
-// It was easier to copy this function from upstream than to resync.
-// This should be removed if a resync ever occurs.
+/* It was easier to copy this function from upstream than to resync.
+ * This should be removed if a resync ever occurs. */
void *DirectDrawSurface::readData(uint &rsize)
{
uint header_size = 128; // sizeof(DDSHeader);
@@ -1124,7 +1134,7 @@ void *DirectDrawSurface::readData(uint &rsize)
rsize = 0;
}
- // Maybe check if size == rsize? assert() isn't in this scope...
+ /* Maybe check if size == rsize? assert() isn't in this scope. */
return data;
}
@@ -1155,7 +1165,7 @@ void DirectDrawSurface::readLinearImage(Image *img)
return;
}
- // Read linear RGB images.
+ /* Read linear RGB images. */
for (uint y = 0; y < h; y++) {
for (uint x = 0; x < w; x++) {
uint c = 0;
@@ -1185,10 +1195,10 @@ void DirectDrawSurface::readBlockImage(Image *img)
for (uint bx = 0; bx < bw; bx++) {
ColorBlock block;
- // Read color block.
+ /* Read color block. */
readBlock(&block);
- // Write color block.
+ /* Write color block. */
for (uint y = 0; y < MIN(4U, h - 4 * by); y++) {
for (uint x = 0; x < MIN(4U, w - 4 * bx); x++) {
img->pixel(4 * bx + x, 4 * by + y) = block.color(x, y);
@@ -1215,7 +1225,7 @@ void DirectDrawSurface::readBlock(ColorBlock *rgba)
{
uint fourcc = header.pf.fourcc;
- // Map DX10 block formats to fourcc codes.
+ /* Map DX10 block formats to fourcc codes. */
if (header.hasDX10Header()) {
if (header.header10.dxgiFormat == DXGI_FORMAT_BC1_UNORM) {
fourcc = FOURCC_DXT1;
@@ -1251,7 +1261,7 @@ void DirectDrawSurface::readBlock(ColorBlock *rgba)
block.decodeBlock(rgba);
if (fourcc == FOURCC_RXGB) {
- // Swap R & A.
+ /* Swap R & A. */
for (int i = 0; i < 16; i++) {
Color32 &c = rgba->color(i);
uint tmp = c.r;
@@ -1271,7 +1281,7 @@ void DirectDrawSurface::readBlock(ColorBlock *rgba)
block.decodeBlock(rgba);
}
- // If normal flag set, convert to normal.
+ /* If normal flag set, convert to normal. */
if (header.pf.flags & DDPF_NORMAL) {
if (fourcc == FOURCC_ATI2) {
for (int i = 0; i < 16; i++) {
@@ -1323,7 +1333,7 @@ uint DirectDrawSurface::blockSize() const
}
}
- // Not a block image.
+ /* Not a block image. */
return 0;
}
@@ -1340,14 +1350,14 @@ uint DirectDrawSurface::mipmapSize(uint mipmap) const
}
if (header.pf.flags & DDPF_FOURCC) {
- // @@ How are 3D textures aligned?
+ /* @@ How are 3D textures aligned? */
w = (w + 3) / 4;
h = (h + 3) / 4;
return blockSize() * w * h;
}
if (header.pf.flags & DDPF_RGB || (header.pf.flags & DDPF_LUMINANCE)) {
- uint pitch = computePitch(
- w, header.pf.bitcount, 8); // Assuming 8 bit alignment, which is the same D3DX expects.
+ /* Assuming 8 bit alignment, which is the same D3DX expects. */
+ uint pitch = computePitch(w, header.pf.bitcount, 8);
return pitch * h * d;
}
@@ -1463,7 +1473,7 @@ void DirectDrawSurface::printInfo() const
}
if (header.pf.fourcc != 0) {
- // Display fourcc code even when DDPF_FOURCC flag not set.
+ /* Display fourcc code even when DDPF_FOURCC flag not set. */
printf("\tFourCC: '%c%c%c%c' (0x%.8X)\n",
(int)((header.pf.fourcc >> 0) & 0xFF),
(int)((header.pf.fourcc >> 8) & 0xFF),
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.h b/source/blender/imbuf/intern/dds/DirectDrawSurface.h
index 373d5974a5e..b6c2d1962e2 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.h
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.h
@@ -25,28 +25,28 @@
* Original license from NVIDIA follows.
*/
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
+/* Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE. */
#pragma once
@@ -98,7 +98,7 @@ struct DDSHeader {
uint notused;
DDSHeader10 header10;
- // Helper methods.
+ /* Helper methods. */
DDSHeader();
void setWidth(uint w);
@@ -175,7 +175,7 @@ class DirectDrawSurface {
void readBlock(ColorBlock *rgba);
private:
- Stream stream; // memory where DDS file resides
+ Stream stream; /* Memory where DDS file resides. */
DDSHeader header;
};
diff --git a/source/blender/imbuf/intern/dds/FlipDXT.cpp b/source/blender/imbuf/intern/dds/FlipDXT.cpp
index f46f50eb2b9..9b07084bf81 100644
--- a/source/blender/imbuf/intern/dds/FlipDXT.cpp
+++ b/source/blender/imbuf/intern/dds/FlipDXT.cpp
@@ -31,8 +31,8 @@
* All rights reserved.
*/
-// This file comes from the chromium project, adapted to Blender to add DDS
-// flipping to OpenGL convention for Blender
+/* This file comes from the chromium project, adapted to Blender to add DDS
+ * flipping to OpenGL convention for Blender */
#include "IMB_imbuf_types.h"
@@ -44,18 +44,18 @@
#include <FlipDXT.h>
#include <Stream.h>
-// A function that flips a DXTC block.
+/* A function that flips a DXTC block. */
typedef void (*FlipBlockFunction)(uint8_t *block);
-// Flips a full DXT1 block in the y direction.
+/* Flips a full DXT1 block in the y direction. */
static void FlipDXT1BlockFull(uint8_t *block)
{
- // A DXT1 block layout is:
- // [0-1] color0.
- // [2-3] color1.
- // [4-7] color bitmap, 2 bits per pixel.
- // So each of the 4-7 bytes represents one line, flipping a block is just
- // flipping those bytes.
+ /* A DXT1 block layout is:
+ * [0-1] color0.
+ * [2-3] color1.
+ * [4-7] color bitmap, 2 bits per pixel.
+ * So each of the 4-7 bytes represents one line, flipping a block is just
+ * flipping those bytes. */
uint8_t tmp = block[4];
block[4] = block[7];
block[7] = tmp;
@@ -64,23 +64,23 @@ static void FlipDXT1BlockFull(uint8_t *block)
block[6] = tmp;
}
-// Flips the first 2 lines of a DXT1 block in the y direction.
+/* Flips the first 2 lines of a DXT1 block in the y direction. */
static void FlipDXT1BlockHalf(uint8_t *block)
{
- // See layout above.
+ /* See layout above. */
uint8_t tmp = block[4];
block[4] = block[5];
block[5] = tmp;
}
-// Flips a full DXT3 block in the y direction.
+/* Flips a full DXT3 block in the y direction. */
static void FlipDXT3BlockFull(uint8_t *block)
{
- // A DXT3 block layout is:
- // [0-7] alpha bitmap, 4 bits per pixel.
- // [8-15] a DXT1 block.
+ /* A DXT3 block layout is:
+ * [0-7] alpha bitmap, 4 bits per pixel.
+ * [8-15] a DXT1 block. */
- // We can flip the alpha bits at the byte level (2 bytes per line).
+ /* We can flip the alpha bits at the byte level (2 bytes per line). */
uint8_t tmp = block[0];
block[0] = block[6];
@@ -95,14 +95,14 @@ static void FlipDXT3BlockFull(uint8_t *block)
block[3] = block[5];
block[5] = tmp;
- // And flip the DXT1 block using the above function.
+ /* And flip the DXT1 block using the above function. */
FlipDXT1BlockFull(block + 8);
}
-// Flips the first 2 lines of a DXT3 block in the y direction.
+/* Flips the first 2 lines of a DXT3 block in the y direction. */
static void FlipDXT3BlockHalf(uint8_t *block)
{
- // See layout above.
+ /* See layout above. */
uint8_t tmp = block[0];
block[0] = block[2];
@@ -113,36 +113,36 @@ static void FlipDXT3BlockHalf(uint8_t *block)
FlipDXT1BlockHalf(block + 8);
}
-// Flips a full DXT5 block in the y direction.
+/* Flips a full DXT5 block in the y direction. */
static void FlipDXT5BlockFull(uint8_t *block)
{
- // A DXT5 block layout is:
- // [0] alpha0.
- // [1] alpha1.
- // [2-7] alpha bitmap, 3 bits per pixel.
- // [8-15] a DXT1 block.
+ /* A DXT5 block layout is:
+ * [0] alpha0.
+ * [1] alpha1.
+ * [2-7] alpha bitmap, 3 bits per pixel.
+ * [8-15] a DXT1 block. */
- // The alpha bitmap doesn't easily map lines to bytes, so we have to
- // interpret it correctly. Extracted from
- // http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt :
- //
- // The 6 "bits" bytes of the block are decoded into one 48-bit integer:
- //
- // bits = bits_0 + 256 * (bits_1 + 256 * (bits_2 + 256 * (bits_3 +
- // 256 * (bits_4 + 256 * bits_5))))
- //
- // bits is a 48-bit unsigned integer, from which a three-bit control code
- // is extracted for a texel at location (x,y) in the block using:
- //
- // code(x,y) = bits[3*(4*y+x)+1..3*(4*y+x)+0]
- //
- // where bit 47 is the most significant and bit 0 is the least
- // significant bit.
+ /* The alpha bitmap doesn't easily map lines to bytes, so we have to
+ * interpret it correctly. Extracted from
+ * http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt :
+ *
+ * The 6 "bits" bytes of the block are decoded into one 48-bit integer:
+ *
+ * bits = bits_0 + 256 * (bits_1 + 256 * (bits_2 + 256 * (bits_3 +
+ * 256 * (bits_4 + 256 * bits_5))))
+ *
+ * bits is a 48-bit unsigned integer, from which a three-bit control code
+ * is extracted for a texel at location (x,y) in the block using:
+ *
+ * code(x,y) = bits[3*(4*y+x)+1..3*(4*y+x)+0]
+ *
+ * where bit 47 is the most significant and bit 0 is the least
+ * significant bit. */
unsigned int line_0_1 = block[2] + 256 * (block[3] + 256 * block[4]);
unsigned int line_2_3 = block[5] + 256 * (block[6] + 256 * block[7]);
- // swap lines 0 and 1 in line_0_1.
+ /* swap lines 0 and 1 in line_0_1. */
unsigned int line_1_0 = ((line_0_1 & 0x000fff) << 12) | ((line_0_1 & 0xfff000) >> 12);
- // swap lines 2 and 3 in line_2_3.
+ /* swap lines 2 and 3 in line_2_3. */
unsigned int line_3_2 = ((line_2_3 & 0x000fff) << 12) | ((line_2_3 & 0xfff000) >> 12);
block[2] = line_3_2 & 0xff;
@@ -152,14 +152,14 @@ static void FlipDXT5BlockFull(uint8_t *block)
block[6] = (line_1_0 & 0xff00) >> 8;
block[7] = (line_1_0 & 0xff0000) >> 16;
- // And flip the DXT1 block using the above function.
+ /* And flip the DXT1 block using the above function. */
FlipDXT1BlockFull(block + 8);
}
-// Flips the first 2 lines of a DXT5 block in the y direction.
+/* Flips the first 2 lines of a DXT5 block in the y direction. */
static void FlipDXT5BlockHalf(uint8_t *block)
{
- // See layout above.
+ /* See layout above. */
unsigned int line_0_1 = block[2] + 256 * (block[3] + 256 * block[4]);
unsigned int line_1_0 = ((line_0_1 & 0x000fff) << 12) | ((line_0_1 & 0xfff000) >> 12);
block[2] = line_1_0 & 0xff;
@@ -168,15 +168,15 @@ static void FlipDXT5BlockHalf(uint8_t *block)
FlipDXT1BlockHalf(block + 8);
}
-// Flips a DXTC image, by flipping and swapping DXTC blocks as appropriate.
+/* Flips a DXTC image, by flipping and swapping DXTC blocks as appropriate. */
int FlipDXTCImage(
unsigned int width, unsigned int height, unsigned int levels, int fourcc, uint8_t *data)
{
- // must have valid dimensions
+ /* Must have valid dimensions. */
if (width == 0 || height == 0) {
return 0;
}
- // height must be a power-of-two
+ /* Height must be a power-of-two. */
if ((height & (height - 1)) != 0) {
return 0;
}
@@ -214,24 +214,24 @@ int FlipDXTCImage(
unsigned int blocks = blocks_per_row * blocks_per_col;
if (mip_height == 1) {
- // no flip to do, and we're done.
+ /* no flip to do, and we're done. */
break;
}
if (mip_height == 2) {
- // flip the first 2 lines in each block.
+ /* flip the first 2 lines in each block. */
for (unsigned int i = 0; i < blocks_per_row; i++) {
half_block_function(data + i * block_bytes);
}
}
else {
- // flip each block.
+ /* flip each block. */
for (unsigned int i = 0; i < blocks; i++) {
full_block_function(data + i * block_bytes);
}
- // swap each block line in the first half of the image with the
- // corresponding one in the second half.
- // note that this is a no-op if mip_height is 4.
+ /* Swap each block line in the first half of the image with the
+ * corresponding one in the second half.
+ * note that this is a no-op if mip_height is 4. */
unsigned int row_bytes = block_bytes * blocks_per_row;
uint8_t *temp_line = new uint8_t[row_bytes];
@@ -247,7 +247,7 @@ int FlipDXTCImage(
delete[] temp_line;
}
- // mip levels are contiguous.
+ /* mip levels are contiguous. */
data += block_bytes * blocks;
mip_width = MAX(1U, mip_width >> 1);
mip_height = MAX(1U, mip_height >> 1);
diff --git a/source/blender/imbuf/intern/dds/Image.cpp b/source/blender/imbuf/intern/dds/Image.cpp
index 31a9927557b..4cfd7178f29 100644
--- a/source/blender/imbuf/intern/dds/Image.cpp
+++ b/source/blender/imbuf/intern/dds/Image.cpp
@@ -25,12 +25,12 @@
* Original license from NVIDIA follows.
*/
-// This code is in the public domain -- castanyo@yahoo.es
+/* This code is in the public domain -- <castanyo@yahoo.es>. */
#include <Color.h>
#include <Image.h>
-#include <stdio.h> // printf
+#include <stdio.h> /* printf */
Image::Image() : m_width(0), m_height(0), m_format(Format_RGB), m_data(NULL)
{
diff --git a/source/blender/imbuf/intern/dds/Image.h b/source/blender/imbuf/intern/dds/Image.h
index 0f977641d89..bc46b839952 100644
--- a/source/blender/imbuf/intern/dds/Image.h
+++ b/source/blender/imbuf/intern/dds/Image.h
@@ -25,7 +25,7 @@
* Original license from NVIDIA follows.
*/
-// This code is in the public domain -- castanyo@yahoo.es
+/* This code is in the public domain -- <castanyo@yahoo.es> */
#pragma once
diff --git a/source/blender/imbuf/intern/dds/PixelFormat.h b/source/blender/imbuf/intern/dds/PixelFormat.h
index a9125c64121..5c1d8e981a6 100644
--- a/source/blender/imbuf/intern/dds/PixelFormat.h
+++ b/source/blender/imbuf/intern/dds/PixelFormat.h
@@ -25,28 +25,29 @@
* Original license from NVIDIA follows.
*/
-// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
+/* Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
#pragma once
@@ -54,23 +55,23 @@
namespace PixelFormat {
-// Convert component \a c having \a inbits to the returned value having \a outbits.
+/** Convert component \a c having \a inbits to the returned value having \a outbits. */
inline uint convert(uint c, uint inbits, uint outbits)
{
if (inbits == 0) {
return 0;
}
else if (inbits >= outbits) {
- // truncate
+ /* truncate */
return c >> (inbits - outbits);
}
else {
- // bitexpand
+ /* bitexpand */
return (c << (outbits - inbits)) | convert(c, inbits, outbits - inbits);
}
}
-// Get pixel component shift and size given its mask.
+/* Get pixel component shift and size given its mask. */
inline void maskShiftAndSize(uint mask, uint *shift, uint *size)
{
if (!mask) {
@@ -94,11 +95,14 @@ inline void maskShiftAndSize(uint mask, uint *shift, uint *size)
inline float quantizeCeil(float f, int inbits, int outbits)
{
- // uint i = f * (float(1 << inbits) - 1);
- // i = convert(i, inbits, outbits);
- // float result = float(i) / (float(1 << outbits) - 1);
- // nvCheck(result >= f);
+#if 0
+ uint i = f * (float(1 << inbits) - 1);
+ i = convert(i, inbits, outbits);
+ float result = float(i) / (float(1 << outbits) - 1);
+ nvCheck(result >= f);
+#endif
float result;
+
int offset = 0;
do {
uint i = offset + uint(f * (float(1 << inbits) - 1));
@@ -124,4 +128,4 @@ inline float quantizeFloor(float f, int bits)
}
#endif
-} // namespace PixelFormat
+} /* namespace PixelFormat */
diff --git a/source/blender/imbuf/intern/dds/Stream.cpp b/source/blender/imbuf/intern/dds/Stream.cpp
index e1c5eb1d505..59892a0a228 100644
--- a/source/blender/imbuf/intern/dds/Stream.cpp
+++ b/source/blender/imbuf/intern/dds/Stream.cpp
@@ -20,8 +20,8 @@
#include <Stream.h>
-#include <stdio.h> // printf
-#include <string.h> // memcpy
+#include <stdio.h> /* printf */
+#include <string.h> /* memcpy */
static const char *msg_error_seek = "DDS: trying to seek beyond end of stream (corrupt file?)";
static const char *msg_error_read = "DDS: trying to read beyond end of stream (corrupt file?)";
@@ -44,7 +44,7 @@ unsigned int mem_read(Stream &mem, unsigned long long &i)
mem.set_failed(msg_error_seek);
return 0;
}
- memcpy(&i, mem.mem + mem.pos, 8); // @@ todo: make sure little endian
+ memcpy(&i, mem.mem + mem.pos, 8); /* @@ todo: make sure little endian */
mem.pos += 8;
return 8;
}
@@ -55,7 +55,7 @@ unsigned int mem_read(Stream &mem, unsigned int &i)
mem.set_failed(msg_error_read);
return 0;
}
- memcpy(&i, mem.mem + mem.pos, 4); // @@ todo: make sure little endian
+ memcpy(&i, mem.mem + mem.pos, 4); /* @@ todo: make sure little endian */
mem.pos += 4;
return 4;
}
@@ -66,7 +66,7 @@ unsigned int mem_read(Stream &mem, unsigned short &i)
mem.set_failed(msg_error_read);
return 0;
}
- memcpy(&i, mem.mem + mem.pos, 2); // @@ todo: make sure little endian
+ memcpy(&i, mem.mem + mem.pos, 2); /* @@ todo: make sure little endian */
mem.pos += 2;
return 2;
}
diff --git a/source/blender/imbuf/intern/dds/Stream.h b/source/blender/imbuf/intern/dds/Stream.h
index ad6b9165801..acf0345b3a6 100644
--- a/source/blender/imbuf/intern/dds/Stream.h
+++ b/source/blender/imbuf/intern/dds/Stream.h
@@ -23,10 +23,10 @@
#pragma once
struct Stream {
- unsigned char *mem; // location in memory
- unsigned int size; // size
- unsigned int pos; // current position
- bool failed; // error occurred when seeking
+ unsigned char *mem; /* location in memory */
+ unsigned int size; /* size */
+ unsigned int pos; /* current position */
+ bool failed; /* error occurred when seeking */
Stream(unsigned char *m, unsigned int s) : mem(m), size(s), pos(0), failed(false)
{
}
diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp
index 309b5d6410f..1d29dd4a26b 100644
--- a/source/blender/imbuf/intern/dds/dds_api.cpp
+++ b/source/blender/imbuf/intern/dds/dds_api.cpp
@@ -26,7 +26,7 @@
#include <dds_api.h>
#include <fstream>
#include <stddef.h>
-#include <stdio.h> // printf
+#include <stdio.h> /* printf */
#if defined(WIN32)
# include "utfconv.h"
@@ -72,7 +72,7 @@ int imb_save_dds(struct ImBuf *ibuf, const char *name, int /*flags*/)
return 1;
}
-int imb_is_a_dds(const unsigned char *mem) // note: use at most first 32 bytes
+int imb_is_a_dds(const unsigned char *mem) /* note: use at most first 32 bytes */
{
/* heuristic check to see if mem contains a DDS file */
/* header.fourcc == FOURCC_DDS */
@@ -199,4 +199,4 @@ struct ImBuf *imb_load_dds(const unsigned char *mem,
return ibuf;
}
-} // extern "C"
+} /* extern "C" */
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
index 86bb5934db6..71774b335d7 100644
--- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp
+++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
@@ -290,4 +290,4 @@ int OIIO_getVersionHex(void)
return openimageio_version();
}
-} // export "C"
+} /* export "C" */
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 480bb15aa87..ca70ec633c1 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -699,7 +699,7 @@ void *IMB_exr_get_handle_name(const char *name)
}
/* multiview functions */
-} // extern "C"
+} /* extern "C" */
extern "C" {
@@ -1918,7 +1918,7 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem,
// printf("OpenEXR-load: image data window %d %d %d %d\n",
// dw.min.x, dw.min.y, dw.max.x, dw.max.y);
- if (0) { // debug
+ if (0) { /* debug */
exr_print_filecontents(*file);
}
@@ -2022,17 +2022,18 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem,
in.setFrameBuffer(frameBuffer);
in.readPixels(dw.min.y, dw.max.y);
- // XXX, ImBuf has no nice way to deal with this.
- // ideally IM_rect would be used when the caller wants a rect BUT
- // at the moment all functions use IM_rect.
- // Disabling this is ok because all functions should check
- // if a rect exists and create one on demand.
- //
- // Disabling this because the sequencer frees immediate.
- //
- // if (flag & IM_rect) {
- // IMB_rect_from_float(ibuf);
- // }
+ /* XXX, ImBuf has no nice way to deal with this.
+ * ideally IM_rect would be used when the caller wants a rect BUT
+ * at the moment all functions use IM_rect.
+ * Disabling this is ok because all functions should check
+ * if a rect exists and create one on demand.
+ *
+ * Disabling this because the sequencer frees immediate. */
+#if 0
+ if (flag & IM_rect) {
+ IMB_rect_from_float(ibuf);
+ }
+#endif
if (num_rgb_channels == 0 && has_luma && exr_has_chroma(*file)) {
for (size_t a = 0; a < (size_t)ibuf->x * ibuf->y; a++) {
@@ -2102,4 +2103,4 @@ void imb_exitopenexr(void)
setGlobalThreadCount(0);
}
-} // export "C"
+} /* export "C" */
diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h
index 7008447313d..556717ad618 100644
--- a/source/blender/imbuf/intern/openexr/openexr_multi.h
+++ b/source/blender/imbuf/intern/openexr/openexr_multi.h
@@ -96,5 +96,5 @@ void IMB_exr_add_view(void *handle, const char *name);
bool IMB_exr_has_multilayer(void *handle);
#ifdef __cplusplus
-} // extern "C"
+} /* extern "C" */
#endif
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index 10d35b24cab..4a964c64917 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -35,7 +35,7 @@
#include "IMB_filter.h"
-#include "BLI_sys_types.h" // for intptr_t support
+#include "BLI_sys_types.h" /* for intptr_t support */
static void imb_half_x_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
{