Skip to content

Commit

Permalink
tidy: Mark parameters 'const' where possible. (libs)
Browse files Browse the repository at this point in the history
Clang-tidy pointed out where the parameters to functions could be
marked 'const' to gain additional compiler checking.  Changes
initially made by the clang-tidy program.  That program doesn't
understand assembly, so a number of automatic changes to MMX related
functions had to be removed.

These problems were pointed out by clang-tidy's "non-const parameter"
check.

https://clang.llvm.org/extra/clang-tidy/checks/readability-non-const-parameter.html
  • Loading branch information
linuxdude42 committed Mar 19, 2019
1 parent 9d9104c commit b432952
Show file tree
Hide file tree
Showing 29 changed files with 105 additions and 104 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/audiooutputdownmix.cpp
Expand Up @@ -165,7 +165,7 @@ static const float s51_matrix[3][8][6] =
};

int AudioOutputDownmix::DownmixFrames(int channels_in, int channels_out,
float *dst, float *src, int frames)
float *dst, const float *src, int frames)
{
if (channels_in < channels_out)
return -1;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/audiooutputdownmix.h
Expand Up @@ -5,7 +5,7 @@ class AudioOutputDownmix
{
public:
static int DownmixFrames(int channels_in, int channels_out,
float *dst, float *src, int frames);
float *dst, const float *src, int frames);
};

