Skip to content

Commit

Permalink
Mark some functions as cold.
Browse files Browse the repository at this point in the history
  • Loading branch information
foo86 committed Nov 30, 2015
1 parent b35fdcf commit bcba101
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 15 deletions.
5 changes: 1 addition & 4 deletions libdcadec/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,7 @@ static inline uint32_t DCA_MEM32NE(const void *data)

void dca_format_log(dcadec_log_cb cb, void *cbarg, int level,
const char *file, int line, const char *fmt, ...)
#ifdef __GNUC__
__attribute__((format(printf, 6, 7)))
#endif
;
__attribute__((format(printf, 6, 7)));

#define dca_log(lvl, obj, ...) \
do { \
Expand Down
4 changes: 4 additions & 0 deletions libdcadec/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
typedef __int64 off_t;
#endif

#ifndef __GNUC__
#define __attribute__(x)
#endif

#define AT_LEAST_GCC(major, minor) \
(defined __GNUC__) && ((__GNUC__ > (major)) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))

Expand Down
6 changes: 3 additions & 3 deletions libdcadec/core_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ int core_parse(struct core_decoder *core, uint8_t *data, size_t size,
int core_parse_exss(struct core_decoder *core, uint8_t *data, size_t size,
int flags, struct exss_asset *asset);
int core_filter(struct core_decoder *core, int flags);
void core_clear(struct core_decoder *core);
struct dcadec_core_info *core_get_info(struct core_decoder *core);
struct dcadec_exss_info *core_get_info_exss(struct core_decoder *core);
void core_clear(struct core_decoder *core) __attribute__((cold));
struct dcadec_core_info *core_get_info(struct core_decoder *core) __attribute__((cold));
struct dcadec_exss_info *core_get_info_exss(struct core_decoder *core) __attribute__((cold));

#endif
5 changes: 3 additions & 2 deletions libdcadec/dca_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,9 @@ static int validate_hd_ma_frame(struct dcadec_context *dca)
static void force_lossy_output(struct core_decoder *core, struct xll_chset *c)
{
// Clear all band data
for (int band = 0; band < c->nfreqbands; band++)
xll_clear_band_data(c, band);
xll_clear_band_data(c, XLL_BAND_0);
if (c->nfreqbands > 1)
xll_clear_band_data(c, XLL_BAND_1);

// Clear decimator history and scalable LSBs
memset(c->deci_history, 0, sizeof(c->deci_history));
Expand Down
2 changes: 1 addition & 1 deletion libdcadec/exss_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ struct exss_parser {
extern const uint32_t exss_sample_rates[16];

int exss_parse(struct exss_parser *exss, uint8_t *data, size_t size);
struct dcadec_exss_info *exss_get_info(struct exss_parser *exss);
struct dcadec_exss_info *exss_get_info(struct exss_parser *exss) __attribute__((cold));

#endif
2 changes: 1 addition & 1 deletion libdcadec/idct.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct idct_context {
double mod64_c[MOD64_C_SIZE];
};

struct idct_context *idct_init(struct core_decoder *parent);
struct idct_context *idct_init(struct core_decoder *parent) __attribute__((cold));

void idct_perform32_float(const struct idct_context * restrict idct,
double * restrict input, double * restrict output);
Expand Down
5 changes: 3 additions & 2 deletions libdcadec/interpolator.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ struct interpolator {
interpolate_sub_cb interpolate;
};

struct interpolator *interpolator_create(struct idct_context *parent, int flags);
void interpolator_clear(struct interpolator *dsp);
struct interpolator *interpolator_create(struct idct_context *parent, int flags)
__attribute__((cold));
void interpolator_clear(struct interpolator *dsp) __attribute__((cold));

#define INTERPOLATE_LFE(x) \
void interpolate_##x(int *pcm_samples, int *lfe_samples, \
Expand Down
4 changes: 2 additions & 2 deletions libdcadec/xll_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ struct xll_decoder {
int pbr_delay;
};

void xll_clear_band_data(struct xll_chset *chs, int band);
void xll_clear_band_data(struct xll_chset *chs, int band) __attribute__((cold));
void xll_filter_band_data(struct xll_chset *chs, int band);
int xll_get_lsb_width(struct xll_chset *chs, int band, int ch);
void xll_assemble_msbs_lsbs(struct xll_chset *chs, int band);
int xll_assemble_freq_bands(struct xll_chset *chs);
int xll_map_ch_to_spkr(struct xll_chset *chs, int ch);
int xll_parse(struct xll_decoder *xll, uint8_t *data, size_t size, struct exss_asset *asset);
void xll_clear(struct xll_decoder *xll);
void xll_clear(struct xll_decoder *xll) __attribute__((cold));

#endif

0 comments on commit bcba101

Please sign in to comment.