kopia lustrzana https://github.com/gopro/gpr
WARNINGS: fix against set of -W options (#38)
* make __attribute__((fallthrough)) more portable for GCC (>= 7) and CLANG (>= 10)pull/46/head
rodzic
96b11fccb7
commit
ea25ea0ad9
|
@ -46,8 +46,7 @@ int read_from_file(gpr_buffer* buffer, const char* file_path, gpr_malloc malloc_
|
|||
return -1;
|
||||
}
|
||||
|
||||
long result = fread(buffer->buffer, 1, buffer->size, fIN);
|
||||
if (result != buffer->size)
|
||||
if (fread(buffer->buffer, 1, buffer->size, fIN) != buffer->size)
|
||||
{
|
||||
free_function(buffer->buffer);
|
||||
fputs ("Reading error", stderr);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
TIMER LogTimer;
|
||||
|
||||
bool LogInit()
|
||||
bool LogInit(void)
|
||||
{
|
||||
InitTimer(&LogTimer);
|
||||
|
||||
|
@ -54,7 +54,7 @@ int LogPrint(const char* format, ... )
|
|||
}
|
||||
#endif // LogPrint
|
||||
|
||||
bool LogUninit()
|
||||
bool LogUninit(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool LogInit();
|
||||
bool LogInit(void);
|
||||
|
||||
#ifndef LogPrint
|
||||
int LogPrint(const char* format, ... );
|
||||
#endif
|
||||
|
||||
bool LogUninit();
|
||||
bool LogUninit(void);
|
||||
|
||||
#define TIMESTAMP(x, y) TIMESTAMP_##y(x)
|
||||
|
||||
|
|
|
@ -1670,7 +1670,7 @@ inline void dng_lossless_decoder::HuffExtend (int32 &x, int32 s)
|
|||
|
||||
if (x < (0x08000 >> (16 - s)))
|
||||
{
|
||||
x += (-1 << s) + 1;
|
||||
x += -(1 << s) + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -106,28 +106,28 @@ class dng_area_spec
|
|||
|
||||
/// The first plane.
|
||||
|
||||
const uint32 Plane () const
|
||||
uint32 Plane () const
|
||||
{
|
||||
return fPlane;
|
||||
}
|
||||
|
||||
/// The total number of planes.
|
||||
|
||||
const uint32 Planes () const
|
||||
uint32 Planes () const
|
||||
{
|
||||
return fPlanes;
|
||||
}
|
||||
|
||||
/// The row pitch (i.e., stride). A pitch of 1 means all rows.
|
||||
|
||||
const uint32 RowPitch () const
|
||||
uint32 RowPitch () const
|
||||
{
|
||||
return fRowPitch;
|
||||
}
|
||||
|
||||
/// The column pitch (i.e., stride). A pitch of 1 means all columns.
|
||||
|
||||
const uint32 ColPitch () const
|
||||
uint32 ColPitch () const
|
||||
{
|
||||
return fColPitch;
|
||||
}
|
||||
|
|
|
@ -2716,7 +2716,7 @@ void dng_negative::SetFujiMosaic6x6 (uint32 phase)
|
|||
info.fCFAPattern [5] [4] = color2;
|
||||
info.fCFAPattern [5] [5] = color1;
|
||||
|
||||
DNG_REQUIRE (phase >= 0 && phase < patSize * patSize,
|
||||
DNG_REQUIRE (phase < patSize * patSize,
|
||||
"Bad phase in SetFujiMosaic6x6.");
|
||||
|
||||
if (phase > 0)
|
||||
|
|
|
@ -95,7 +95,7 @@ class dng_resample_coords
|
|||
return fCoords->Buffer_int32 () + (index - fOrigin);
|
||||
}
|
||||
|
||||
const int32 Pixel (int32 index) const
|
||||
int32 Pixel (int32 index) const
|
||||
{
|
||||
return Coords (index) [0] >> kResampleSubsampleBits;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,12 @@
|
|||
#define PTRFASTCALL __attribute__((regparm(3)))
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 7 || defined(__clang__) && __clang_major__ >= 10
|
||||
#define FALL_THROUGH __attribute__ ((fallthrough))
|
||||
#else
|
||||
#define FALL_THROUGH ((void)0)
|
||||
#endif
|
||||
|
||||
/* Using __fastcall seems to have an unexpected negative effect under
|
||||
MS VC++, especially for function pointers, so we won't use it for
|
||||
now on that platform. It may be reconsidered for a future release
|
||||
|
|
|
@ -1502,6 +1502,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
|
|||
errorCode = XML_ERROR_NO_MEMORY;
|
||||
return XML_STATUS_ERROR;
|
||||
}
|
||||
FALL_THROUGH;
|
||||
default:
|
||||
ps_parsing = XML_PARSING;
|
||||
}
|
||||
|
@ -1528,6 +1529,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
|
|||
case XML_INITIALIZED:
|
||||
case XML_PARSING:
|
||||
ps_parsing = XML_FINISHED;
|
||||
FALL_THROUGH;
|
||||
/* fall through */
|
||||
default:
|
||||
return XML_STATUS_OK;
|
||||
|
@ -1564,7 +1566,8 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
|
|||
ps_parsing = XML_FINISHED;
|
||||
return XML_STATUS_OK;
|
||||
}
|
||||
/* fall through */
|
||||
FALL_THROUGH;
|
||||
/* fall through */
|
||||
default:
|
||||
result = XML_STATUS_OK;
|
||||
}
|
||||
|
@ -1628,6 +1631,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
|
|||
errorCode = XML_ERROR_NO_MEMORY;
|
||||
return XML_STATUS_ERROR;
|
||||
}
|
||||
FALL_THROUGH;
|
||||
default:
|
||||
ps_parsing = XML_PARSING;
|
||||
}
|
||||
|
@ -2370,7 +2374,6 @@ doContent(XML_Parser parser,
|
|||
break;
|
||||
}
|
||||
case XML_TOK_START_TAG_NO_ATTS:
|
||||
/* fall through */
|
||||
case XML_TOK_START_TAG_WITH_ATTS:
|
||||
{
|
||||
TAG *tag;
|
||||
|
@ -2439,7 +2442,6 @@ doContent(XML_Parser parser,
|
|||
break;
|
||||
}
|
||||
case XML_TOK_EMPTY_ELEMENT_NO_ATTS:
|
||||
/* fall through */
|
||||
case XML_TOK_EMPTY_ELEMENT_WITH_ATTS:
|
||||
{
|
||||
const char *rawName = s + enc->minBytesPerChar;
|
||||
|
@ -3895,6 +3897,7 @@ doProlog(XML_Parser parser,
|
|||
handleDefault = XML_FALSE;
|
||||
goto alreadyChecked;
|
||||
}
|
||||
FALL_THROUGH;
|
||||
/* fall through */
|
||||
case XML_ROLE_ENTITY_PUBLIC_ID:
|
||||
if (!XmlIsPublicId(enc, s, next, eventPP))
|
||||
|
@ -4197,6 +4200,7 @@ doProlog(XML_Parser parser,
|
|||
return XML_ERROR_NO_MEMORY;
|
||||
declEntity->publicId = NULL;
|
||||
}
|
||||
FALL_THROUGH;
|
||||
/* fall through */
|
||||
#endif /* XML_DTD */
|
||||
case XML_ROLE_ENTITY_SYSTEM_ID:
|
||||
|
@ -4977,6 +4981,7 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,
|
|||
break;
|
||||
case XML_TOK_TRAILING_CR:
|
||||
next = ptr + enc->minBytesPerChar;
|
||||
FALL_THROUGH;
|
||||
/* fall through */
|
||||
case XML_TOK_ATTRIBUTE_VALUE_S:
|
||||
case XML_TOK_DATA_NEWLINE:
|
||||
|
@ -5181,6 +5186,7 @@ storeEntityValue(XML_Parser parser,
|
|||
break;
|
||||
case XML_TOK_TRAILING_CR:
|
||||
next = entityTextPtr + enc->minBytesPerChar;
|
||||
FALL_THROUGH;
|
||||
/* fall through */
|
||||
case XML_TOK_DATA_NEWLINE:
|
||||
if (pool->end == pool->ptr && !poolGrow(pool)) {
|
||||
|
|
|
@ -222,6 +222,17 @@ struct normal_encoding {
|
|||
E ## isInvalid3, \
|
||||
E ## isInvalid4
|
||||
|
||||
#define EMPTY_VTABLE \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL
|
||||
|
||||
static int FASTCALL checkCharRefNumber(int);
|
||||
|
||||
#include "xmltok_impl.h"
|
||||
|
@ -467,7 +478,7 @@ static const struct normal_encoding latin1_encoding_ns = {
|
|||
#include "asciitab.h"
|
||||
#include "latin1tab.h"
|
||||
},
|
||||
STANDARD_VTABLE(sb_)
|
||||
STANDARD_VTABLE(sb_) EMPTY_VTABLE
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -480,7 +491,7 @@ static const struct normal_encoding latin1_encoding = {
|
|||
#undef BT_COLON
|
||||
#include "latin1tab.h"
|
||||
},
|
||||
STANDARD_VTABLE(sb_)
|
||||
STANDARD_VTABLE(sb_) EMPTY_VTABLE
|
||||
};
|
||||
|
||||
static void PTRCALL
|
||||
|
@ -500,7 +511,7 @@ static const struct normal_encoding ascii_encoding_ns = {
|
|||
#include "asciitab.h"
|
||||
/* BT_NONXML == 0 */
|
||||
},
|
||||
STANDARD_VTABLE(sb_)
|
||||
STANDARD_VTABLE(sb_) EMPTY_VTABLE
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -513,7 +524,7 @@ static const struct normal_encoding ascii_encoding = {
|
|||
#undef BT_COLON
|
||||
/* BT_NONXML == 0 */
|
||||
},
|
||||
STANDARD_VTABLE(sb_)
|
||||
STANDARD_VTABLE(sb_) EMPTY_VTABLE
|
||||
};
|
||||
|
||||
static int PTRFASTCALL
|
||||
|
@ -557,6 +568,7 @@ E ## toUtf8(const ENCODING *enc, \
|
|||
*(*toP)++ = lo; \
|
||||
break; \
|
||||
} \
|
||||
__attribute((fallthrough)); \
|
||||
/* fall through */ \
|
||||
case 0x1: case 0x2: case 0x3: \
|
||||
case 0x4: case 0x5: case 0x6: case 0x7: \
|
||||
|
@ -726,7 +738,7 @@ static const struct normal_encoding little2_encoding_ns = {
|
|||
#include "asciitab.h"
|
||||
#include "latin1tab.h"
|
||||
},
|
||||
STANDARD_VTABLE(little2_)
|
||||
STANDARD_VTABLE(little2_) EMPTY_VTABLE
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -745,7 +757,7 @@ static const struct normal_encoding little2_encoding = {
|
|||
#undef BT_COLON
|
||||
#include "latin1tab.h"
|
||||
},
|
||||
STANDARD_VTABLE(little2_)
|
||||
STANDARD_VTABLE(little2_) EMPTY_VTABLE
|
||||
};
|
||||
|
||||
#if BYTEORDER != 4321
|
||||
|
@ -758,7 +770,7 @@ static const struct normal_encoding internal_little2_encoding_ns = {
|
|||
#include "iasciitab.h"
|
||||
#include "latin1tab.h"
|
||||
},
|
||||
STANDARD_VTABLE(little2_)
|
||||
STANDARD_VTABLE(little2_) EMPTY_VTABLE
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -771,7 +783,7 @@ static const struct normal_encoding internal_little2_encoding = {
|
|||
#undef BT_COLON
|
||||
#include "latin1tab.h"
|
||||
},
|
||||
STANDARD_VTABLE(little2_)
|
||||
STANDARD_VTABLE(little2_) EMPTY_VTABLE
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -867,7 +879,7 @@ static const struct normal_encoding big2_encoding_ns = {
|
|||
#include "asciitab.h"
|
||||
#include "latin1tab.h"
|
||||
},
|
||||
STANDARD_VTABLE(big2_)
|
||||
STANDARD_VTABLE(big2_) EMPTY_VTABLE
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -886,7 +898,7 @@ static const struct normal_encoding big2_encoding = {
|
|||
#undef BT_COLON
|
||||
#include "latin1tab.h"
|
||||
},
|
||||
STANDARD_VTABLE(big2_)
|
||||
STANDARD_VTABLE(big2_) EMPTY_VTABLE
|
||||
};
|
||||
|
||||
#if BYTEORDER != 1234
|
||||
|
@ -899,7 +911,7 @@ static const struct normal_encoding internal_big2_encoding_ns = {
|
|||
#include "iasciitab.h"
|
||||
#include "latin1tab.h"
|
||||
},
|
||||
STANDARD_VTABLE(big2_)
|
||||
STANDARD_VTABLE(big2_) EMPTY_VTABLE
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -912,7 +924,7 @@ static const struct normal_encoding internal_big2_encoding = {
|
|||
#undef BT_COLON
|
||||
#include "latin1tab.h"
|
||||
},
|
||||
STANDARD_VTABLE(big2_)
|
||||
STANDARD_VTABLE(big2_) EMPTY_VTABLE
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1528,6 +1540,7 @@ initScan(const ENCODING * const *encodingTable,
|
|||
if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC
|
||||
&& state == XML_CONTENT_STATE)
|
||||
break;
|
||||
__attribute((fallthrough));
|
||||
/* fall through */
|
||||
case 0x00:
|
||||
case 0x3C:
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
*nextTokPtr = ptr; \
|
||||
return XML_TOK_INVALID; \
|
||||
} \
|
||||
__attribute((fallthrough)); \
|
||||
case BT_NMSTRT: \
|
||||
case BT_HEX: \
|
||||
case BT_DIGIT: \
|
||||
|
@ -75,6 +76,7 @@
|
|||
*nextTokPtr = ptr; \
|
||||
return XML_TOK_INVALID; \
|
||||
} \
|
||||
__attribute((fallthrough)); \
|
||||
case BT_NMSTRT: \
|
||||
case BT_HEX: \
|
||||
ptr += MINBPC(enc); \
|
||||
|
@ -158,6 +160,7 @@ PREFIX(scanDecl)(const ENCODING *enc, const char *ptr,
|
|||
*nextTokPtr = ptr;
|
||||
return XML_TOK_INVALID;
|
||||
}
|
||||
FALL_THROUGH;
|
||||
/* fall through */
|
||||
case BT_S: case BT_CR: case BT_LF:
|
||||
*nextTokPtr = ptr;
|
||||
|
@ -272,6 +275,7 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr,
|
|||
*nextTokPtr = ptr + MINBPC(enc);
|
||||
return tok;
|
||||
}
|
||||
FALL_THROUGH;
|
||||
/* fall through */
|
||||
default:
|
||||
*nextTokPtr = ptr;
|
||||
|
@ -570,7 +574,8 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
return XML_TOK_INVALID;
|
||||
}
|
||||
}
|
||||
/* fall through */
|
||||
FALL_THROUGH;
|
||||
/* fall through */
|
||||
case BT_EQUALS:
|
||||
{
|
||||
int open;
|
||||
|
@ -859,6 +864,7 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
return XML_TOK_INVALID;
|
||||
}
|
||||
}
|
||||
FALL_THROUGH;
|
||||
/* fall through */
|
||||
case BT_AMP:
|
||||
case BT_LT:
|
||||
|
@ -1017,6 +1023,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
/* indicate that this might be part of a CR/LF pair */
|
||||
return -XML_TOK_PROLOG_S;
|
||||
}
|
||||
FALL_THROUGH;
|
||||
/* fall through */
|
||||
case BT_S: case BT_LF:
|
||||
for (;;) {
|
||||
|
@ -1030,6 +1037,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
/* don't split CR/LF pair */
|
||||
if (ptr + MINBPC(enc) != end)
|
||||
break;
|
||||
FALL_THROUGH;
|
||||
/* fall through */
|
||||
default:
|
||||
*nextTokPtr = ptr;
|
||||
|
@ -1136,6 +1144,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
tok = XML_TOK_NMTOKEN;
|
||||
break;
|
||||
}
|
||||
FALL_THROUGH;
|
||||
/* fall through */
|
||||
default:
|
||||
*nextTokPtr = ptr;
|
||||
|
@ -1407,6 +1416,7 @@ PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
case BT_NMSTRT:
|
||||
if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f))
|
||||
break;
|
||||
FALL_THROUGH;
|
||||
default:
|
||||
switch (BYTE_TO_ASCII(enc, ptr)) {
|
||||
case 0x24: /* $ */
|
||||
|
@ -1627,7 +1637,11 @@ PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
|
|||
case BT_LEAD ## n: \
|
||||
if (*ptr1++ != *ptr2++) \
|
||||
return 0;
|
||||
LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2)
|
||||
LEAD_CASE(4)
|
||||
FALL_THROUGH;
|
||||
LEAD_CASE(3)
|
||||
FALL_THROUGH;
|
||||
LEAD_CASE(2)
|
||||
#undef LEAD_CASE
|
||||
/* fall through */
|
||||
if (*ptr1++ != *ptr2++)
|
||||
|
|
|
@ -90,6 +90,12 @@ extern "C"
|
|||
#pragma GCC diagnostic ignored "-Wpadded"
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 7 || defined(__clang__) && __clang_major__ >= 10
|
||||
#define FALL_THROUGH __attribute__ ((fallthrough))
|
||||
#else
|
||||
#define FALL_THROUGH ((void)0)
|
||||
#endif
|
||||
|
||||
// ============================================================
|
||||
// Public interface:
|
||||
// ============================================================
|
||||
|
@ -1254,6 +1260,7 @@ int tje_encode_with_func(tje_write_func* func,
|
|||
break;
|
||||
case 2:
|
||||
qt_factor = 10;
|
||||
FALL_THROUGH;
|
||||
// don't break. fall through.
|
||||
case 1:
|
||||
for ( i = 0; i < 64; ++i ) {
|
||||
|
|
|
@ -28,7 +28,7 @@ extern "C" {
|
|||
|
||||
int32_t CompandedValue(int32_t value);
|
||||
|
||||
uint32_t CompandingParameter();
|
||||
uint32_t CompandingParameter(void);
|
||||
|
||||
CODEC_ERROR ComputeCubicTable(int16_t cubic_table[], int cubic_table_length, int16_t maximum_value);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ uint16_t EncoderLogCurve[LOG_CURVE_TABLE_LENGTH];
|
|||
|
||||
uint16_t DecoderLogCurve[LOG_CURVE_TABLE_LENGTH];
|
||||
|
||||
void SetupDecoderLogCurve()
|
||||
void SetupDecoderLogCurve(void)
|
||||
{
|
||||
int i;
|
||||
const int log_table_size = sizeof(DecoderLogCurve) / sizeof(DecoderLogCurve[0]);
|
||||
|
@ -41,7 +41,7 @@ void SetupDecoderLogCurve()
|
|||
}
|
||||
}
|
||||
|
||||
void SetupEncoderLogCurve()
|
||||
void SetupEncoderLogCurve(void)
|
||||
{
|
||||
int i;
|
||||
const int max_input_val = LOG_CURVE_TABLE_LENGTH - 1;
|
||||
|
|
|
@ -31,9 +31,9 @@ extern "C" {
|
|||
|
||||
extern uint16_t DecoderLogCurve[];
|
||||
|
||||
void SetupDecoderLogCurve();
|
||||
void SetupDecoderLogCurve(void);
|
||||
|
||||
void SetupEncoderLogCurve();
|
||||
void SetupEncoderLogCurve(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -423,7 +423,7 @@ CODEC_ERROR GetBlockFile(STREAM *stream, void *buffer, size_t size, size_t offse
|
|||
}
|
||||
|
||||
// Seek to the specified offset
|
||||
assert(0 <= offset && offset <= LONG_MAX);
|
||||
assert(offset <= LONG_MAX);
|
||||
if (fseek(file, (long)offset, SEEK_SET) != 0) {
|
||||
return CODEC_ERROR_FILE_SEEK;
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ CODEC_ERROR PutBlockFile(STREAM *stream, void *buffer, size_t size, size_t offse
|
|||
}
|
||||
|
||||
// Seek to the specified offset and write to the file
|
||||
assert(0 <= offset && offset <= LONG_MAX);
|
||||
assert(offset <= LONG_MAX);
|
||||
if (fseek(file, (long)offset, SEEK_SET) != 0) {
|
||||
return CODEC_ERROR_FILE_SEEK;
|
||||
}
|
||||
|
|
|
@ -382,7 +382,6 @@ CODEC_ERROR WriteComponentPermutation(COMPONENT_PERMUTATION *permutation, BITSTR
|
|||
for (i = 0; i < component_count; i++)
|
||||
{
|
||||
uint8_t value = (uint8_t)permutation->permutation_array[i];
|
||||
assert(0 <= value && value <= UINT8_MAX);
|
||||
PutBits(stream, value, 8);
|
||||
}
|
||||
|
||||
|
|
|
@ -1153,9 +1153,9 @@ static void ForwardWaveletTransformRecursive(RECURSIVE_TRANSFORM_DATA *transform
|
|||
|
||||
int32_t prescale = transform_data[wavelet_stage].prescale;
|
||||
|
||||
int bottom_input_row = ((input_height % 2) == 0) ? input_height - 2 : input_height - 1;
|
||||
uint32_t bottom_input_row = ((input_height % 2) == 0) ? input_height - 2 : input_height - 1;
|
||||
|
||||
uint32_t last_middle_row = bottom_input_row - 2;
|
||||
uint32_t last_middle_row = bottom_input_row - 2;
|
||||
|
||||
end_row = minimum( last_middle_row, end_row);
|
||||
|
||||
|
@ -2346,14 +2346,13 @@ CODEC_ERROR EncodeHighpassBandRowRuns(BITSTREAM *stream, ENCODER_CODESET *codese
|
|||
// The encoder uses the codebooks for magnitudes and runs of zeros
|
||||
const MAGS_TABLE *mags_table = codeset->mags_table;
|
||||
const RUNS_TABLE *runs_table = codeset->runs_table;
|
||||
int runs_table_length = runs_table->length;
|
||||
uint32_t runs_table_length = runs_table->length;
|
||||
RLC *rlc = (RLC *)((uint8_t *)runs_table + sizeof(RUNS_TABLE));
|
||||
|
||||
// The band is terminated by the band end codeword in the codebook
|
||||
const CODEBOOK *codebook = codeset->codebook;
|
||||
|
||||
PIXEL *rowptr = data;
|
||||
int count = 0;
|
||||
|
||||
// Convert the pitch to units of pixels
|
||||
assert((pitch % sizeof(PIXEL)) == 0);
|
||||
|
@ -2379,15 +2378,16 @@ CODEC_ERROR EncodeHighpassBandRowRuns(BITSTREAM *stream, ENCODER_CODESET *codese
|
|||
uint8_t* stream_buffer = (uint8_t *)bit_stream->location.memory.buffer + bit_stream->byte_count;
|
||||
uint8_t* stream_buffer_orig = stream_buffer;
|
||||
|
||||
uint32_t count = 0;
|
||||
for (row = 0; row < height; row++)
|
||||
{
|
||||
int index = 0; // Start at the beginning of the row
|
||||
uint32_t index = 0; // Start at the beginning of the row
|
||||
|
||||
// Search the row for runs of zeros and nonzero values
|
||||
while (1)
|
||||
{
|
||||
// Loop invariant
|
||||
assert(0 <= index && index < width);
|
||||
assert(index < width);
|
||||
|
||||
{
|
||||
PIXEL* start = rowptr + index;
|
||||
|
@ -2398,7 +2398,7 @@ CODEC_ERROR EncodeHighpassBandRowRuns(BITSTREAM *stream, ENCODER_CODESET *codese
|
|||
|
||||
}
|
||||
|
||||
int x = start - (rowptr + index);
|
||||
uint32_t x = start - (rowptr + index);
|
||||
|
||||
index += x;
|
||||
count += x;
|
||||
|
@ -2416,7 +2416,7 @@ CODEC_ERROR EncodeHighpassBandRowRuns(BITSTREAM *stream, ENCODER_CODESET *codese
|
|||
}
|
||||
else
|
||||
{
|
||||
int count_index = minimum(count, runs_table_length - 1);
|
||||
uint32_t count_index = minimum(count, runs_table_length - 1);
|
||||
assert(count_index < runs_table->length);
|
||||
|
||||
RLC rlc_val = rlc[count_index];
|
||||
|
|
|
@ -78,7 +78,7 @@ CODEC_ERROR PutSpecial(BITSTREAM *stream, const CODEBOOK *codebook, SPECIAL_MARK
|
|||
}
|
||||
|
||||
// Is this entry the special code for the marker?
|
||||
if (codebook_entry[index].value == marker) {
|
||||
if (codebook_entry[index].value == (int32_t)marker) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue