diff options
author | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-15 19:32:27 +0000 |
---|---|---|
committer | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-15 19:32:27 +0000 |
commit | 4fd57bbe3fef59592a8664dcc9fa2ab32ae99c69 (patch) | |
tree | 8f41b30e571aa6ed88b53f5471d5e38461136e60 /ext/tarkin | |
parent | 9f4226fe55f09cf5809376b467aa3f46dbf7b5c2 (diff) | |
download | gst-plugins-bad-4fd57bbe3fef59592a8664dcc9fa2ab32ae99c69.tar.gz gst-plugins-bad-4fd57bbe3fef59592a8664dcc9fa2ab32ae99c69.tar.bz2 gst-plugins-bad-4fd57bbe3fef59592a8664dcc9fa2ab32ae99c69.zip |
don't mix tabs and spaces
Original commit message from CVS:
don't mix tabs and spaces
Diffstat (limited to 'ext/tarkin')
-rw-r--r-- | ext/tarkin/gsttarkin.c | 4 | ||||
-rw-r--r-- | ext/tarkin/gsttarkindec.c | 86 | ||||
-rw-r--r-- | ext/tarkin/gsttarkinenc.c | 34 | ||||
-rw-r--r-- | ext/tarkin/info.c | 152 | ||||
-rw-r--r-- | ext/tarkin/mem.c | 15 | ||||
-rw-r--r-- | ext/tarkin/tarkin.c | 60 | ||||
-rw-r--r-- | ext/tarkin/wavelet.c | 2 | ||||
-rw-r--r-- | ext/tarkin/wavelet_coeff.c | 80 | ||||
-rw-r--r-- | ext/tarkin/wavelet_xform.c | 98 |
9 files changed, 266 insertions, 265 deletions
diff --git a/ext/tarkin/gsttarkin.c b/ext/tarkin/gsttarkin.c index a87575d9..0e8d859a 100644 --- a/ext/tarkin/gsttarkin.c +++ b/ext/tarkin/gsttarkin.c @@ -28,11 +28,11 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "tarkinenc", GST_RANK_NONE, - GST_TYPE_TARKINENC)) + GST_TYPE_TARKINENC)) return FALSE; if (!gst_element_register (plugin, "tarkindec", GST_RANK_NONE, - GST_TYPE_TARKINDEC)) + GST_TYPE_TARKINDEC)) return FALSE; return TRUE; diff --git a/ext/tarkin/gsttarkindec.c b/ext/tarkin/gsttarkindec.c index b9f98784..a40c5319 100644 --- a/ext/tarkin/gsttarkindec.c +++ b/ext/tarkin/gsttarkindec.c @@ -85,8 +85,8 @@ tarkindec_get_type (void) }; tarkindec_type = - g_type_register_static (GST_TYPE_ELEMENT, "TarkinDec", &tarkindec_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "TarkinDec", &tarkindec_info, + 0); } return tarkindec_type; } @@ -145,7 +145,7 @@ gst_tarkindec_class_init (TarkinDecClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, g_param_spec_int ("bitrate", "bitrate", "bitrate", - G_MININT, G_MAXINT, 3000, G_PARAM_READWRITE)); + G_MININT, G_MAXINT, 3000, G_PARAM_READWRITE)); parent_class = g_type_class_ref (GST_TYPE_ELEMENT); @@ -200,7 +200,7 @@ gst_tarkindec_chain (GstPad * pad, GstData * _data) if (!tarkindec->setup) { GST_ELEMENT_ERROR (tarkindec, CORE, NEGOTATION, (NULL), - ("decoder not initialized (input is not tarkin?)")); + ("decoder not initialized (input is not tarkin?)")); if (GST_IS_BUFFER (buf)) gst_buffer_unref (buf); else @@ -212,8 +212,8 @@ gst_tarkindec_chain (GstPad * pad, GstData * _data) switch (GST_EVENT_TYPE (buf)) { case GST_EVENT_EOS: default: - gst_pad_event_default (pad, GST_EVENT (buf)); - break; + gst_pad_event_default (pad, GST_EVENT (buf)); + break; } } else { gchar *data; @@ -235,43 +235,43 @@ gst_tarkindec_chain (GstPad * pad, GstData * _data) ogg_stream_pagein (&tarkindec->os, &tarkindec->og); while (ogg_stream_packetout (&tarkindec->os, &tarkindec->op)) { - if (tarkindec->op.e_o_s) - break; - if (tarkindec->nheader < 3) { /* 3 first packets to headerin */ - tarkin_synthesis_headerin (&tarkindec->ti, &tarkindec->tc, - &tarkindec->op); - - if (tarkindec->nheader == 2) { - tarkin_synthesis_init (tarkindec->tarkin_stream, &tarkindec->ti); - } - tarkindec->nheader++; - } else { - tarkin_synthesis_packetin (tarkindec->tarkin_stream, &tarkindec->op); - - while (tarkin_synthesis_frameout (tarkindec->tarkin_stream, &rgb, 0, - &date) == 0) { - GstBuffer *outbuf; - - layer = &tarkindec->tarkin_stream->layer->desc; - - if (!GST_PAD_CAPS (tarkindec->srcpad)) { - if (gst_pad_try_set_caps (tarkindec->srcpad, GST_CAPS_NEW ("tarkin_raw", "video/x-raw-rgb", "bpp", GST_PROPS_INT (24), "depth", GST_PROPS_INT (24), "endianness", GST_PROPS_INT (G_BYTE_ORDER), "red_mask", GST_PROPS_INT (0xff0000), "green_mask", GST_PROPS_INT (0xff00), "blue_mask", GST_PROPS_INT (0xff), "width", GST_PROPS_INT (layer->width), "height", GST_PROPS_INT (layer->height), "framerate", GST_PROPS_FLOAT (0.) /* FIXME!!! */ - )) <= 0) { - GST_ELEMENT_ERROR (tarkindec, CORE, NEGOTATION, (NULL), - ("could not output format")); - gst_buffer_unref (buf); - return; - } - } - outbuf = gst_buffer_new (); - GST_BUFFER_DATA (outbuf) = rgb; - GST_BUFFER_SIZE (outbuf) = layer->width * layer->height * 3; - GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE); - gst_pad_push (tarkindec->srcpad, GST_DATA (outbuf)); - - tarkin_synthesis_freeframe (tarkindec->tarkin_stream, rgb); - } - } + if (tarkindec->op.e_o_s) + break; + if (tarkindec->nheader < 3) { /* 3 first packets to headerin */ + tarkin_synthesis_headerin (&tarkindec->ti, &tarkindec->tc, + &tarkindec->op); + + if (tarkindec->nheader == 2) { + tarkin_synthesis_init (tarkindec->tarkin_stream, &tarkindec->ti); + } + tarkindec->nheader++; + } else { + tarkin_synthesis_packetin (tarkindec->tarkin_stream, &tarkindec->op); + + while (tarkin_synthesis_frameout (tarkindec->tarkin_stream, &rgb, 0, + &date) == 0) { + GstBuffer *outbuf; + + layer = &tarkindec->tarkin_stream->layer->desc; + + if (!GST_PAD_CAPS (tarkindec->srcpad)) { + if (gst_pad_try_set_caps (tarkindec->srcpad, GST_CAPS_NEW ("tarkin_raw", "video/x-raw-rgb", "bpp", GST_PROPS_INT (24), "depth", GST_PROPS_INT (24), "endianness", GST_PROPS_INT (G_BYTE_ORDER), "red_mask", GST_PROPS_INT (0xff0000), "green_mask", GST_PROPS_INT (0xff00), "blue_mask", GST_PROPS_INT (0xff), "width", GST_PROPS_INT (layer->width), "height", GST_PROPS_INT (layer->height), "framerate", GST_PROPS_FLOAT (0.) /* FIXME!!! */ + )) <= 0) { + GST_ELEMENT_ERROR (tarkindec, CORE, NEGOTATION, (NULL), + ("could not output format")); + gst_buffer_unref (buf); + return; + } + } + outbuf = gst_buffer_new (); + GST_BUFFER_DATA (outbuf) = rgb; + GST_BUFFER_SIZE (outbuf) = layer->width * layer->height * 3; + GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE); + gst_pad_push (tarkindec->srcpad, GST_DATA (outbuf)); + + tarkin_synthesis_freeframe (tarkindec->tarkin_stream, rgb); + } + } } } gst_buffer_unref (buf); diff --git a/ext/tarkin/gsttarkinenc.c b/ext/tarkin/gsttarkinenc.c index 4c62303d..f1d3853d 100644 --- a/ext/tarkin/gsttarkinenc.c +++ b/ext/tarkin/gsttarkinenc.c @@ -86,8 +86,8 @@ tarkinenc_get_type (void) }; tarkinenc_type = - g_type_register_static (GST_TYPE_ELEMENT, "TarkinEnc", &tarkinenc_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "TarkinEnc", &tarkinenc_info, + 0); } return tarkinenc_type; } @@ -146,15 +146,15 @@ gst_tarkinenc_class_init (TarkinEncClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, g_param_spec_int ("bitrate", "bitrate", "bitrate", - G_MININT, G_MAXINT, 3000, G_PARAM_READWRITE)); + G_MININT, G_MAXINT, 3000, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_S_MOMENTS, g_param_spec_int ("s_moments", "Synthesis Moments", - "Number of vanishing moments for the synthesis filter", - 1, 4, 2, G_PARAM_READWRITE)); + "Number of vanishing moments for the synthesis filter", + 1, 4, 2, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_A_MOMENTS, g_param_spec_int ("a_moments", "Analysis Moments", - "Number of vanishing moments for the analysis filter", - 1, 4, 2, G_PARAM_READWRITE)); + "Number of vanishing moments for the analysis filter", + 1, 4, 2, G_PARAM_READWRITE)); parent_class = g_type_class_ref (GST_TYPE_ELEMENT); @@ -313,7 +313,7 @@ gst_tarkinenc_chain (GstPad * pad, GstData * _data) if (!tarkinenc->setup) { GST_ELEMENT_ERROR (tarkinenc, CORE, NEGOTIATION, (NULL), - ("encoder not initialized (input is not tarkin?)")); + ("encoder not initialized (input is not tarkin?)")); if (GST_IS_BUFFER (buf)) gst_buffer_unref (buf); else @@ -324,12 +324,12 @@ gst_tarkinenc_chain (GstPad * pad, GstData * _data) if (GST_IS_EVENT (buf)) { switch (GST_EVENT_TYPE (buf)) { case GST_EVENT_EOS: - tarkin_analysis_framein (tarkinenc->tarkin_stream, NULL, 0, NULL); /* EOS */ - tarkin_comment_clear (&tarkinenc->tc); - tarkin_stream_destroy (tarkinenc->tarkin_stream); + tarkin_analysis_framein (tarkinenc->tarkin_stream, NULL, 0, NULL); /* EOS */ + tarkin_comment_clear (&tarkinenc->tc); + tarkin_stream_destroy (tarkinenc->tarkin_stream); default: - gst_pad_event_default (pad, GST_EVENT (buf)); - break; + gst_pad_event_default (pad, GST_EVENT (buf)); + break; } } else { gchar *data; @@ -396,9 +396,9 @@ gst_tarkinenc_set_property (GObject * object, guint prop_id, s_moments = g_value_get_int (value); if (s_moments != 1 || s_moments != 2 || s_moments != 4) { - g_warning ("tarkinenc: s_moments must be 1, 2 or 4"); + g_warning ("tarkinenc: s_moments must be 1, 2 or 4"); } else { - tarkinenc->s_moments = s_moments; + tarkinenc->s_moments = s_moments; } break; } @@ -408,9 +408,9 @@ gst_tarkinenc_set_property (GObject * object, guint prop_id, a_moments = g_value_get_int (value); if (a_moments != 1 || a_moments != 2 || a_moments != 4) { - g_warning ("tarkinenc: a_moments must be 1, 2 or 4"); + g_warning ("tarkinenc: a_moments must be 1, 2 or 4"); } else { - tarkinenc->a_moments = a_moments; + tarkinenc->a_moments = a_moments; } break; } diff --git a/ext/tarkin/info.c b/ext/tarkin/info.c index 3b0871a3..83fe1bae 100644 --- a/ext/tarkin/info.c +++ b/ext/tarkin/info.c @@ -71,7 +71,7 @@ tarkin_comment_add (TarkinComment * vc, char *comment) void tarkin_comment_add_tag (TarkinComment * vc, char *tag, char *contents) { - char *comment = alloca (strlen (tag) + strlen (contents) + 2); /* +2 for = and \0 */ + char *comment = alloca (strlen (tag) + strlen (contents) + 2); /* +2 for = and \0 */ strcpy (comment, tag); strcat (comment, "="); @@ -99,7 +99,7 @@ tarkin_comment_query (TarkinComment * vc, char *tag, int count) { long i; int found = 0; - int taglen = strlen (tag) + 1; /* +1 for the = we append */ + int taglen = strlen (tag) + 1; /* +1 for the = we append */ char *fulltag = alloca (taglen + 1); strcpy (fulltag, tag); @@ -108,20 +108,20 @@ tarkin_comment_query (TarkinComment * vc, char *tag, int count) for (i = 0; i < vc->comments; i++) { if (!tagcompare (vc->user_comments[i], fulltag, taglen)) { if (count == found) - /* We return a pointer to the data, not a copy */ - return vc->user_comments[i] + taglen; + /* We return a pointer to the data, not a copy */ + return vc->user_comments[i] + taglen; else - found++; + found++; } } - return NULL; /* didn't find anything */ + return NULL; /* didn't find anything */ } int tarkin_comment_query_count (TarkinComment * vc, char *tag) { int i, count = 0; - int taglen = strlen (tag) + 1; /* +1 for the = we append */ + int taglen = strlen (tag) + 1; /* +1 for the = we append */ char *fulltag = alloca (taglen + 1); strcpy (fulltag, tag); @@ -143,7 +143,7 @@ tarkin_comment_clear (TarkinComment * vc) for (i = 0; i < vc->comments; i++) if (vc->user_comments[i]) - FREE (vc->user_comments[i]); + FREE (vc->user_comments[i]); if (vc->user_comments) FREE (vc->user_comments); if (vc->comment_lengths) @@ -200,7 +200,7 @@ _tarkin_unpack_info (TarkinInfo * vi, oggpack_buffer * opb) goto err_out; if (oggpack_read (opb, 1) != 1) - goto err_out; /* EOP check */ + goto err_out; /* EOP check */ #ifdef DBG_OGG printf ("Success\n"); @@ -245,7 +245,7 @@ _tarkin_unpack_comment (TarkinComment * vc, oggpack_buffer * opb) _v_readstring (opb, vc->user_comments[i], len); } if (oggpack_read (opb, 1) != 1) - goto err_out; /* EOP check */ + goto err_out; /* EOP check */ #ifdef DBG_OGG printf ("Success, read %d comments\n", vc->comments); @@ -284,55 +284,55 @@ _tarkin_unpack_layer_desc (TarkinInfo * vi, oggpack_buffer * opb) switch (layer->desc.format) { case TARKIN_GRAYSCALE: - layer->n_comp = 1; - layer->color_fwd_xform = grayscale_to_y; - layer->color_inv_xform = y_to_grayscale; - break; + layer->n_comp = 1; + layer->color_fwd_xform = grayscale_to_y; + layer->color_inv_xform = y_to_grayscale; + break; case TARKIN_RGB24: - layer->n_comp = 3; - layer->color_fwd_xform = rgb24_to_yuv; - layer->color_inv_xform = yuv_to_rgb24; - break; + layer->n_comp = 3; + layer->color_fwd_xform = rgb24_to_yuv; + layer->color_inv_xform = yuv_to_rgb24; + break; case TARKIN_RGB32: - layer->n_comp = 3; - layer->color_fwd_xform = rgb32_to_yuv; - layer->color_inv_xform = yuv_to_rgb32; - break; + layer->n_comp = 3; + layer->color_fwd_xform = rgb32_to_yuv; + layer->color_inv_xform = yuv_to_rgb32; + break; case TARKIN_RGBA: - layer->n_comp = 4; - layer->color_fwd_xform = rgba_to_yuv; - layer->color_inv_xform = yuv_to_rgba; - break; + layer->n_comp = 4; + layer->color_fwd_xform = rgba_to_yuv; + layer->color_inv_xform = yuv_to_rgba; + break; default: - return -TARKIN_INVALID_COLOR_FORMAT; + return -TARKIN_INVALID_COLOR_FORMAT; }; layer->waveletbuf = (Wavelet3DBuf **) CALLOC (layer->n_comp, - sizeof (Wavelet3DBuf *)); + sizeof (Wavelet3DBuf *)); layer->packet = MALLOC (layer->n_comp * sizeof (*layer->packet)); memset (layer->packet, 0, layer->n_comp * sizeof (*layer->packet)); for (j = 0; j < layer->n_comp; j++) { layer->waveletbuf[j] = wavelet_3d_buf_new (layer->desc.width, - layer->desc.height, layer->desc.frames_per_buf); + layer->desc.height, layer->desc.frames_per_buf); layer->packet[j].data = MALLOC (layer->desc.bitstream_len); layer->packet[j].storage = layer->desc.bitstream_len; } - vi->max_bitstream_len += layer->desc.bitstream_len + 2 * 10 * sizeof (uint32_t) * layer->n_comp; /* truncation tables */ + vi->max_bitstream_len += layer->desc.bitstream_len + 2 * 10 * sizeof (uint32_t) * layer->n_comp; /* truncation tables */ #ifdef DBG_OGG printf - ("\n layer%d: size %dx%dx%d, format %d, a_m %d, s_m %d, %d fpb\n", - i, layer->desc.width, layer->desc.height, layer->n_comp, - layer->desc.format, layer->desc.a_moments, layer->desc.s_moments, - layer->desc.frames_per_buf); + ("\n layer%d: size %dx%dx%d, format %d, a_m %d, s_m %d, %d fpb\n", + i, layer->desc.width, layer->desc.height, layer->n_comp, + layer->desc.format, layer->desc.a_moments, layer->desc.s_moments, + layer->desc.frames_per_buf); #endif - } /* for each layer */ + } /* for each layer */ if (oggpack_read (opb, 1) != 1) - goto err_out; /* EOP check */ + goto err_out; /* EOP check */ #ifdef DBG_OGG printf ("Success\n"); @@ -369,42 +369,42 @@ tarkin_synthesis_headerin (TarkinInfo * vi, TarkinComment * vc, ogg_packet * op) memset (buffer, 0, 6); _v_readstring (&opb, buffer, 6); if (memcmp (buffer, "tarkin", 6)) { - /* not a tarkin header */ - return (-TARKIN_NOT_TARKIN); + /* not a tarkin header */ + return (-TARKIN_NOT_TARKIN); } switch (packtype) { - case 0x01: /* least significant *bit* is read first */ - if (!op->b_o_s) { - /* Not the initial packet */ - return (-TARKIN_BAD_HEADER); - } - if (vi->inter.numerator != 0) { - /* previously initialized info header */ - return (-TARKIN_BAD_HEADER); - } - - return (_tarkin_unpack_info (vi, &opb)); - - case 0x03: /* least significant *bit* is read first */ - if (vi->inter.denominator == 0) { - /* um... we didn't get the initial header */ - return (-TARKIN_BAD_HEADER); - } - - return (_tarkin_unpack_comment (vc, &opb)); - - case 0x05: /* least significant *bit* is read first */ - if (vi->inter.numerator == 0 || vc->vendor == NULL) { - /* um... we didn;t get the initial header or comments yet */ - return (-TARKIN_BAD_HEADER); - } - - return (_tarkin_unpack_layer_desc (vi, &opb)); - - default: - /* Not a valid tarkin header type */ - return (-TARKIN_BAD_HEADER); - break; + case 0x01: /* least significant *bit* is read first */ + if (!op->b_o_s) { + /* Not the initial packet */ + return (-TARKIN_BAD_HEADER); + } + if (vi->inter.numerator != 0) { + /* previously initialized info header */ + return (-TARKIN_BAD_HEADER); + } + + return (_tarkin_unpack_info (vi, &opb)); + + case 0x03: /* least significant *bit* is read first */ + if (vi->inter.denominator == 0) { + /* um... we didn't get the initial header */ + return (-TARKIN_BAD_HEADER); + } + + return (_tarkin_unpack_comment (vc, &opb)); + + case 0x05: /* least significant *bit* is read first */ + if (vi->inter.numerator == 0 || vc->vendor == NULL) { + /* um... we didn;t get the initial header or comments yet */ + return (-TARKIN_BAD_HEADER); + } + + return (_tarkin_unpack_layer_desc (vi, &opb)); + + default: + /* Not a valid tarkin header type */ + return (-TARKIN_BAD_HEADER); + break; } } } @@ -462,10 +462,10 @@ _tarkin_pack_comment (oggpack_buffer * opb, TarkinComment * vc) for (i = 0; i < vc->comments; i++) { if (vc->user_comments[i]) { - oggpack_write (opb, vc->comment_lengths[i], 32); - _v_writestring (opb, vc->user_comments[i], vc->comment_lengths[i]); + oggpack_write (opb, vc->comment_lengths[i], 32); + _v_writestring (opb, vc->user_comments[i], vc->comment_lengths[i]); } else { - oggpack_write (opb, 0, 32); + oggpack_write (opb, 0, 32); } } } @@ -503,9 +503,9 @@ _tarkin_pack_layer_desc (oggpack_buffer * opb, TarkinInfo * vi) #ifdef DBG_OGG printf (" res. %dx%d, format %d, a_m %d, s_m %d, fpb %d\n", - layer->desc.width, layer->desc.height, layer->desc.format, - layer->desc.a_moments, layer->desc.s_moments, - layer->desc.frames_per_buf); + layer->desc.width, layer->desc.height, layer->desc.format, + layer->desc.a_moments, layer->desc.s_moments, + layer->desc.frames_per_buf); #endif } diff --git a/ext/tarkin/mem.c b/ext/tarkin/mem.c index 6b337ef3..5ef59f2f 100644 --- a/ext/tarkin/mem.c +++ b/ext/tarkin/mem.c @@ -16,7 +16,8 @@ typedef struct char *allocated_in_func; char *allocated_in_file; unsigned int allocated_in_line; -} MemDesc; +} +MemDesc; static int initialized = 0; @@ -38,8 +39,8 @@ dbg_memleaks_done (int exitcode, void *dummy) MemDesc *d = &alloc_list[i]; fprintf (stderr, "chunk %p allocated in %s (%s: %u) not free'd !!\n", - d->mem, d->allocated_in_func, d->allocated_in_file, - d->allocated_in_line); + d->mem, d->allocated_in_func, d->allocated_in_file, + d->allocated_in_line); } free (alloc_list); } @@ -114,9 +115,9 @@ dbg_realloc (char *file, int line, char *func, char *what, if (mem != NULL) { fprintf (stderr, - "%s: trying to reallocate unknown chunk %p (%s)\n" - " in %s (%s: %u) !!!\n", - __FUNCTION__, mem, what, func, file, line); + "%s: trying to reallocate unknown chunk %p (%s)\n" + " in %s (%s: %u) !!!\n", + __FUNCTION__, mem, what, func, file, line); exit (-1); } @@ -137,7 +138,7 @@ dbg_free (char *file, int line, char *func, char *what, void *mem) free (mem); alloc_count--; memmove (&alloc_list[i], &alloc_list[i + 1], - (alloc_count - i) * sizeof (MemDesc)); + (alloc_count - i) * sizeof (MemDesc)); return; } } diff --git a/ext/tarkin/tarkin.c b/ext/tarkin/tarkin.c index b15b5512..70bfefc0 100644 --- a/ext/tarkin/tarkin.c +++ b/ext/tarkin/tarkin.c @@ -42,8 +42,8 @@ tarkin_stream_destroy (TarkinStream * s) for (i = 0; i < s->n_layers; i++) { if (s->layer[i].waveletbuf) { for (j = 0; j < s->layer[i].n_comp; j++) { - wavelet_3d_buf_destroy (s->layer[i].waveletbuf[j]); - FREE (s->layer[i].packet[j].data); + wavelet_3d_buf_destroy (s->layer[i].waveletbuf[j]); + FREE (s->layer[i].packet[j].data); } FREE (s->layer[i].waveletbuf); FREE (s->layer[i].packet); @@ -141,7 +141,7 @@ tarkin_analysis_add_layer (TarkinStream * s, TarkinVideoLayerDesc * tvld) for (i = 0; i < layer->n_comp; i++) { layer->waveletbuf[i] = wavelet_3d_buf_new (layer->desc.width, - layer->desc.height, layer->desc.frames_per_buf); + layer->desc.height, layer->desc.frames_per_buf); layer->packet[i].data = MALLOC (layer->desc.bitstream_len); layer->packet[i].storage = layer->desc.bitstream_len; } @@ -165,7 +165,7 @@ _analysis_packetout (TarkinStream * s, uint32_t layer_id, uint32_t comp) data_len = s->layer[layer_id].packet[comp].data_len; oggpack_writeinit (&opb); - oggpack_write (&opb, 0, 8); /* No feature flags for now */ + oggpack_write (&opb, 0, 8); /* No feature flags for now */ oggpack_write (&opb, layer_id, 12); oggpack_write (&opb, comp, 12); for (i = 0; i < data_len; i++) @@ -180,7 +180,7 @@ _analysis_packetout (TarkinStream * s, uint32_t layer_id, uint32_t comp) printf ("dbg_ogg: writing packet layer %d, comp %d, data_len %d %s\n", layer_id, comp, data_len, op.e_o_s ? "eos" : ""); #endif - s->layer[layer_id].packet[comp].data_len = 0; /* so direct call => eos */ + s->layer[layer_id].packet[comp].data_len = 0; /* so direct call => eos */ return (s->packet_out (s, &op)); } @@ -198,31 +198,31 @@ _stream_flush (TarkinStream * s) uint32_t comp_bitstream_len; TarkinPacket *packet = layer->packet + j; - /** + /** * implicit 6:1:1 subsampling */ if (j == 0) - comp_bitstream_len = - 6 * layer->desc.bitstream_len / (layer->n_comp + 5); + comp_bitstream_len = + 6 * layer->desc.bitstream_len / (layer->n_comp + 5); else - comp_bitstream_len = layer->desc.bitstream_len / (layer->n_comp + 5); + comp_bitstream_len = layer->desc.bitstream_len / (layer->n_comp + 5); if (packet->storage < comp_bitstream_len) { - packet->storage = comp_bitstream_len; - packet->data = REALLOC (packet->data, comp_bitstream_len); + packet->storage = comp_bitstream_len; + packet->data = REALLOC (packet->data, comp_bitstream_len); } wavelet_3d_buf_dump ("color-%d-%03d.pgm", - s->current_frame, j, layer->waveletbuf[j], j == 0 ? 0 : 128); + s->current_frame, j, layer->waveletbuf[j], j == 0 ? 0 : 128); wavelet_3d_buf_fwd_xform (layer->waveletbuf[j], - layer->desc.a_moments, layer->desc.s_moments); + layer->desc.a_moments, layer->desc.s_moments); wavelet_3d_buf_dump ("coeff-%d-%03d.pgm", - s->current_frame, j, layer->waveletbuf[j], 128); + s->current_frame, j, layer->waveletbuf[j], 128); packet->data_len = wavelet_3d_buf_encode_coeff (layer->waveletbuf[j], - packet->data, comp_bitstream_len); + packet->data, comp_bitstream_len); _analysis_packetout (s, i, j); } @@ -237,7 +237,7 @@ tarkin_analysis_framein (TarkinStream * s, uint8_t * frame, TarkinVideoLayer *layer; if (!frame) - return (_analysis_packetout (s, 0, 0)); /* eos */ + return (_analysis_packetout (s, 0, 0)); /* eos */ if ((layer_id >= s->n_layers) || (date->denominator == 0)) return (TARKIN_FAULT); @@ -286,7 +286,7 @@ TarkinError tarkin_synthesis_init (TarkinStream * s, TarkinInfo * ti) { s->ti = ti; - s->layer = ti->layer; /* It was malloc()ed by headerin() */ + s->layer = ti->layer; /* It was malloc()ed by headerin() */ s->n_layers = ti->n_layers; return (TARKIN_OK); } @@ -307,17 +307,17 @@ tarkin_synthesis_packetin (TarkinStream * s, ogg_packet * op) #endif oggpack_readinit (&opb, op->packet, op->bytes); flags = oggpack_read (&opb, 8); - layer_id = oggpack_read (&opb, 12); /* Theses are required for */ - comp = oggpack_read (&opb, 12); /* data hole handling (or maybe - * packetno would be enough ?) */ + layer_id = oggpack_read (&opb, 12); /* Theses are required for */ + comp = oggpack_read (&opb, 12); /* data hole handling (or maybe + * packetno would be enough ?) */ nread = 4; - if (flags) { /* This is void "infinite future features" feature ;) */ + if (flags) { /* This is void "infinite future features" feature ;) */ if (flags & 1 << 7) { junk = flags; while (junk & 1 << 7) - junk = oggpack_read (&opb, 8); /* allow for many future flags - that must be correctly ordonned. */ + junk = oggpack_read (&opb, 8); /* allow for many future flags + that must be correctly ordonned. */ } /* This shows how to get a feature's data: if (flags & TARKIN_FLAGS_EXAMPLE){ @@ -326,7 +326,7 @@ tarkin_synthesis_packetin (TarkinStream * s, ogg_packet * op) tp->example &= 0x4fffffff; } */ - for (junk = 1 << 31; junk & 1 << 31;) /* and many future data */ + for (junk = 1 << 31; junk & 1 << 31;) /* and many future data */ while ((junk = oggpack_read (&opb, 32)) & 1 << 30); /* That is, feature data comes in 30 bit chunks. We also have * 31 potentially usefull bits in last chunk. */ @@ -343,7 +343,7 @@ tarkin_synthesis_packetin (TarkinStream * s, ogg_packet * op) /* We now have for shure our data. */ packet = &s->layer[layer_id].packet[comp]; if (packet->data_len) - return (-TARKIN_UNUSED); /* Previous data wasn't used */ + return (-TARKIN_UNUSED); /* Previous data wasn't used */ if (packet->storage < data_len) { packet->storage = data_len + 255; @@ -371,19 +371,19 @@ tarkin_synthesis_frameout (TarkinStream * s, TarkinPacket *packet = layer->packet + j; if (packet->data_len == 0) - goto err_out; + goto err_out; wavelet_3d_buf_decode_coeff (layer->waveletbuf[j], packet->data, - packet->data_len); + packet->data_len); wavelet_3d_buf_dump ("rcoeff-%d-%03d.pgm", - s->current_frame, j, layer->waveletbuf[j], 128); + s->current_frame, j, layer->waveletbuf[j], 128); wavelet_3d_buf_inv_xform (layer->waveletbuf[j], - layer->desc.a_moments, layer->desc.s_moments); + layer->desc.a_moments, layer->desc.s_moments); wavelet_3d_buf_dump ("rcolor-%d-%03d.pgm", - s->current_frame, j, layer->waveletbuf[j], j == 0 ? 0 : 128); + s->current_frame, j, layer->waveletbuf[j], j == 0 ? 0 : 128); } /* We did successfylly read a block from this layer, acknowledge it. */ diff --git a/ext/tarkin/wavelet.c b/ext/tarkin/wavelet.c index cecce80a..77ce9a4c 100644 --- a/ext/tarkin/wavelet.c +++ b/ext/tarkin/wavelet.c @@ -118,7 +118,7 @@ wavelet_3d_buf_dump (char *fmt, snprintf (fname, 256, fmt, id, first_frame_in_buf + f); write_pgm16 (fname, buf->data + f * buf->width * buf->height, - buf->width, buf->height, offset); + buf->width, buf->height, offset); } } #endif diff --git a/ext/tarkin/wavelet_coeff.c b/ext/tarkin/wavelet_coeff.c index 95da5cad..fbe08f78 100644 --- a/ext/tarkin/wavelet_coeff.c +++ b/ext/tarkin/wavelet_coeff.c @@ -104,15 +104,15 @@ skip_0coeffs (Wavelet3DBuf * buf, uint32_t runlength = ENTROPY_CODER_RUNLENGTH (&s_stream[i]); if (i == 0) - runlength /= 2; /* sign bits are in this bitplane ... */ + runlength /= 2; /* sign bits are in this bitplane ... */ if (skip > runlength) - skip = runlength; + skip = runlength; if (skip <= 2) - return 0; + return 0; } } - ENTROPY_CODER_SKIP (&s_stream[0], 2 * skip); /* kill sign+significance bits */ + ENTROPY_CODER_SKIP (&s_stream[0], 2 * skip); /* kill sign+significance bits */ for (i = 1; i < TYPE_BITS; i++) ENTROPY_CODER_SKIP (&s_stream[i], skip); @@ -134,11 +134,11 @@ encode_quadrant (const Wavelet3DBuf * buf, for (z = 0; z < f; z++) { for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { - unsigned int index = buf->offset[level][quadrant] - + z * buf->width * buf->height + y * buf->width + x; + unsigned int index = buf->offset[level][quadrant] + + z * buf->width * buf->height + y * buf->width + x; - encode_coeff (significand_bitstream, insignificand_bitstream, - buf->data[index]); + encode_coeff (significand_bitstream, insignificand_bitstream, + buf->data[index]); } } } @@ -194,28 +194,28 @@ decode_quadrant (Wavelet3DBuf * buf, do { x = 0; do { - uint32_t skip; - uint32_t index = buf->offset[level][quadrant] - + z * buf->width * buf->height + y * buf->width + x; - - buf->data[index] = decode_coeff (s_stream, i_stream); - - skip = skip_0coeffs (buf, s_stream, i_stream, - (w - x - 1) + (h - y - 1) * w + (f - z - 1) * w * h); - if (skip > 0) { - x += skip; - while (x >= w) { - y++; - x -= w; - while (y >= h) { - z++; - y -= h; - if (z >= f) - return; - } - } - } - x++; + uint32_t skip; + uint32_t index = buf->offset[level][quadrant] + + z * buf->width * buf->height + y * buf->width + x; + + buf->data[index] = decode_coeff (s_stream, i_stream); + + skip = skip_0coeffs (buf, s_stream, i_stream, + (w - x - 1) + (h - y - 1) * w + (f - z - 1) * w * h); + if (skip > 0) { + x += skip; + while (x >= w) { + y++; + x -= w; + while (y >= h) { + z++; + y -= h; + if (z >= f) + return; + } + } + } + x++; } while (x < w); y++; } while (y < h); @@ -285,7 +285,7 @@ decode_coefficients (Wavelet3DBuf * buf, buf->data[i] = decode_coeff (s_stream, i_stream); skip = skip_0coeffs (buf, s_stream, i_stream, - buf->width * buf->height * buf->frames - i); + buf->width * buf->height * buf->frames - i); i += skip; } } @@ -304,10 +304,10 @@ setup_limittabs (ENTROPY_CODER significand_bitstream[], uint32_t byte_count; int i; - assert (limit > 2 * TYPE_BITS * sizeof (uint32_t)); /* limit too small */ + assert (limit > 2 * TYPE_BITS * sizeof (uint32_t)); /* limit too small */ printf ("%s: limit == %u\n", __FUNCTION__, limit); - byte_count = 2 * TYPE_BITS * sizeof (uint32_t); /* 2 binary coded limittabs */ + byte_count = 2 * TYPE_BITS * sizeof (uint32_t); /* 2 binary coded limittabs */ limit -= byte_count; printf ("%s: rem. limit == %u\n", __FUNCTION__, limit); @@ -342,9 +342,9 @@ setup_limittabs (ENTROPY_CODER significand_bitstream[], byte_count += insignificand_limittab[i]; printf ("insignificand_limittab[%i] == %u / %u\n", - i, insignificand_limittab[i], i_bytes); + i, insignificand_limittab[i], i_bytes); printf (" significand_limittab[%i] == %u / %u\n", - i, significand_limittab[i], s_bytes); + i, significand_limittab[i], s_bytes); significand_limit -= significand_limittab[i]; insignificand_limit -= insignificand_limittab[i]; @@ -394,7 +394,7 @@ read_limittabs (uint8_t * bitstream, for (i = 0; i < TYPE_BITS; i++) { insignificand_limittab[i] = *(uint32_t *) bitstream; printf ("insignificand_limittab[%i] == %u\n", i, - insignificand_limittab[i]); + insignificand_limittab[i]); bitstream += 4; } @@ -415,16 +415,16 @@ merge_bitstreams (uint8_t * bitstream, for (i = TYPE_BITS - 1; i >= 0; i--) { memcpy (bitstream, - ENTROPY_CODER_BITSTREAM (&significand_bitstream[i]), - significand_limittab[i]); + ENTROPY_CODER_BITSTREAM (&significand_bitstream[i]), + significand_limittab[i]); bitstream += significand_limittab[i]; } for (i = TYPE_BITS - 1; i >= 0; i--) { memcpy (bitstream, - ENTROPY_CODER_BITSTREAM (&insignificand_bitstream[i]), - insignificand_limittab[i]); + ENTROPY_CODER_BITSTREAM (&insignificand_bitstream[i]), + insignificand_limittab[i]); bitstream += insignificand_limittab[i]; } diff --git a/ext/tarkin/wavelet_xform.c b/ext/tarkin/wavelet_xform.c index fda5f59d..c6eed791 100644 --- a/ext/tarkin/wavelet_xform.c +++ b/ext/tarkin/wavelet_xform.c @@ -61,13 +61,13 @@ fwd_analyze_2 (const TYPE * x, TYPE * d, int stride, int n) if (n & 1) { for (i = 0; i < k; i++) d[i] = - x[(2 * i + 1) * stride] - (x[2 * i * stride] + x[(2 * i + - 2) * stride]) / 2; + x[(2 * i + 1) * stride] - (x[2 * i * stride] + x[(2 * i + + 2) * stride]) / 2; } else { for (i = 0; i < k - 1; i++) d[i] = - x[(2 * i + 1) * stride] - (x[2 * i * stride] + x[(2 * i + - 2) * stride]) / 2; + x[(2 * i + 1) * stride] - (x[2 * i * stride] + x[(2 * i + + 2) * stride]) / 2; d[k - 1] = x[(n - 1) * stride] - x[(n - 2) * stride]; } } @@ -95,11 +95,11 @@ inv_analyze_2 (TYPE * x, const TYPE * d, int stride, int n) if (n & 1) { for (i = 0; i < k; i++) x[(2 * i + 1) * stride] = - d[i] + (x[2 * i * stride] + x[(2 * i + 2) * stride]) / 2; + d[i] + (x[2 * i * stride] + x[(2 * i + 2) * stride]) / 2; } else { for (i = 0; i < k - 1; i++) x[(2 * i + 1) * stride] = - d[i] + (x[2 * i * stride] + x[(2 * i + 2) * stride]) / 2; + d[i] + (x[2 * i * stride] + x[(2 * i + 2) * stride]) / 2; x[(n - 1) * stride] = d[k - 1] + x[(n - 2) * stride]; } } @@ -129,20 +129,20 @@ fwd_analyze_4 (const TYPE * x, TYPE * d, int stride, int n) if (n & 1) { for (i = 1; i < k - 1; i++) d[i] = x[(2 * i + 1) * stride] - - ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) - - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; + - ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) + - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; if (k > 1) d[k - 1] = - x[(2 * k - 1) * stride] - (x[(2 * k - 2) * stride] + - x[2 * k * stride]) / 2; + x[(2 * k - 1) * stride] - (x[(2 * k - 2) * stride] + + x[2 * k * stride]) / 2; } else { for (i = 1; i < k - 2; i++) d[i] = x[(2 * i + 1) * stride] - - ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) - - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; + - ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) + - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; if (k > 2) d[k - 2] = x[(2 * k - 3) * stride] - (x[(2 * k - 4) * stride] - + x[(2 * k - 2) * stride]) / 2; + + x[(2 * k - 2) * stride]) / 2; if (k > 1) d[k - 1] = x[(n - 1) * stride] - x[(n - 2) * stride]; } @@ -159,7 +159,7 @@ fwd_synthesize_4 (const TYPE * x, TYPE * s, const TYPE * d, int stride, int n) s[stride] = x[2 * stride] + (d[0] + d[1]) / 4; for (i = 2; i < k - 1; i++) s[i * stride] = x[2 * i * stride] - + ((uint32_t) 9 * (d[i - 1] + d[i]) - (d[i - 2] + d[i + 1])) / 32; + + ((uint32_t) 9 * (d[i - 1] + d[i]) - (d[i - 2] + d[i + 1])) / 32; if (k > 2) s[(k - 1) * stride] = x[(2 * k - 2) * stride] + (d[k - 2] + d[k - 1]) / 4; if (n & 1) @@ -177,19 +177,19 @@ inv_analyze_4 (TYPE * x, const TYPE * d, int stride, int n) if (n & 1) { for (i = 1; i < k - 1; i++) x[(2 * i + 1) * stride] = d[i] - + ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) - - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; + + ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) + - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; if (k > 1) x[(2 * k - 1) * stride] = - d[k - 1] + (x[(2 * k - 2) * stride] + x[2 * k * stride]) / 2; + d[k - 1] + (x[(2 * k - 2) * stride] + x[2 * k * stride]) / 2; } else { for (i = 1; i < k - 2; i++) x[(2 * i + 1) * stride] = d[i] - + (9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) - - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; + + (9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) + - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; if (k > 2) x[(2 * k - 3) * stride] = d[k - 2] + (x[(2 * k - 4) * stride] - + x[(2 * k - 2) * stride]) / 2; + + x[(2 * k - 2) * stride]) / 2; if (k > 1) x[(n - 1) * stride] = d[k - 1] + x[(n - 2) * stride]; } @@ -206,7 +206,7 @@ inv_synthesize_4 (TYPE * x, const TYPE * s, const TYPE * d, int stride, int n) x[2 * stride] = s[1] - (d[0] + d[1]) / 4; for (i = 2; i < k - 1; i++) x[2 * i * stride] = s[i] - ((uint32_t) 9 * (d[i - 1] + d[i]) - - (d[i - 2] + d[i + 1])) / 32; + - (d[i - 2] + d[i + 1])) / 32; if (k > 2) x[(2 * k - 2) * stride] = s[k - 1] - (d[k - 2] + d[k - 1]) / 4; if (n & 1) @@ -333,11 +333,11 @@ wavelet_3d_buf_fwd_xform (Wavelet3DBuf * buf, int a_moments, int s_moments) int row, frame; for (frame = 0; frame < f; frame++) { - for (row = 0; row < h; row++) { - TYPE *data = buf->data + (frame * buf->height + row) * buf->width; + for (row = 0; row < h; row++) { + TYPE *data = buf->data + (frame * buf->height + row) * buf->width; - fwd_xform (buf->scratchbuf, data, 1, w, a_moments, s_moments); - } + fwd_xform (buf->scratchbuf, data, 1, w, a_moments, s_moments); + } } } @@ -345,12 +345,12 @@ wavelet_3d_buf_fwd_xform (Wavelet3DBuf * buf, int a_moments, int s_moments) int col, frame; for (frame = 0; frame < f; frame++) { - for (col = 0; col < w; col++) { - TYPE *data = buf->data + frame * buf->width * buf->height + col; + for (col = 0; col < w; col++) { + TYPE *data = buf->data + frame * buf->width * buf->height + col; - fwd_xform (buf->scratchbuf, data, buf->width, h, - a_moments, s_moments); - } + fwd_xform (buf->scratchbuf, data, buf->width, h, + a_moments, s_moments); + } } } @@ -358,12 +358,12 @@ wavelet_3d_buf_fwd_xform (Wavelet3DBuf * buf, int a_moments, int s_moments) int i, j; for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - TYPE *data = buf->data + j * buf->width + i; + for (i = 0; i < w; i++) { + TYPE *data = buf->data + j * buf->width + i; - fwd_xform (buf->scratchbuf, data, buf->width * buf->height, f, - a_moments, s_moments); - } + fwd_xform (buf->scratchbuf, data, buf->width * buf->height, f, + a_moments, s_moments); + } } } } @@ -384,12 +384,12 @@ wavelet_3d_buf_inv_xform (Wavelet3DBuf * buf, int a_moments, int s_moments) int i, j; for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - TYPE *data = buf->data + j * buf->width + i; + for (i = 0; i < w; i++) { + TYPE *data = buf->data + j * buf->width + i; - inv_xform (buf->scratchbuf, data, buf->width * buf->height, f, - a_moments, s_moments); - } + inv_xform (buf->scratchbuf, data, buf->width * buf->height, f, + a_moments, s_moments); + } } } @@ -397,12 +397,12 @@ wavelet_3d_buf_inv_xform (Wavelet3DBuf * buf, int a_moments, int s_moments) int col, frame; for (frame = 0; frame < f; frame++) { - for (col = 0; col < w; col++) { - TYPE *data = buf->data + frame * buf->width * buf->height + col; + for (col = 0; col < w; col++) { + TYPE *data = buf->data + frame * buf->width * buf->height + col; - inv_xform (buf->scratchbuf, data, buf->width, h, - a_moments, s_moments); - } + inv_xform (buf->scratchbuf, data, buf->width, h, + a_moments, s_moments); + } } } @@ -410,11 +410,11 @@ wavelet_3d_buf_inv_xform (Wavelet3DBuf * buf, int a_moments, int s_moments) int row, frame; for (frame = 0; frame < f; frame++) { - for (row = 0; row < h; row++) { - TYPE *data = buf->data + (frame * buf->height + row) * buf->width; + for (row = 0; row < h; row++) { + TYPE *data = buf->data + (frame * buf->height + row) * buf->width; - inv_xform (buf->scratchbuf, data, 1, w, a_moments, s_moments); - } + inv_xform (buf->scratchbuf, data, 1, w, a_moments, s_moments); + } } } } |