#endif
4 changes: 2 additions & 2 deletions mythtv/libs/libmyth/audio/audiooutputjack.cpp
Expand Up @@ -255,8 +255,8 @@ int AudioOutputJACK::GetBufferedOnSoundcard(void) const
nframes: number of frames of output required
Output: bufs: non interleaved float values.
*/
void AudioOutputJACK::DeinterleaveAudio(float *aubuf, float **bufs, int nframes,
int* channel_volumes)
void AudioOutputJACK::DeinterleaveAudio(const float *aubuf, float **bufs, int nframes,
const int* channel_volumes)
{
// Convert to floats and de-interleave
// TODO: Implicit assumption dealing with float input only.
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmyth/audio/audiooutputjack.h
Expand Up @@ -55,8 +55,8 @@ class AudioOutputJACK : public AudioOutputBase
bool _jack_connect_ports(const char** /*matching_ports*/);
inline void _jack_client_close(jack_client_t **client);

void DeinterleaveAudio(float *aubuf, float **bufs,
int nframes, int* channel_volumes);
void DeinterleaveAudio(const float *aubuf, float **bufs,
int nframes, const int* channel_volumes);

jack_port_t *m_ports[JACK_CHANNELS_MAX];
int m_chan_volumes[JACK_CHANNELS_MAX];
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythfreesurround/el_processor.cpp
Expand Up @@ -425,7 +425,7 @@ class decoder_impl {
}

// filter the complex source signal and add it to target
void apply_filter(cfloat *signal, float *flt, float *target) {
void apply_filter(cfloat *signal, const float *flt, float *target) {
// filter the signal
unsigned f;
for (f=0;f<=halfN;f++) {
Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythmpeg2/idct_mmx.c
Expand Up @@ -90,7 +90,7 @@ static inline void idct_row (int16_t * row, int offset,
c5, -c1, c3, -c1, \
c7, c3, c7, -c5 }

static inline void mmxext_row_head (int16_t * const row, const int offset,
static inline void mmxext_row_head (const int16_t * const row, const int offset,
const int16_t * const table)
{
movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */
Expand Down Expand Up @@ -205,7 +205,7 @@ static inline void mmxext_row_mid (int16_t * const row, const int store,
c5, -c1, c7, -c5, \
c7, c3, c3, -c1 }

static inline void mmx_row_head (int16_t * const row, const int offset,
static inline void mmx_row_head (const int16_t * const row, const int offset,
const int16_t * const table)
{
movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */
Expand Down Expand Up @@ -602,7 +602,7 @@ do { \
packuswb_r2r (r1, r0); \
} while (0)

static inline void block_copy (int16_t * const block, uint8_t * dest,
static inline void block_copy (const int16_t * const block, uint8_t * dest,
const int stride)
{
movq_m2r (*(block+0*8), mm0);
Expand Down Expand Up @@ -635,7 +635,7 @@ do { \
paddsw_m2r (*(block+offset+4), r2); \
} while (0)

static inline void block_add (int16_t * const block, uint8_t * dest,
static inline void block_add (const int16_t * const block, uint8_t * dest,
const int stride)
{
movq_m2r (*dest, mm1);
Expand Down
5 changes: 3 additions & 2 deletions mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp
Expand Up @@ -2180,8 +2180,9 @@ uint DVDRingBuffer::TitleTimeLeft(void)

/** \brief converts palette values from YUV to RGB
*/
void DVDRingBuffer::guess_palette(uint32_t *rgba_palette,uint8_t *palette,
uint8_t *alpha)
void DVDRingBuffer::guess_palette(uint32_t *rgba_palette,
const uint8_t *palette,
const uint8_t *alpha)
{
memset(rgba_palette, 0, 16);

Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/DVD/dvdringbuffer.h
Expand Up @@ -305,8 +305,8 @@ class MTV_PUBLIC DVDRingBuffer : public RingBuffer
int get_nibble(const uint8_t *buf, int nibble_offset);
int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
const uint8_t *buf, int nibble_offset, int buf_size);
void guess_palette(uint32_t *rgba_palette,uint8_t *palette,
uint8_t *alpha);
void guess_palette(uint32_t *rgba_palette,const uint8_t *palette,
const uint8_t *alpha);
int is_transp(const uint8_t *buf, int pitch, int n,
const uint8_t *transp_color);
int find_smallest_bounding_rectangle(AVSubtitle *s);
Expand Down
44 changes: 22 additions & 22 deletions mythtv/libs/libmythtv/blend.c
Expand Up @@ -13,12 +13,12 @@ static const mmx_t mm_cpool[] =
{ .uw = {257, 257, 257, 257} }
};

void blendregion_mmx (uint8_t * ysrc, uint8_t * usrc, uint8_t * vsrc,
uint8_t * asrc, int srcstrd,
void blendregion_mmx (const uint8_t * ysrc, const uint8_t * usrc,
const uint8_t * vsrc, const uint8_t * asrc, int srcstrd,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256])
const int16_t rec_lut[256], uint8_t pow_lut[256][256])
{
int x, y, i, alpha, newalpha;
mmx_t amod = { .uw = {alphamod, alphamod, alphamod, alphamod} };
Expand Down Expand Up @@ -238,11 +238,11 @@ void blendcolumn2_mmx (uint8_t * ysrc1, uint8_t * usrc1, uint8_t * vsrc1,
uint8_t * asrc1, int srcstrd1,
uint8_t * ysrc2, uint8_t * usrc2, uint8_t * vsrc2,
uint8_t * asrc2, int srcstrd2,
uint8_t * mask,
const uint8_t * mask,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256])
const int16_t rec_lut[256], uint8_t pow_lut[256][256])
{
int x, y, i, alpha, newalpha;
mmx_t amod = { .uw = {alphamod, alphamod, alphamod, alphamod} };
Expand Down Expand Up @@ -557,11 +557,11 @@ void blendcolumn2_mmx (uint8_t * ysrc1, uint8_t * usrc1, uint8_t * vsrc1,
}

void blendcolor_mmx (uint8_t ysrc, uint8_t usrc, uint8_t vsrc,
uint8_t * asrc, int srcstrd,
const uint8_t * asrc, int srcstrd,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256])
const int16_t rec_lut[256], uint8_t pow_lut[256][256])
{
int x, y, i, alpha, newalpha;
mmx_t amod = { .uw = {alphamod, alphamod, alphamod, alphamod} };
Expand Down Expand Up @@ -777,7 +777,7 @@ void blendconst_mmx (uint8_t ysrc, uint8_t usrc, uint8_t vsrc,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256])
const int16_t rec_lut[256], uint8_t pow_lut[256][256])
{
int x, y, i, alpha, newalpha;
mmx_t ysrcm = { .uw = {ysrc, ysrc, ysrc, ysrc} };
Expand Down Expand Up @@ -975,12 +975,12 @@ void blendconst_mmx (uint8_t ysrc, uint8_t usrc, uint8_t vsrc,
emms();
}

void blendcolumn_mmx (uint8_t * ysrc, uint8_t * usrc, uint8_t * vsrc,
uint8_t * asrc, int srcstrd,
void blendcolumn_mmx (const uint8_t * ysrc, const uint8_t * usrc,
const uint8_t * vsrc, const uint8_t * asrc, int srcstrd,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256])
const int16_t rec_lut[256], uint8_t pow_lut[256][256])
{
int x, y, i, alpha, newalpha;
mmx_t amod = { .uw = {alphamod, alphamod, alphamod, alphamod} };
Expand Down Expand Up @@ -1214,12 +1214,12 @@ void blendcolumn_mmx (uint8_t * ysrc, uint8_t * usrc, uint8_t * vsrc,
}
#endif /*MMX*/

void blendregion (uint8_t * ysrc, uint8_t * usrc, uint8_t * vsrc,
uint8_t * asrc, int srcstrd,
void blendregion (const uint8_t * ysrc, const uint8_t * usrc,
const uint8_t * vsrc, const uint8_t * asrc, int srcstrd,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256])
const int16_t rec_lut[256], uint8_t pow_lut[256][256])
{
int newalpha, alpha;
int x, y;
Expand Down Expand Up @@ -1273,11 +1273,11 @@ void blendcolumn2 (uint8_t * ysrc1, uint8_t * usrc1, uint8_t * vsrc1,
uint8_t * asrc1, int srcstrd1,
uint8_t * ysrc2, uint8_t * usrc2, uint8_t * vsrc2,
uint8_t * asrc2, int srcstrd2,
uint8_t * mask,
const uint8_t * mask,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256])
const int16_t rec_lut[256], uint8_t pow_lut[256][256])
{
int newalpha, alpha;
int x, y;
Expand Down Expand Up @@ -1359,11 +1359,11 @@ void blendcolumn2 (uint8_t * ysrc1, uint8_t * usrc1, uint8_t * vsrc1,
}

void blendcolor (uint8_t ysrc, uint8_t usrc, uint8_t vsrc,
uint8_t * asrc, int srcstrd,
const uint8_t * asrc, int srcstrd,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256])
const int16_t rec_lut[256], uint8_t pow_lut[256][256])
{
int newalpha, alpha;
int x, y;
Expand Down Expand Up @@ -1414,7 +1414,7 @@ void blendconst (uint8_t ysrc, uint8_t usrc, uint8_t vsrc,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256])
const int16_t rec_lut[256], uint8_t pow_lut[256][256])
{
int newalpha, alpha;
int x, y;
Expand Down Expand Up @@ -1458,12 +1458,12 @@ void blendconst (uint8_t ysrc, uint8_t usrc, uint8_t vsrc,
}
}

void blendcolumn (uint8_t * ysrc, uint8_t * usrc, uint8_t * vsrc,
uint8_t * asrc, int srcstrd,
void blendcolumn (const uint8_t * ysrc, const uint8_t * usrc,
const uint8_t * vsrc, const uint8_t * asrc, int srcstrd,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256])
const int16_t rec_lut[256], uint8_t pow_lut[256][256])
{
int newalpha, alpha;
int x, y;
Expand Down
44 changes: 22 additions & 22 deletions mythtv/libs/libmythtv/blend.h
Expand Up @@ -46,82 +46,82 @@ typedef void (*blendconst_ptr) (uint8_t, uint8_t, uint8_t, uint8_t,
uint8_t[256][256]);

#ifdef MMX
void blendregion_mmx (uint8_t * ysrc, uint8_t * usrc, uint8_t * vsrc,
uint8_t * asrc, int srcstrd,
void blendregion_mmx (const uint8_t * ysrc, const uint8_t * usrc,
const uint8_t * vsrc, const uint8_t * asrc, int srcstrd,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256]);
const int16_t rec_lut[256], uint8_t pow_lut[256][256]);

void blendcolumn2_mmx (uint8_t * ysrc1, uint8_t * usrc1, uint8_t * vsrc1,
uint8_t * asrc1, int srcstrd1,
uint8_t * ysrc2, uint8_t * usrc2, uint8_t * vsrc2,
uint8_t * asrc2, int srcstrd2,
uint8_t * mask,
const uint8_t * mask,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256]);
const int16_t rec_lut[256], uint8_t pow_lut[256][256]);

void blendcolumn_mmx (uint8_t * ysrc, uint8_t * usrc, uint8_t * vsrc,
uint8_t * asrc, int srcstrd,
void blendcolumn_mmx (const uint8_t * ysrc, const uint8_t * usrc,
const uint8_t * vsrc, const uint8_t * asrc, int srcstrd,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256]);
const int16_t rec_lut[256], uint8_t pow_lut[256][256]);

