[xiph-cvs] cvs commit: w3d Makefile bitcoder.h rle.h tarkin.c tarkin.h tarkin_enc.c wavelet.c
Holger Waechtler
holger at xiph.org
Mon Jul 9 00:27:13 PDT 2001
holger 01/07/09 00:27:13
Modified: . Makefile bitcoder.h rle.h tarkin.c tarkin.h
tarkin_enc.c wavelet.c
Log:
- added a skip-long-zero-coefficient-runs feature
- bitstream length is now specified in bytes again
Revision Changes Path
1.10 +2 -2 w3d/Makefile
Index: Makefile
===================================================================
RCS file: /usr/local/cvsroot/w3d/Makefile,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Makefile 2001/07/09 06:59:56 1.9
+++ Makefile 2001/07/09 07:27:12 1.10
@@ -1,8 +1,8 @@
CC = gcc
RM = rm -rf
-CFLAGS = -g -O0 -Wall -DTYPE=int16_t -DRLECODER -DDBG_XFORM -DDBG_MEMLEAKS
-LFLAGS = -g -lefence
+CFLAGS = -pg -O3 -Wall -DTYPE=int16_t -DRLECODER -DDBG_XFORM -DDBG_MEMLEAKS
+LFLAGS = -pg -lefence
OBJS = mem.o pnm.o wavelet.o wavelet_xform.o yuv.o tarkin.o tarkin-io.o
1.5 +3 -0 w3d/bitcoder.h
Index: bitcoder.h
===================================================================
RCS file: /usr/local/cvsroot/w3d/bitcoder.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- bitcoder.h 2001/07/09 06:03:09 1.4
+++ bitcoder.h 2001/07/09 07:27:12 1.5
@@ -18,6 +18,9 @@
#define ENTROPY_DECODER_DONE(coder) /* nothing to do ... */
#define ENTROPY_CODER_BITSTREAM(coder) (coder)->bitstream
+#define ENTROPY_CODER_MPS 1
+#define ENTROPY_CODER_RUNLENGTH(coder) 0
+
#endif
1.6 +3 -0 w3d/rle.h
Index: rle.h
===================================================================
RCS file: /usr/local/cvsroot/w3d/rle.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- rle.h 2001/07/09 06:03:09 1.5
+++ rle.h 2001/07/09 07:27:12 1.6
@@ -20,6 +20,9 @@
#define ENTROPY_DECODER_DONE(coder) /* nothing to do ... */
#define ENTROPY_CODER_BITSTREAM(coder) ((coder)->bitcoder.bitstream)
+#define ENTROPY_CODER_MPS(coder) ((coder)->mps)
+#define ENTROPY_CODER_RUNLENGTH(coder) ((coder)->count)
+
#endif
1.8 +3 -5 w3d/tarkin.c
Index: tarkin.c
===================================================================
RCS file: /usr/local/cvsroot/w3d/tarkin.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- tarkin.c 2001/07/09 06:59:56 1.7
+++ tarkin.c 2001/07/09 07:27:12 1.8
@@ -103,8 +103,7 @@
desc[i].height,
desc[i].frames_per_buf);
- layer->bitstream_len = layer->desc.bitrate / (8 * layer->n_comp);
- max_bitstream_len += layer->bitstream_len * layer->n_comp
+ max_bitstream_len += layer->desc.bitstream_len
+ 5000
+ 2 * 9 * sizeof(uint32_t) * layer->n_comp; // truncation tables
}
@@ -144,7 +143,7 @@
bitstream_len = wavelet_3d_buf_encode_coeff (layer->waveletbuf[j],
s->bitstream,
- layer->bitstream_len);
+ layer->desc.bitstream_len);
write_tarkin_bitstream (s->fd, s->bitstream, bitstream_len);
}
}
@@ -230,8 +229,7 @@
return 0;
}
- layer->bitstream_len = layer->desc.bitrate / (8 * layer->n_comp);
- max_bitstream_len += layer->bitstream_len * layer->n_comp
+ max_bitstream_len += layer->desc.bitstream_len
+ 5000
+ 2 * 9 * sizeof(uint32_t) * layer->n_comp;
}
1.5 +1 -3 w3d/tarkin.h
Index: tarkin.h
===================================================================
RCS file: /usr/local/cvsroot/w3d/tarkin.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- tarkin.h 2001/06/29 09:19:25 1.4
+++ tarkin.h 2001/07/09 07:27:12 1.5
@@ -33,7 +33,7 @@
uint32_t width;
uint32_t height;
uint32_t frames_per_buf;
- uint32_t bitrate; /* per color component */
+ uint32_t bitstream_len; /* for all color components, bytes */
TarkinColorFormat format;
} TarkinVideoLayerDesc;
@@ -43,8 +43,6 @@
uint32_t n_comp; /* number of color components */
Wavelet3DBuf **waveletbuf;
uint32_t current_frame_in_buf;
-
- uint32_t bitstream_len;
void (*color_fwd_xform) (uint8_t *rgba, Wavelet3DBuf *yuva [], uint32_t count);
void (*color_inv_xform) (Wavelet3DBuf *yuva [], uint8_t *rgba, uint32_t count);
1.6 +2 -2 w3d/tarkin_enc.c
Index: tarkin_enc.c
===================================================================
RCS file: /usr/local/cvsroot/w3d/tarkin_enc.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- tarkin_enc.c 2001/07/09 06:03:09 1.5
+++ tarkin_enc.c 2001/07/09 07:27:12 1.6
@@ -38,12 +38,12 @@
TarkinColorFormat type;
if (argc == 1) {
- layer[0].bitrate = 1000;
+ layer[0].bitstream_len = 1000;
a_moments = 2;
s_moments = 2;
} else if (argc == 5) {
fmt = argv[1];
- layer[0].bitrate = strtol (argv[2], 0, 0);
+ layer[0].bitstream_len = strtol (argv[2], 0, 0);
a_moments = strtol (argv[3], 0, 0);
s_moments = strtol (argv[4], 0, 0);
} else {
1.10 +30 -1 w3d/wavelet.c
Index: wavelet.c
===================================================================
RCS file: /usr/local/cvsroot/w3d/wavelet.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- wavelet.c 2001/07/09 06:59:56 1.9
+++ wavelet.c 2001/07/09 07:27:12 1.10
@@ -268,15 +268,44 @@
encode_coeff(s_stream, i_stream, buf->data[i]);
}
+
+static inline
+uint32_t skip_0coeffs (Wavelet3DBuf* buf,
+ ENTROPY_CODER s_stream [],
+ uint32_t start)
+{
+ int i;
+ uint32_t min = ~0;
+
+ for (i=1; i<10; i++) {
+ if (ENTROPY_CODER_MPS(&s_stream[i]) == 0) {
+ uint32_t runlength = ENTROPY_CODER_RUNLENGTH(&s_stream[i]);
+
+ if (runlength < min)
+ min = runlength;
+ }
+ }
+
+ return min;
+}
+
+
static
void decode_coefficients (Wavelet3DBuf* buf,
ENTROPY_CODER s_stream [],
ENTROPY_CODER i_stream [])
{
uint32_t i;
+
+ for (i=0; i<buf->width*buf->height*buf->frames; i++) {
+ int skip = skip_0coeffs (buf, s_stream, i);
+
+ if (skip > buf->width*buf->height*buf->frames - i)
+ return;
- for (i=0; i<buf->width*buf->height*buf->frames; i++)
+ i += skip;
buf->data[i] = decode_coeff(s_stream, i_stream);
+ }
}
#endif
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list