summaryrefslogtreecommitdiffstats
path: root/ext/tarkin/rle.h
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2004-03-15 16:32:54 +0000
committerJohan Dahlin <johan@gnome.org>2004-03-15 16:32:54 +0000
commit39fd8a2dbd436cbabe5e336d1145b62c2a885ed5 (patch)
tree61df7da4a9d2b8bdb853af50a27219a8921bf5e4 /ext/tarkin/rle.h
parent1633bd8693c54cbc5f6648703a7ecf01548ec55f (diff)
downloadgst-plugins-bad-39fd8a2dbd436cbabe5e336d1145b62c2a885ed5.tar.gz
gst-plugins-bad-39fd8a2dbd436cbabe5e336d1145b62c2a885ed5.tar.bz2
gst-plugins-bad-39fd8a2dbd436cbabe5e336d1145b62c2a885ed5.zip
*.h: Revert indenting
Original commit message from CVS: * *.h: Revert indenting
Diffstat (limited to 'ext/tarkin/rle.h')
-rw-r--r--ext/tarkin/rle.h146
1 files changed, 73 insertions, 73 deletions
diff --git a/ext/tarkin/rle.h b/ext/tarkin/rle.h
index 6ccef22b..7cf79517 100644
--- a/ext/tarkin/rle.h
+++ b/ext/tarkin/rle.h
@@ -19,7 +19,7 @@
#define ENTROPY_ENCODER_FLUSH(coder) rlecoder_encoder_flush(coder)
#define ENTROPY_DECODER_INIT(coder,bitstream,limit) \
rlecoder_decoder_init(coder,bitstream,limit)
-#define ENTROPY_DECODER_DONE(coder) /* nothing to do ... */
+#define ENTROPY_DECODER_DONE(coder) /* nothing to do ... */
#define ENTROPY_CODER_BITSTREAM(coder) ((coder)->bitcoder.bitstream)
#define ENTROPY_CODER_EOS(coder) ((coder)->bitcoder.eos)
@@ -31,13 +31,12 @@
-typedef struct
-{
- int symbol;
- uint32_t count; /* have seen count symbol's */
- BitCoderState bitcoder;
- GolombAdaptiveCoderState golomb_state[2]; /* 2 states for 2 symbols... */
- int have_seen_1;
+typedef struct {
+ int symbol;
+ uint32_t count; /* have seen count symbol's */
+ BitCoderState bitcoder;
+ GolombAdaptiveCoderState golomb_state [2]; /* 2 states for 2 symbols... */
+ int have_seen_1;
} RLECoderState;
@@ -45,99 +44,100 @@ typedef struct
/*
* bit should be 0 or 1 !!!
*/
-static inline void
-rlecoder_write_bit (RLECoderState * s, int bit)
+static inline
+void rlecoder_write_bit (RLECoderState *s, int bit)
{
- assert (bit == 0 || bit == 1);
-
- if (s->symbol == -1) {
- s->symbol = bit & 1;
- s->count = 1;
- s->have_seen_1 = bit;
- bitcoder_write_bit (&s->bitcoder, bit);
- }
-
- if (s->symbol != bit) {
- golombcoder_encode_number (&s->golomb_state[s->symbol],
- &s->bitcoder, s->count);
- s->symbol = ~s->symbol & 1;
- s->have_seen_1 = 1;
- s->count = 1;
- } else
- s->count++;
+ assert (bit == 0 || bit == 1);
+
+ if (s->symbol == -1) {
+ s->symbol = bit & 1;
+ s->count = 1;
+ s->have_seen_1 = bit;
+ bitcoder_write_bit (&s->bitcoder, bit);
+ }
+
+ if (s->symbol != bit) {
+ golombcoder_encode_number (&s->golomb_state[s->symbol],
+ &s->bitcoder, s->count);
+ s->symbol = ~s->symbol & 1;
+ s->have_seen_1 = 1;
+ s->count = 1;
+ } else
+ s->count++;
}
-static inline int
-rlecoder_read_bit (RLECoderState * s)
+static inline
+int rlecoder_read_bit (RLECoderState *s)
{
- if (s->count == 0) {
- s->symbol = ~s->symbol & 1;
- s->count = golombcoder_decode_number (&s->golomb_state[s->symbol],
- &s->bitcoder);
- if (s->bitcoder.eos) {
- s->symbol = 0;
- s->count = ~0;
- }
- }
- s->count--;
- return (s->symbol);
+ if (s->count == 0) {
+ s->symbol = ~s->symbol & 1;
+ s->count = golombcoder_decode_number (&s->golomb_state[s->symbol],
+ &s->bitcoder);
+ if (s->bitcoder.eos) {
+ s->symbol = 0;
+ s->count = ~0;
+ }
+ }
+ s->count--;
+ return (s->symbol);
}
int coder_id = 0;
FILE *file = NULL;
-static inline void
-rlecoder_encoder_init (RLECoderState * s, uint32_t limit)
+static inline
+void rlecoder_encoder_init (RLECoderState *s, uint32_t limit)
{
- bitcoder_encoder_init (&s->bitcoder, limit);
- s->symbol = -1;
- s->have_seen_1 = 0;
- s->golomb_state[0].count = 0;
- s->golomb_state[1].count = 0;
- s->golomb_state[0].bits = 5 << 3;
- s->golomb_state[1].bits = 5 << 3;
+ bitcoder_encoder_init (&s->bitcoder, limit);
+ s->symbol = -1;
+ s->have_seen_1 = 0;
+ s->golomb_state[0].count = 0;
+ s->golomb_state[1].count = 0;
+ s->golomb_state[0].bits = 5 << 3;
+ s->golomb_state[1].bits = 5 << 3;
}
/**
* once you called this, you better should not encode any more symbols ...
*/
-static inline uint32_t
-rlecoder_encoder_flush (RLECoderState * s)
+static inline
+uint32_t rlecoder_encoder_flush (RLECoderState *s)
{
- if (s->symbol == -1 || !s->have_seen_1)
- return 0;
+ if (s->symbol == -1 || !s->have_seen_1)
+ return 0;
- golombcoder_encode_number (&s->golomb_state[s->symbol],
- &s->bitcoder, s->count);
- return bitcoder_flush (&s->bitcoder);
+ golombcoder_encode_number (&s->golomb_state[s->symbol],
+ &s->bitcoder, s->count);
+ return bitcoder_flush (&s->bitcoder);
}
-static inline void
-rlecoder_decoder_init (RLECoderState * s, uint8_t * bitstream, uint32_t limit)
+static inline
+void rlecoder_decoder_init (RLECoderState *s, uint8_t *bitstream, uint32_t limit)
{
- bitcoder_decoder_init (&s->bitcoder, bitstream, limit);
- s->golomb_state[0].count = 0;
- s->golomb_state[1].count = 0;
- s->golomb_state[0].bits = 5 << 3;
- s->golomb_state[1].bits = 5 << 3;
- s->symbol = bitcoder_read_bit (&s->bitcoder);
- s->count = golombcoder_decode_number (&s->golomb_state[s->symbol],
- &s->bitcoder) - 1;
- if (s->bitcoder.eos) {
- s->symbol = 0;
- s->count = ~0;
- }
+ bitcoder_decoder_init (&s->bitcoder, bitstream, limit);
+ s->golomb_state[0].count = 0;
+ s->golomb_state[1].count = 0;
+ s->golomb_state[0].bits = 5 << 3;
+ s->golomb_state[1].bits = 5 << 3;
+ s->symbol = bitcoder_read_bit (&s->bitcoder);
+ s->count = golombcoder_decode_number (&s->golomb_state[s->symbol],
+ &s->bitcoder) - 1;
+ if (s->bitcoder.eos) {
+ s->symbol = 0;
+ s->count = ~0;
+ }
}
-static inline void
-rlecoder_encoder_done (RLECoderState * s)
+static inline
+void rlecoder_encoder_done (RLECoderState *s)
{
- bitcoder_encoder_done (&s->bitcoder);
+ bitcoder_encoder_done (&s->bitcoder);
}
#endif
+