void blendcolor_mmx (uint8_t ysrc, uint8_t usrc, uint8_t vsrc,
uint8_t * asrc, int srcstrd,
const uint8_t * asrc, int srcstrd,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256]);
const int16_t rec_lut[256], uint8_t pow_lut[256][256]);

void blendconst_mmx (uint8_t ysrc, uint8_t usrc, uint8_t vsrc,
uint8_t asrc,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256]);
const int16_t rec_lut[256], uint8_t pow_lut[256][256]);
#endif

void blendregion (uint8_t * ysrc, uint8_t * usrc, uint8_t * vsrc,
uint8_t * asrc, int srcstrd,
void blendregion (const uint8_t * ysrc, const uint8_t * usrc,
const uint8_t * vsrc, const uint8_t * asrc, int srcstrd,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256]);
const int16_t rec_lut[256], uint8_t pow_lut[256][256]);

void blendcolumn2 (uint8_t * ysrc1, uint8_t * usrc1, uint8_t * vsrc1,
uint8_t * asrc1, int srcstrd1,
uint8_t * ysrc2, uint8_t * usrc2, uint8_t * vsrc2,
uint8_t * asrc2, int srcstrd2,
uint8_t * mask,
const uint8_t * mask,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256]);
const int16_t rec_lut[256], uint8_t pow_lut[256][256]);

