fix sign confusion

This commit is contained in:
Wim Taymans 2019-01-07 15:52:42 +01:00
parent 74e5f9fbcf
commit e918f9f77c
60 changed files with 164 additions and 146 deletions

View file

@ -453,6 +453,9 @@ typedef void (*channelmix_func_t) (void *data, int n_dst, void *dst[n_dst],
void *matrix, float v, int n_bytes);
#define ANY ((uint32_t)-1)
#define EQ ((uint32_t)-2)
static const struct channelmix_info {
uint32_t src_chan;
uint64_t src_mask;
@ -467,11 +470,11 @@ static const struct channelmix_info {
#if defined (__SSE__)
{ 2, MASK_MONO, 2, MASK_MONO, channelmix_copy_sse, FEATURE_SSE },
{ 2, MASK_STEREO, 2, MASK_STEREO, channelmix_copy_sse, FEATURE_SSE },
{ -2, 0, -2, 0, channelmix_copy_sse, FEATURE_SSE },
{ EQ, 0, EQ, 0, channelmix_copy_sse, FEATURE_SSE },
#endif
{ 2, MASK_MONO, 2, MASK_MONO, channelmix_copy, 0 },
{ 2, MASK_STEREO, 2, MASK_STEREO, channelmix_copy, 0 },
{ -2, 0, -2, 0, channelmix_copy, 0 },
{ EQ, 0, EQ, 0, channelmix_copy, 0 },
{ 1, MASK_MONO, 2, MASK_STEREO, channelmix_f32_1_2, 0 },
{ 2, MASK_STEREO, 1, MASK_MONO, channelmix_f32_2_1, 0 },
@ -501,17 +504,17 @@ static const struct channelmix_info {
{ 8, MASK_7_1, 4, MASK_QUAD, channelmix_f32_7p1_4, 0 },
{ 8, MASK_7_1, 4, MASK_3_1, channelmix_f32_7p1_3p1, 0 },
{ -1, 0, -1, 0, channelmix_f32_n_m, 0 },
{ ANY, 0, ANY, 0, channelmix_f32_n_m, 0 },
};
#define MATCH_CHAN(a,b) ((a) == -1 || (a) == (b))
#define MATCH_CHAN(a,b) ((a) == ANY || (a) == (b))
#define MATCH_FEATURES(a,b) ((a) == 0 || ((a) & (b)) != 0)
#define MATCH_MASK(a,b) ((a) == 0 || ((a) & (b)) == (b))
static const struct channelmix_info *find_channelmix_info(uint32_t src_chan, uint64_t src_mask,
uint32_t dst_chan, uint64_t dst_mask, uint32_t features)
{
int i;
size_t i;
for (i = 0; i < SPA_N_ELEMENTS(channelmix_table); i++) {
if (!MATCH_FEATURES(channelmix_table[i].features, features))
continue;

View file

@ -188,7 +188,7 @@ static int make_matrix(struct impl *this,
{
float matrix[NUM_CHAN][NUM_CHAN] = {{ 0.0f }};
uint64_t unassigned;
int i, j, matrix_encoding = MATRIX_NORMAL, c;
uint32_t i, j, matrix_encoding = MATRIX_NORMAL, c;
float clev = SQRT1_2;
float slev = SQRT1_2;
float llev = 0.5f;
@ -379,10 +379,9 @@ static int setup_convert(struct impl *this,
const struct spa_audio_info *info)
{
const struct spa_audio_info *src_info, *dst_info;
uint32_t src_chan, dst_chan;
uint32_t i, src_chan, dst_chan;
const struct channelmix_info *chanmix_info;
uint64_t src_mask, dst_mask;
int i;
if (direction == SPA_DIRECTION_INPUT) {
src_info = info;
@ -1142,7 +1141,7 @@ static int impl_node_process(struct spa_node *node)
sbuf = &inport->buffers[inio->buffer_id];
{
int i, n_bytes;
uint32_t i, n_bytes;
struct spa_buffer *sb = sbuf->outbuf, *db = dbuf->outbuf;
uint32_t n_src_datas = sb->n_datas;
uint32_t n_dst_datas = db->n_datas;

View file

@ -759,7 +759,7 @@ static const struct conv_info {
static const struct conv_info *find_conv_info(uint32_t src_fmt, uint32_t dst_fmt, uint32_t features)
{
int i;
size_t i;
for (i = 0; i < SPA_N_ELEMENTS(conv_table); i++) {
if (conv_table[i].src_fmt == src_fmt &&

View file

@ -138,7 +138,7 @@ static int setup_convert(struct impl *this)
struct spa_audio_info informat, outformat;
struct port *inport, *outport;
const struct conv_info *conv;
int i, j;
uint32_t i, j;
inport = GET_IN_PORT(this, 0);
outport = GET_OUT_PORT(this, 0);
@ -809,9 +809,9 @@ static int impl_node_process(struct spa_node *node)
struct spa_buffer *inb, *outb;
const void **src_datas;
void **dst_datas;
uint32_t n_src_datas, n_dst_datas;
int i, res = 0, n_samples = 0, maxsize;
int size = 0;
uint32_t i, n_src_datas, n_dst_datas;
int res = 0;
uint32_t n_samples, size, maxsize;
spa_return_val_if_fail(node != NULL, -EINVAL);
@ -850,7 +850,7 @@ static int impl_node_process(struct spa_node *node)
n_src_datas = inb->n_datas;
src_datas = alloca(sizeof(void*) * n_src_datas);
size = INT_MAX;
size = UINT32_MAX;
for (i = 0; i < n_src_datas; i++) {
size = SPA_MIN(size, inb->datas[0].chunk->size);
src_datas[i] = SPA_MEMBER(inb->datas[i].data, inb->datas[i].chunk->offset, void);

View file

@ -87,10 +87,10 @@ struct impl {
const struct spa_node_callbacks *callbacks;
void *user_data;
int port_count;
uint32_t port_count;
struct port in_ports[MAX_PORTS];
struct port out_ports[MAX_PORTS + 1];
int monitor_count;
uint32_t monitor_count;
bool started;
uint32_t cpu_flags;
@ -205,7 +205,7 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
struct spa_audio_info info = { 0, };
struct port *port;
struct spa_pod *format;
int i;
uint32_t i;
if (spa_pod_object_parse(param,
":", SPA_PARAM_PROFILE_format, "P", &format,
@ -330,7 +330,7 @@ impl_node_get_port_ids(struct spa_node *node,
uint32_t n_output_ids)
{
struct impl *this;
int i;
uint32_t i;
spa_return_val_if_fail(node != NULL, -EINVAL);
@ -923,12 +923,13 @@ static int impl_node_process(struct spa_node *node)
struct impl *this;
struct port *outport;
struct spa_io_buffers *outio;
int i, maxsize, res = 0, n_samples;
uint32_t i, maxsize, n_samples;
struct spa_data *sd, *dd;
struct buffer *sbuf, *dbuf;
uint32_t n_src_datas, n_dst_datas;
const void **src_datas;
void **dst_datas;
int res = 0;
spa_return_val_if_fail(node != NULL, -EINVAL);

View file

@ -40,7 +40,7 @@ static void impl_peaks_process_sse(struct resample *r, int channel,
{
struct peaks_data *pd = r->data;
float *s = src, *d = dst, m;
int i, o, end, chunk, unrolled;
uint32_t i, o, end, chunk, unrolled;
__m128 in, max, mask = _mm_set_ps1(-0.0f);
o = i = 0;

View file

@ -25,8 +25,8 @@
#include <math.h>
struct peaks_data {
unsigned o_count;
unsigned i_count;
uint32_t o_count;
uint32_t i_count;
float max_f[0];
};
@ -49,7 +49,7 @@ static void impl_peaks_process(struct resample *r, int channel,
{
struct peaks_data *pd = r->data;
float *s = src, *d = dst, m;
int i, o, end, chunk;
uint32_t i, o, end, chunk;
o = i = 0;
m = pd->max_f[channel];

View file

@ -90,7 +90,7 @@ struct impl {
struct port in_ports[1];
struct port out_ports[MAX_PORTS];
int port_count;
uint32_t port_count;
bool started;
uint32_t cpu_flags;
@ -199,7 +199,7 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
struct port *port;
struct spa_audio_info info = { 0, };
struct spa_pod *format;
int i;
uint32_t i;
if (spa_pod_object_parse(param,
":", SPA_PARAM_PROFILE_format, "P", &format,
@ -317,7 +317,7 @@ impl_node_get_port_ids(struct spa_node *node,
uint32_t n_output_ids)
{
struct impl *this;
int i;
uint32_t i;
spa_return_val_if_fail(node != NULL, -EINVAL);
@ -841,12 +841,13 @@ static int impl_node_process(struct spa_node *node)
struct impl *this;
struct port *inport;
struct spa_io_buffers *inio;
int i, j, maxsize, res = 0, n_samples;
uint32_t i, j, maxsize, n_samples;
struct spa_data *sd, *dd;
struct buffer *sbuf, *dbuf;
uint32_t n_src_datas, n_dst_datas;
const void **src_datas;
void **dst_datas;
int res = 0;
spa_return_val_if_fail(node != NULL, -EINVAL);
@ -997,7 +998,7 @@ impl_init(const struct spa_handle_factory *factory,
{
struct impl *this;
struct port *port;
int i;
uint32_t i;
spa_return_val_if_fail(factory != NULL, -EINVAL);
spa_return_val_if_fail(handle != NULL, -EINVAL);