(libFLAC) use retro_miscellaneous MIN/MAX

This commit is contained in:
twinaphex 2018-01-31 14:40:47 +01:00
parent 761f172367
commit ebb65cd781
4 changed files with 19 additions and 9 deletions

View File

@ -34,6 +34,8 @@
# include <config.h>
#endif
#include <retro_miscellaneous.h>
#include <stdlib.h>
#include <string.h>
#include "private/bitmath.h"
@ -516,7 +518,7 @@ FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits)
FLAC__uint32 x;
if(n != 0) {
m = flac_min(8-n, bits);
m = MIN(8-n, bits);
if(!FLAC__bitreader_read_raw_uint32(br, &x, m))
return false;
bits -= m;

14
deps/libFLAC/fixed.c vendored
View File

@ -34,6 +34,8 @@
# include <config.h>
#endif
#include <retro_miscellaneous.h>
#include <math.h>
#include <string.h>
#include "share/compat.h"
@ -235,11 +237,11 @@ unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned d
error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save;
}
if(total_error_0 < flac_min(flac_min(flac_min(total_error_1, total_error_2), total_error_3), total_error_4))
if(total_error_0 < MIN(MIN(MIN(total_error_1, total_error_2), total_error_3), total_error_4))
order = 0;
else if(total_error_1 < flac_min(flac_min(total_error_2, total_error_3), total_error_4))
else if(total_error_1 < MIN(MIN(total_error_2, total_error_3), total_error_4))
order = 1;
else if(total_error_2 < flac_min(total_error_3, total_error_4))
else if(total_error_2 < MIN(total_error_3, total_error_4))
order = 2;
else if(total_error_3 < total_error_4)
order = 3;
@ -297,11 +299,11 @@ unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsig
error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save;
}
if(total_error_0 < flac_min(flac_min(flac_min(total_error_1, total_error_2), total_error_3), total_error_4))
if(total_error_0 < MIN(MIN(MIN(total_error_1, total_error_2), total_error_3), total_error_4))
order = 0;
else if(total_error_1 < flac_min(flac_min(total_error_2, total_error_3), total_error_4))
else if(total_error_1 < MIN(MIN(total_error_2, total_error_3), total_error_4))
order = 1;
else if(total_error_2 < flac_min(total_error_3, total_error_4))
else if(total_error_2 < MIN(total_error_3, total_error_4))
order = 2;
else if(total_error_3 < total_error_4)
order = 3;

View File

@ -37,6 +37,9 @@
#include <stdio.h>
#include <stdlib.h> /* for qsort() */
#include <string.h> /* for memset() */
#include <retro_miscellaneous.h>
#include "FLAC/assert.h"
#include "FLAC/format.h"
#include "share/alloc.h"
@ -538,7 +541,7 @@ unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned block
max_rice_partition_order++;
blocksize >>= 1;
}
return flac_min(FLAC__MAX_RICE_PARTITION_ORDER, max_rice_partition_order);
return MIN(FLAC__MAX_RICE_PARTITION_ORDER, max_rice_partition_order);
}
unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order)

View File

@ -39,6 +39,9 @@
#include <string.h> /* for memset/memcpy() */
#include <sys/stat.h> /* for stat() */
#include <sys/types.h> /* for off_t */
#include <retro_miscellaneous.h>
#include "share/compat.h"
#include "FLAC/assert.h"
#include "share/alloc.h"
@ -2758,7 +2761,7 @@ FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, unsigne
/* invalid predictor and partition orders mush be handled in the callers */
FLAC__ASSERT(partition_order > 0? partition_samples >= predictor_order : decoder->private_->frame.header.blocksize >= predictor_order);
if(!FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(partitioned_rice_contents, flac_max(6u, partition_order))) {
if(!FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(partitioned_rice_contents, MAX(6u, partition_order))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}