void blendcolumn (uint8_t * ysrc, uint8_t * usrc, uint8_t * vsrc,
uint8_t * asrc, int srcstrd,
void blendcolumn (const uint8_t * ysrc, const uint8_t * usrc,
const uint8_t * vsrc, const uint8_t * asrc, int srcstrd,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256]);
const int16_t rec_lut[256], uint8_t pow_lut[256][256]);

void blendcolor (uint8_t ysrc, uint8_t usrc, uint8_t vsrc,
uint8_t * asrc, int srcstrd,
const uint8_t * asrc, int srcstrd,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int alphamod, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256]);
const int16_t rec_lut[256], uint8_t pow_lut[256][256]);

void blendconst (uint8_t ysrc, uint8_t usrc, uint8_t vsrc,
uint8_t asrc,
uint8_t * ydst, uint8_t * udst, uint8_t * vdst,
uint8_t * adst, int dststrd,
int width, int height, int dochroma,
int16_t rec_lut[256], uint8_t pow_lut[256][256]);
const int16_t rec_lut[256], uint8_t pow_lut[256][256]);

#ifdef __cplusplus
}
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/dsmccbiop.cpp
Expand Up @@ -148,7 +148,7 @@ BiopMessage::~BiopMessage()
free(m_objkind);
}

bool BiopMessage::ProcessMsgHdr(unsigned char *data, unsigned long *curp)
bool BiopMessage::ProcessMsgHdr(const unsigned char *data, unsigned long *curp)
{
const unsigned char *buf = data + (*curp);
int off = 0;
Expand Down Expand Up @@ -214,7 +214,7 @@ bool BiopMessage::ProcessMsgHdr(unsigned char *data, unsigned long *curp)
*/
bool BiopMessage::ProcessDir(
bool isSrg, DSMCCCacheModuleData *cachep, DSMCCCache *filecache,
unsigned char *data, unsigned long *curp)
const unsigned char *data, unsigned long *curp)
{
int off = 0;
const unsigned char * const buf = data + (*curp);
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/dsmccbiop.h
Expand Up @@ -177,12 +177,12 @@ class BiopMessage
// Process directories and service gateways.
bool ProcessDir(bool isSrg,
DSMCCCacheModuleData *cachep, DSMCCCache *cache,
unsigned char *data, unsigned long *curp);
const unsigned char *data, unsigned long *curp);
// Process files.
bool ProcessFile(DSMCCCacheModuleData *cachep, DSMCCCache *cache,
unsigned char *data, unsigned long *curp);

bool ProcessMsgHdr(unsigned char *data, unsigned long *curp);
bool ProcessMsgHdr(const unsigned char *data, unsigned long *curp);

protected:
unsigned char m_version_major {0};
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/filter.h
Expand Up @@ -21,7 +21,7 @@ typedef struct FmtConv_

typedef struct VideoFilter_ VideoFilter;

typedef VideoFilter*(*init_filter)(int, int, int *, int *, char *, int);
typedef VideoFilter*(*init_filter)(int, int, const int *, const int *, const char *, int);

typedef struct FilterInfo_
{
Expand Down

0 comments on commit b432952

Please sign in to comment.