Displaying 20 results from an estimated 65 matches for "in_len".
2009 Aug 05
0
Bug in libspeexdsp resampler
There is a bug in "speex_resampler_process_interleaved_int" and
"speex_resampler_process_interleaved_float" in the resampler. It seems
that when "speex_resampler_process_int" is called for the first channel,
"in_len" is set to the actual number of samples used (when output
limited), which you would think would be OK to use for all the
subsequent calls to "speex_resampler_process_int" for the other
channels. However, there is some subtle difference (in the way
fractional samples are computed,...
2008 May 03
2
Resampler (no api)
...spx_uint32_t mem_alloc_size;
+ spx_uint32_t buffer_size;
int int_advance;
int frac_advance;
float cutoff;
@@ -317,47 +326,47 @@
static int resampler_basic_direct_single(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
{
- int N = st->filt_len;
+ const int N = st->filt_len;
int out_sample = 0;
- spx_word16_t *mem;
int last_sample = st->last_sample[channel_index];
spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
- mem = st-&g...
2008 May 03
0
Resampler, memory only variant
...spx_uint32_t mem_alloc_size;
+ spx_uint32_t buffer_size;
int int_advance;
int frac_advance;
float cutoff;
@@ -317,47 +326,47 @@
static int resampler_basic_direct_single(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
{
- int N = st->filt_len;
+ const int N = st->filt_len;
int out_sample = 0;
- spx_word16_t *mem;
int last_sample = st->last_sample[channel_index];
spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
- mem = st-&g...
2011 Nov 11
0
[PATCH 9/9] Decompressors: check input size in unlzo.c
...6*1024l)
#define HEADER_HAS_FILTER 0x00000800L
+#define HEADER_SIZE_MIN (9 + 7 + 4 + 8 + 1 + 4)
+#define HEADER_SIZE_MAX (9 + 7 + 1 + 8 + 8 + 4 + 1 + 255 + 4)
-static int INIT parse_header(u8 *input, u8 *skip)
+static int INIT parse_header(u8 *input, int *skip, int in_len)
{
int l;
u8 *parse = input;
+ u8 *end = input + in_len;
u8 level = 0;
u16 version;
+ /*
+ * Check that there''s enough input to possibly have a valid header.
+ * Then it is possible to parse several fields until the minimum
+ * size may have been used.
+ */
+ if (in_len <...
2009 Oct 23
0
Little bug in the libspeexdsp resampler
...er_process_interleaved_float" in the resampler have a problem.
If you call "speex_resampler_process_interleaved_int" with a small
"out_len" (and therefore is output limited), then the first time the
function calls "speex_resampler_process_int", it changes "in_len" to the
number of input samples it no longer needs to see again (I note that
this is different than the number of samples it may have *used*). The
problem is that for the second (and subsiquent) channels, while
"out_len" is reset to the original value, "in_len" is not,...
2012 May 02
1
[PATCH] resample: Fix input indexing bug from interleaved functions
...or the resampling function
wants to peek one more sample from the input buffer to produce one
more output sample, but the inputs sample is not consumed because it
is also needed to produce the next output sample. When resampling the
next channel this peeked sample is not any more available because
*in_len parameter value was updated when resampling the first channel.
Signed-off-by: Jyri Sarha <jsarha at ti.com>
---
libspeex/resample.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/libspeex/resample.c b/libspeex/resample.c
index 7957c61..d59508d 100644
---...
2020 Jun 03
2
[PATCH RFC 07/13] vhost: format-independent API for used buffers
...nt *in_num,
> + struct vhost_log *log, unsigned int *log_num)
> {
> int ret = fetch_descs(vq);
> int i;
> @@ -2311,6 +2310,8 @@ int vhost_get_vq_desc(struct vhost_virtqueue *vq,
> *out_num = *in_num = 0;
> if (unlikely(log))
> *log_num = 0;
> + buf->in_len = buf->out_len = 0;
> + buf->descs = 0;
>
> for (i = vq->first_desc; i < vq->ndescs; ++i) {
> unsigned iov_count = *in_num + *out_num;
> @@ -2340,6 +2341,7 @@ int vhost_get_vq_desc(struct vhost_virtqueue *vq,
> /* If this is an input descriptor,
>...
2020 Jun 03
2
[PATCH RFC 07/13] vhost: format-independent API for used buffers
...nt *in_num,
> + struct vhost_log *log, unsigned int *log_num)
> {
> int ret = fetch_descs(vq);
> int i;
> @@ -2311,6 +2310,8 @@ int vhost_get_vq_desc(struct vhost_virtqueue *vq,
> *out_num = *in_num = 0;
> if (unlikely(log))
> *log_num = 0;
> + buf->in_len = buf->out_len = 0;
> + buf->descs = 0;
>
> for (i = vq->first_desc; i < vq->ndescs; ++i) {
> unsigned iov_count = *in_num + *out_num;
> @@ -2340,6 +2341,7 @@ int vhost_get_vq_desc(struct vhost_virtqueue *vq,
> /* If this is an input descriptor,
>...
2020 Jun 02
0
[PATCH RFC 07/13] vhost: format-independent API for used buffers
...int iov_size,
+ unsigned int *out_num, unsigned int *in_num,
+ struct vhost_log *log, unsigned int *log_num)
{
int ret = fetch_descs(vq);
int i;
@@ -2311,6 +2310,8 @@ int vhost_get_vq_desc(struct vhost_virtqueue *vq,
*out_num = *in_num = 0;
if (unlikely(log))
*log_num = 0;
+ buf->in_len = buf->out_len = 0;
+ buf->descs = 0;
for (i = vq->first_desc; i < vq->ndescs; ++i) {
unsigned iov_count = *in_num + *out_num;
@@ -2340,6 +2341,7 @@ int vhost_get_vq_desc(struct vhost_virtqueue *vq,
/* If this is an input descriptor,
* increment that count. */
*in...
2020 Jun 04
0
[PATCH RFC 07/13] vhost: format-independent API for used buffers
...og, unsigned int *log_num)
> > {
> > int ret = fetch_descs(vq);
> > int i;
> > @@ -2311,6 +2310,8 @@ int vhost_get_vq_desc(struct vhost_virtqueue *vq,
> > *out_num = *in_num = 0;
> > if (unlikely(log))
> > *log_num = 0;
> > + buf->in_len = buf->out_len = 0;
> > + buf->descs = 0;
> > for (i = vq->first_desc; i < vq->ndescs; ++i) {
> > unsigned iov_count = *in_num + *out_num;
> > @@ -2340,6 +2341,7 @@ int vhost_get_vq_desc(struct vhost_virtqueue *vq,
> > /* If this is an input...
2011 Sep 29
1
Nothing but rhythm was left after encoding and decoding by speex on ipad(XCode 4.1 48110)
...speex_encode_int(enc_state, (short*)in_bytes, &ebits);
if(speex_bits_nbytes(&ebits) >= (int)size) {
return_value = 0;
}
else {
return_value = (int)speex_bits_write(&ebits, (char*)out_bytes, size);
}
return return_value;
}
static int speexo_decode(const void *in_bytes, int in_len, void *out_bytes)
{
if (!codec_open)
return 0;
int return_value;
speex_bits_reset(&dbits);
speex_bits_read_from(&dbits, (char *)in_bytes, in_len);
if (0 != speex_decode_int(dec_state, &dbits, (short*)out_bytes)) {
return_value = 0;
}
else {
return_value = dec_frame_size*2...
2020 Jun 03
1
[PATCH RFC 08/13] vhost/net: convert to new API: heads->bufs
...continue;
> @@ -364,18 +375,18 @@ static void vhost_zerocopy_signal_used(struct vhost_net *net,
> int j = 0;
>
> for (i = nvq->done_idx; i != nvq->upend_idx; i = (i + 1) % UIO_MAXIOV) {
> - if (vq->heads[i].len == VHOST_DMA_FAILED_LEN)
> + if (nvq->bufs[i].in_len == VHOST_DMA_FAILED_LEN)
> vhost_net_tx_err(net);
> - if (VHOST_DMA_IS_DONE(vq->heads[i].len)) {
> - vq->heads[i].len = VHOST_DMA_CLEAR_LEN;
> + if (VHOST_DMA_IS_DONE(nvq->bufs[i].in_len)) {
> + nvq->bufs[i].in_len = VHOST_DMA_CLEAR_LEN;
> ++j;
>...
2008 Mar 29
0
GCC/ELF Visibility patch
...sampler_destroy(SpeexResamplerState *st)
{
speex_free(st->mem);
speex_free(st->sinc_table);
@@ -854,7 +854,7 @@
#define FIXED_STACK_ALLOC 1024
#ifdef FIXED_POINT
-int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
+EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
{
spx_uint32_t i;
int istride_save, ostride_save;
@@ -920,16 +920,16 @@
#endif
r...
2020 Jun 08
2
[PATCH RFC v5 12/13] vhost/vsock: switch to the buf API
...d_pkt_list);
> spin_unlock_bh(&vsock->send_pkt_list_lock);
> @@ -186,7 +188,8 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
> */
> virtio_transport_deliver_tap_pkt(pkt);
>
> - vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len);
> + buf.in_len = sizeof(pkt->hdr) + payload_len;
> + vhost_put_used_buf(vq, &buf);
> added = true;
>
> pkt->off += payload_len;
> @@ -440,7 +443,8 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)
> struct vhost_vsock *vsock = container_of(vq->dev, struct...
2020 Jun 08
2
[PATCH RFC v5 12/13] vhost/vsock: switch to the buf API
...d_pkt_list);
> spin_unlock_bh(&vsock->send_pkt_list_lock);
> @@ -186,7 +188,8 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
> */
> virtio_transport_deliver_tap_pkt(pkt);
>
> - vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len);
> + buf.in_len = sizeof(pkt->hdr) + payload_len;
> + vhost_put_used_buf(vq, &buf);
> added = true;
>
> pkt->off += payload_len;
> @@ -440,7 +443,8 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)
> struct vhost_vsock *vsock = container_of(vq->dev, struct...
2008 Mar 29
2
GCC/ELF Visibility patch (fwd)
...sampler_destroy(SpeexResamplerState *st)
{
speex_free(st->mem);
speex_free(st->sinc_table);
@@ -854,7 +854,7 @@
#define FIXED_STACK_ALLOC 1024
#ifdef FIXED_POINT
-int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
+EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
{
spx_uint32_t i;
int istride_save, ostride_save;
@@ -920,16 +920,16 @@
#endif
r...
2008 Apr 05
11
[PATCH RFC 1/5] vringfd syscall
...e_vr:
+ kfree(vr);
+put_filp:
+ put_filp(filp);
+put_fd:
+ put_unused_fd(fd);
+out:
+ return err;
+}
+
+/* Returns an error, or 0 (no buffers), or an id for vring_used_buffer() */
+int vring_get_buffer(struct vring_info *vr,
+ struct iovec *in_iov,
+ unsigned int *num_in, unsigned long *in_len,
+ struct iovec *out_iov,
+ unsigned int *num_out, unsigned long *out_len)
+{
+ unsigned int i, in = 0, out = 0;
+ unsigned long dummy;
+ u16 head;
+ struct vring_desc d;
+
+ if (unlikely(get_user(head, &vr->ring.avail->idx) != 0))
+ return -EFAULT;
+
+ if (vr->last_avail...
2008 Apr 05
11
[PATCH RFC 1/5] vringfd syscall
...e_vr:
+ kfree(vr);
+put_filp:
+ put_filp(filp);
+put_fd:
+ put_unused_fd(fd);
+out:
+ return err;
+}
+
+/* Returns an error, or 0 (no buffers), or an id for vring_used_buffer() */
+int vring_get_buffer(struct vring_info *vr,
+ struct iovec *in_iov,
+ unsigned int *num_in, unsigned long *in_len,
+ struct iovec *out_iov,
+ unsigned int *num_out, unsigned long *out_len)
+{
+ unsigned int i, in = 0, out = 0;
+ unsigned long dummy;
+ u16 head;
+ struct vring_desc d;
+
+ if (unlikely(get_user(head, &vr->ring.avail->idx) != 0))
+ return -EFAULT;
+
+ if (vr->last_avail...
2020 Jun 02
0
[PATCH RFC 08/13] vhost/net: convert to new API: heads->bufs
...x1 << i);
if (!zcopy)
continue;
@@ -364,18 +375,18 @@ static void vhost_zerocopy_signal_used(struct vhost_net *net,
int j = 0;
for (i = nvq->done_idx; i != nvq->upend_idx; i = (i + 1) % UIO_MAXIOV) {
- if (vq->heads[i].len == VHOST_DMA_FAILED_LEN)
+ if (nvq->bufs[i].in_len == VHOST_DMA_FAILED_LEN)
vhost_net_tx_err(net);
- if (VHOST_DMA_IS_DONE(vq->heads[i].len)) {
- vq->heads[i].len = VHOST_DMA_CLEAR_LEN;
+ if (VHOST_DMA_IS_DONE(nvq->bufs[i].in_len)) {
+ nvq->bufs[i].in_len = VHOST_DMA_CLEAR_LEN;
++j;
} else
break;
}
while (j) {...
2020 Jun 02
21
[PATCH RFC 00/13] vhost: format independence
We let the specifics of the ring format seep through to vhost API
callers - mostly because there was only one format so it was
hard to imagine what an independent API would look like.
Now that there's an alternative in form of the packed ring,
it's easier to see the issues, and fixing them is perhaps
the cleanest way to add support for more formats.
This patchset does this by indtroducing