[FFmpeg-soc] [soc]: r512 - in dirac/libavcodec: dirac_arith.c dirac_arith.h
marco
subversion at mplayerhq.hu
Mon Jul 23 23:31:10 CEST 2007
Author: marco
Date: Mon Jul 23 23:31:10 2007
New Revision: 512
Log:
Doxygen comments for the arithmetic decoder.
Modified:
dirac/libavcodec/dirac_arith.c
dirac/libavcodec/dirac_arith.h
Modified: dirac/libavcodec/dirac_arith.c
==============================================================================
--- dirac/libavcodec/dirac_arith.c (original)
+++ dirac/libavcodec/dirac_arith.c Mon Jul 23 23:31:10 2007
@@ -56,6 +56,13 @@ static unsigned int arith_lookup[256] =
805, 750, 690, 625, 553, 471, 376, 255
};
+/**
+ * Initialize arithmetic decoding
+ *
+ * @param arith state used for further calls to the arithmetic decoder
+ * @param gb GetBitContext to read from
+ * @param length amount of bytes to decode
+ */
void dirac_arith_init (dirac_arith_state_t arith,
GetBitContext *gb, int length) {
int i;
@@ -73,6 +80,13 @@ void dirac_arith_init (dirac_arith_state
}
}
+/**
+ * Read a single bit using the arithmetic decoder
+ *
+ * @param arith state of arithmetic decoder
+ * @param context the context of the bit to read
+ * @return the bit read
+ */
int dirac_arith_get_bit (dirac_arith_state_t arith, int context) {
GetBitContext *gb = arith->gb;
unsigned int prob_zero = arith->contexts[context];
@@ -127,6 +141,11 @@ static unsigned inline int follow_contex
return context_set->follow[pos];
}
+/* Read an unsigned int using the arithmetic decoder
+ * @param arith state of arithmetic decoder
+ * @param context_set the collection of contexts to read the unsigned int
+ * @return value read by arithmetic decoder
+ */
unsigned int dirac_arith_read_uint (dirac_arith_state_t arith,
struct dirac_arith_context_set *context_set) {
int ret = 1;
@@ -142,6 +161,11 @@ unsigned int dirac_arith_read_uint (dira
return ret;
}
+/* Read a signed int using the arithmetic decoder
+ * @param arith state of arithmetic decoder
+ * @param context_set the collection of contexts to read the signed int
+ * @return value read by arithmetic decoder
+ */
int dirac_arith_read_int (dirac_arith_state_t arith,
struct dirac_arith_context_set *context_set) {
int ret = dirac_arith_read_uint (arith, context_set);
@@ -150,6 +174,9 @@ int dirac_arith_read_int (dirac_arith_st
return ret;
}
+/* Flush the arithmetic decoder, consume all bytes up to the
+ * initialized length.
+ */
void dirac_arith_flush(dirac_arith_state_t arith) {
skip_bits_long(arith->gb, arith->bits_left);
arith->bits_left = 0;
Modified: dirac/libavcodec/dirac_arith.h
==============================================================================
--- dirac/libavcodec/dirac_arith.h (original)
+++ dirac/libavcodec/dirac_arith.h Mon Jul 23 23:31:10 2007
@@ -78,10 +78,10 @@ typedef struct dirac_arith_state {
} *dirac_arith_state_t;
struct dirac_arith_context_set {
- unsigned int follow[6];
- unsigned int follow_length;
- unsigned int data;
- unsigned int sign;
+ unsigned int follow[6]; ///< the first follow contexts
+ unsigned int follow_length; ///< the amount of follow contexts in follow
+ unsigned int data; ///< context to read data
+ unsigned int sign; ///< context to read the sign
};
void dirac_arith_init (dirac_arith_state_t arith,
More information about the FFmpeg-soc
mailing list