On Tue, Apr 29, 2014 at 3:08 AM, Holger Hans Peter Freyther holger@freyther.de wrote:
On Tue, Apr 29, 2014 at 12:12:09AM -0400, Thomas Tsou wrote:
+#define SSE_ALIGN 16
+static int16_t *vdec_malloc(size_t n) +{ +#ifdef HAVE_SSE3
return (int16_t *) memalign(SSE_ALIGN, sizeof(int16_t) * n);+#else
return (int16_t *) malloc(sizeof(int16_t) * n);+#endif +}
argh, it would be nice if you could use talloc here but then we would need to play games and align pointers ourselves. Maybe change the API to at least have a 'ctx' similar to other talloc API?
A beneficial change would be to modify the API to allow persistent decoder objects instead of performing an allocation and tear-down on every decoding call. From a performance standpoint, the current implementation is unnecessarily restricted by memory access and page faults for that reason.
+static void free_trellis(struct vtrellis *trellis) +{
if (!trellis)return;free(trellis->vals);free(trellis->outputs);free(trellis->sums);free(trellis);Can you use talloc here?
Yes. I think that makes sense. Memory alignment is the only issue that needs to be looked into.
_traceback_rec(dec, state, out, len);_ is reserved for the system. We might want to avoid using that.
I thought only double underscore and single underscore with capital letter were reserved?
-TT