build: Silence a pile of set-but-not-used warnings in codecs

GCC16 is stricter about reporting these, and while we can rely on
the compiler to optimize away dead stores, we're better off eliminating
them from the source code.

Change-Id: I14570a986811a77ca656c60d792593ff8c458571
This commit is contained in:
Solomon Peachy 2026-05-17 08:06:23 -04:00
parent 8abc859c32
commit 39497d1c74
7 changed files with 67 additions and 61 deletions

View file

@ -68,7 +68,7 @@ enum codec_status codec_run(void)
{
int datasize, res, consumed, i, time_offset;
uint16_t fs,sps,h;
uint32_t packet_count;
// uint32_t packet_count;
int spn, packet_header_size, scrambling_unit_size, num_units, elapsed;
int playback_on = -1;
size_t resume_offset;
@ -91,7 +91,7 @@ enum codec_status codec_run(void)
ci->seek_buffer(0);
init_rm(&rmctx);
ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency);
ci->configure(DSP_SET_SAMPLE_DEPTH, 17); /* Remark: atrac3 uses s15.0 by default, s15.2 was hacked. */
ci->configure(DSP_SET_STEREO_MODE, rmctx.nb_channels == 1 ?
@ -99,7 +99,7 @@ enum codec_status codec_run(void)
packet_header_size = PACKET_HEADER_SIZE +
((rmctx.flags & RM_PKT_V1) ? 1 : 0);
packet_count = rmctx.nb_packets;
// packet_count = rmctx.nb_packets;
rmctx.audio_framesize = rmctx.block_align;
rmctx.block_align = rmctx.sub_packet_size;
fs = rmctx.audio_framesize;
@ -113,7 +113,7 @@ enum codec_status codec_run(void)
DEBUGF("failed to initialize RM atrac decoder\n");
return CODEC_ERROR;
}
/* check for a mid-track resume and force a seek time accordingly */
if(resume_offset) {
resume_offset -= MIN(resume_offset, rmctx.data_offset + DATA_HEADER_SIZE);
@ -134,10 +134,10 @@ enum codec_status codec_run(void)
ci->advance_buffer(rmctx.data_offset + DATA_HEADER_SIZE);
/* The main decoder loop */
seek_start :
/* The main decoder loop */
seek_start :
while((unsigned)elapsed < rmctx.duration)
{
{
consumed = request_packet(scrambling_unit_size);
if (!consumed)
break;
@ -152,7 +152,7 @@ seek_start :
}
for (i = 0; i < spn; i++)
{
{
if (action == CODEC_ACTION_NULL)
action = ci->get_command(&param);
@ -165,10 +165,10 @@ seek_start :
ci->set_elapsed(ci->id3->length);
ci->seek_complete();
return CODEC_OK;
}
}
ci->seek_buffer(rmctx.data_offset + DATA_HEADER_SIZE);
packet_count = rmctx.nb_packets;
// packet_count = rmctx.nb_packets;
rmctx.audio_pkt_cnt = 0;
rmctx.frame_number = 0;
@ -178,8 +178,8 @@ seek_start :
ci->set_elapsed(0);
ci->seek_complete();
action = CODEC_ACTION_NULL;
goto seek_start;
}
goto seek_start;
}
num_units = (param/(sps*1000*8/rmctx.bit_rate))/spn;
ci->seek_buffer(rmctx.data_offset + DATA_HEADER_SIZE + scrambling_unit_size * num_units);
consumed = request_packet(scrambling_unit_size);
@ -195,8 +195,8 @@ seek_start :
return CODEC_OK;
}
packet_count = rmctx.nb_packets - h * num_units;
rmctx.frame_number = (param/(sps*1000*8/rmctx.bit_rate));
// packet_count = rmctx.nb_packets - h * num_units;
rmctx.frame_number = (param/(sps*1000*8/rmctx.bit_rate));
while (rmctx.audiotimestamp > (unsigned)param && num_units-- > 0) {
rmctx.audio_pkt_cnt = 0;
ci->seek_buffer(rmctx.data_offset + DATA_HEADER_SIZE + scrambling_unit_size * num_units);
@ -213,7 +213,7 @@ seek_start :
return CODEC_OK;
}
packet_count += h;
// packet_count += h;
}
if (num_units < 0)
@ -222,12 +222,12 @@ seek_start :
i = (time_offset/((sps * 8 * 1000)/rmctx.bit_rate));
elapsed = param;
ci->set_elapsed(elapsed);
ci->seek_complete();
ci->seek_complete();
}
action = CODEC_ACTION_NULL;
if(pkt.length)
if(pkt.length)
res = atrac3_decode_frame(sps, &q, &datasize, pkt.frames[i], sps);
else /* indicates that there are no remaining frames */
return CODEC_OK;
@ -244,7 +244,7 @@ seek_start :
ci->set_elapsed(elapsed);
rmctx.frame_number++;
}
packet_count -= h;
// packet_count -= h;
rmctx.audio_pkt_cnt = 0;
ci->advance_buffer(scrambling_unit_size);
}

View file

@ -468,7 +468,9 @@ enum codec_status codec_run(void)
size_t bytesleft;
int consumed;
int res;
#ifdef LOGF_ENABLE
int frame;
#endif
intptr_t param;
if (codec_init()) {
@ -503,7 +505,9 @@ enum codec_status codec_run(void)
ci->set_elapsed(elapsedtime);
/* The main decoding loop */
#ifdef LOGF_ENABLE
frame=0;
#endif
buf = ci->request_buffer(&bytesleft, MAX_FRAMESIZE);
while (bytesleft) {
long action = ci->get_command(&param);
@ -529,7 +533,9 @@ enum codec_status codec_run(void)
return CODEC_ERROR;
}
consumed=fc.gb.index/8;
#ifdef LOGF_ENABLE
frame++;
#endif
ci->yield();
ci->pcmbuf_insert(&fc.decoded[0][fc.sample_skip], &fc.decoded[1][fc.sample_skip],

View file

@ -48,7 +48,7 @@ static unsigned short get_short_le(void* buf)
(((bits) != 0x03) ? ((bits) != 0x02) ? ((bits) != 0x01) ? \
0 : *(data) : get_short_le(data) : get_long_le(data))
int asf_read_packet(uint8_t** audiobuf, int* audiobufsize, int* packetlength,
int asf_read_packet(uint8_t** audiobuf, int* audiobufsize, int* packetlength,
asf_waveformatex_t* wfx)
{
uint8_t tmp8, packet_flags, packet_property;
@ -306,10 +306,10 @@ int asf_get_timestamp(int *duration)
uint32_t padding_length;
*/
uint32_t send_time;
static int packet_count = 0;
// static int packet_count = 0;
uint32_t bytesread = 0;
packet_count++;
// packet_count++;
if (ci->read_filebuf(&tmp8, 1) == 0) {
DEBUGF("ASF ERROR (EOF?)\n");
return ASF_ERROR_EOF;

View file

@ -6,7 +6,7 @@
* This is the quicktime container demuxer.
*
* http://crazney.net/programs/itunes/alac.html
*
*
* 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
@ -58,7 +58,7 @@ static void read_chunk_ftyp(qtmovie_t *qtmovie, size_t chunk_len)
{
size_t size_remaining = chunk_len - 8;
// filetype (supported ignore case values: m4a, m4b, mp42, 3gp6, qt, isom)
// filetype (supported ignore case values: m4a, m4b, mp42, 3gp6, qt, isom)
char filetype[4];
stream_read(qtmovie->stream, 4, filetype);
size_remaining-=4;
@ -137,12 +137,12 @@ static bool read_chunk_esds(qtmovie_t *qtmovie, size_t chunk_len)
{
return false;
}
/* read length */
qtmovie->res->codecdata_len = mp4ff_read_mp4_descr_length(qtmovie->stream);
if (qtmovie->res->codecdata_len > MAX_CODECDATA_SIZE)
{
DEBUGF("codecdata too large (%d) in esds\n",
DEBUGF("codecdata too large (%d) in esds\n",
(int)qtmovie->res->codecdata_len);
return false;
}
@ -158,20 +158,21 @@ static bool read_chunk_stsd(qtmovie_t *qtmovie, size_t chunk_len)
unsigned int i;
int j;
uint32_t numentries;
size_t size_remaining = chunk_len - 8;
// size_t size_remaining = chunk_len - 8;
bool got_codec_data = false;
(void)chunk_len;
/* version */
stream_read_uint8(qtmovie->stream);
size_remaining -= 1;
// size_remaining -= 1;
/* flags */
stream_read_uint8(qtmovie->stream);
stream_read_uint8(qtmovie->stream);
stream_read_uint8(qtmovie->stream);
size_remaining -= 3;
// size_remaining -= 3;
numentries = stream_read_uint32(qtmovie->stream);
size_remaining -= 4;
// size_remaining -= 4;
/* if (numentries != 1)
{
@ -219,7 +220,7 @@ static bool read_chunk_stsd(qtmovie_t *qtmovie, size_t chunk_len)
qtmovie->res->codecdata_len = entry_remaining + 12 + 8;
if (qtmovie->res->codecdata_len > MAX_CODECDATA_SIZE)
{
DEBUGF("codecdata too large (%d) in stsd\n",
DEBUGF("codecdata too large (%d) in stsd\n",
(int)qtmovie->res->codecdata_len);
return false;
}
@ -335,7 +336,7 @@ static bool read_chunk_stts(qtmovie_t *qtmovie, size_t chunk_len)
DEBUGF("ehm, size remianing?\n");
stream_skip(qtmovie->stream, size_remaining);
}
return true;
}
@ -399,7 +400,7 @@ static bool read_chunk_stsz(qtmovie_t *qtmovie, size_t chunk_len)
{
stream_skip(qtmovie->stream, size_remaining);
}
return true;
}
@ -421,7 +422,7 @@ static bool read_chunk_stsc(qtmovie_t *qtmovie, size_t chunk_len)
{
stream_skip(qtmovie->stream, size_remaining);
}
return true;
}
@ -483,14 +484,14 @@ static bool read_chunk_stco(qtmovie_t *qtmovie, size_t chunk_len)
/* Build up lookup table. The lookup table contains the sample index and
* byte position in the file for each chunk. This table is used to seek
* and resume (see m4a_seek() and m4a_seek_raw() in libm4a/m4a.c) and
* and resume (see m4a_seek() and m4a_seek_raw() in libm4a/m4a.c) and
* to skip empty chunks (see m4a_check_sample_offset() in codecs/aac.c and
* libm4a/m4a.c).
* The seek/resume precision is lower than using sample_byte_size[] and
* The seek/resume precision is lower than using sample_byte_size[] and
* depends on numentries. Typically the resolution is ~1/10 of all frames
* which equals about 1/4-1/2 seconds. The loss of seek precision is
* accepted to be able to avoid allocation of the large sample_byte_size[]
* table. This reduces the memory consumption by a factor of 2 or even
* which equals about 1/4-1/2 seconds. The loss of seek precision is
* accepted to be able to avoid allocation of the large sample_byte_size[]
* table. This reduces the memory consumption by a factor of 2 or even
* more. */
uint32_t idx = 0;
for (i = 0; i < numentries; ++i)
@ -527,10 +528,10 @@ static bool read_chunk_stco(qtmovie_t *qtmovie, size_t chunk_len)
stream_read_sample_to_chunk(qtmovie->stream, &new_first, &new_frame);
old_i = i;
}
if (new_first > k)
break;
frame += (new_first - old_first) * old_frame;
}
@ -551,7 +552,7 @@ static bool read_chunk_stco(qtmovie_t *qtmovie, size_t chunk_len)
DEBUGF("ehm, size remianing?\n");
stream_skip(qtmovie->stream, size_remaining);
}
return true;
}
@ -655,7 +656,7 @@ static bool read_chunk_minf(qtmovie_t *qtmovie, size_t chunk_len)
}
sub_chunk_id = stream_read_uint32(qtmovie->stream);
switch (sub_chunk_id)
{
case MAKEFOURCC('s','t','b','l'):
@ -866,5 +867,3 @@ int qtmovie_read(stream_t *file, demux_res_t *demux_res)
}
return 0;
}

View file

@ -910,6 +910,8 @@ static unsigned quant_band_n1(struct band_ctx *ctx, celt_norm *X, celt_norm *Y,
int encode;
ec_ctx *ec;
(void)b;
encode = ctx->encode;
ec = ctx->ec;
@ -1669,4 +1671,3 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
RESTORE_STACK;
}

View file

@ -239,7 +239,7 @@ static struct s_modplayer modplayer IDATA_ATTR; /* The Module Player */
static struct s_mixer mixer IDATA_ATTR;
/* The Amiga Period Table (+1 because we use index 0 for period 0 = no new note) */
static unsigned short s_periodtable[37*8+1] IDATA_ATTR =
static unsigned short s_periodtable[37*8+1] IDATA_ATTR =
{ 0, 907, 900, 893, 887, 881, 874, 868,
862, 856, 849, 843, 837, 831, 825, 819,
813, 808, 802, 796, 790, 785, 779, 773,
@ -280,7 +280,7 @@ static unsigned short s_periodtable[37*8+1] IDATA_ATTR =
107};
/* The sin table */
static signed short s_sintable[0x40] IDATA_ATTR =
static signed short s_sintable[0x40] IDATA_ATTR =
{ 0, 25, 49, 74, 97, 120, 141, 162,
180, 197, 212, 225, 235, 244, 250, 254,
255, 254, 250, 244, 235, 225, 212, 197,
@ -352,7 +352,7 @@ void initmodplayer(void)
{
unsigned int c;
#if 0
/* As the calculation of periodtable and sintable uses float and double
/* As the calculation of periodtable and sintable uses float and double
* rockbox uses two predefined tables. This reduces the codesize by
* several KB. */
@ -506,13 +506,13 @@ bool loadmod(void *modfile)
/* use 'restartposition' (historically set to 127) which is not used here
as a marker that periods have already been converted */
periodsconverted = (char*)modfile + 20 + modsong.noofinstruments*30 + 1;
periodsconverted = (char*)modfile + 20 + modsong.noofinstruments*30 + 1;
/* Get the pattern data; ST doesn't have fileformattag, so 4 bytes less */
modsong.patterndata = periodsconverted +
(modsong.noofinstruments==15 ? 129 : 133);
modsong.patterndata = periodsconverted +
(modsong.noofinstruments==15 ? 129 : 133);
/* Convert the period values in the mod file to offsets
* in our periodtable (but only, if we haven't done this yet) */
p = (unsigned char *) modsong.patterndata;
@ -538,9 +538,9 @@ bool loadmod(void *modfile)
p += 4;
}
/* Remember that we already converted the periods,
* in case the file gets reloaded by rewinding
* in case the file gets reloaded by rewinding
* with 0xfe (arbitary magic value > 127) */
*periodsconverted = 0xfe;
*periodsconverted = 0xfe;
}
/* Get the samples
@ -1299,7 +1299,7 @@ enum codec_status codec_run(void)
size_t n;
unsigned char *modfile;
int old_patterntableposition;
int bytesdone;
// int bytesdone;
intptr_t param;
if (codec_init()) {
@ -1329,7 +1329,7 @@ enum codec_status codec_run(void)
ci->set_elapsed(modplayer.patterntableposition*1000);
bytesdone = 0;
// bytesdone = 0;
old_patterntableposition = 0;
while (1) {
@ -1352,7 +1352,7 @@ enum codec_status codec_run(void)
synthrender(samples, CHUNK_SIZE/2);
bytesdone += CHUNK_SIZE;
// bytesdone += CHUNK_SIZE;
ci->pcmbuf_insert(samples, NULL, CHUNK_SIZE/2);

View file

@ -473,7 +473,7 @@ next_page:
/* Loop for all complete pages we got (most likely only one) */
while (spx_ogg_sync_pageout(&oy, &og) == 1) {
int packet_no;
// int packet_no;
if (stream_init == 0) {
spx_ogg_stream_init(&os, spx_ogg_page_serialno(&og));
stream_init = 1;
@ -488,7 +488,7 @@ next_page:
cur_granule = page_granule;
/* Extract all available packets */
packet_no=0;
// packet_no=0;
while (!eos && spx_ogg_stream_packetout(&os, &op)==1){
/* If first packet, process as Speex header */
@ -531,7 +531,7 @@ next_page:
goto next_page;
}
}
packet_no++;
// packet_no++;
if (op.e_o_s) /* End of stream condition */
eos=1;