aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mss12.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-31 13:18:48 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-08-31 13:34:32 +0200
commitc617bed34f39a122ab1f89581ddce9cc63885383 (patch)
treeed2c0bd467f5f5c912ac46a2b95457a5647ced75 /libavcodec/mss12.h
parent98298eb1034bddb4557fa689553dae793c2b0092 (diff)
parentede3d6400d7c06863e6eb4bcff5f676480ae6b5e (diff)
downloadffmpeg-c617bed34f39a122ab1f89581ddce9cc63885383.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: MSS1 and MSS2: set final pixel format after common stuff has been initialised MSS2 decoder configure: handle --disable-asm before check_deps x86: Split inline and external assembly #ifdefs configure: x86: Separate inline from standalone assembler capabilities pktdumper: Use a custom define instead of PATH_MAX for buffers pktdumper: Use av_strlcpy instead of strncpy pktdumper: Use sizeof(variable) instead of the direct buffer length Conflicts: Changelog configure libavcodec/allcodecs.c libavcodec/avcodec.h libavcodec/codec_desc.c libavcodec/dct-test.c libavcodec/imgconvert.c libavcodec/mss12.c libavcodec/version.h libavfilter/x86/gradfun.c libswscale/x86/yuv2rgb.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mss12.h')
-rw-r--r--libavcodec/mss12.h70
1 files changed, 62 insertions, 8 deletions
diff --git a/libavcodec/mss12.h b/libavcodec/mss12.h
index c1c316044d..9068651e06 100644
--- a/libavcodec/mss12.h
+++ b/libavcodec/mss12.h
@@ -26,8 +26,10 @@
#ifndef AVCODEC_MSS12_H
#define AVCODEC_MSS12_H
+#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "get_bits.h"
+#include "bytestream.h"
#define MODEL_MIN_SYMS 2
#define MODEL_MAX_SYMS 256
@@ -46,7 +48,10 @@ typedef struct Model {
typedef struct ArithCoder {
int low, high, value;
- GetBitContext *gb;
+ union {
+ GetBitContext *gb;
+ GetByteContext *gB;
+ } gbc;
int (*get_model_sym)(struct ArithCoder *c, Model *m);
int (*get_number) (struct ArithCoder *c, int n);
} ArithCoder;
@@ -56,28 +61,77 @@ typedef struct PixContext {
uint8_t cache[12];
Model cache_model, full_model;
Model sec_models[4][8][4];
+ int special_initial_cache;
} PixContext;
+struct MSS12Context;
+
+typedef struct SliceContext {
+ struct MSS12Context *c;
+ Model intra_region, inter_region;
+ Model pivot, edge_mode, split_mode;
+ PixContext intra_pix_ctx, inter_pix_ctx;
+} SliceContext;
+
typedef struct MSS12Context {
AVCodecContext *avctx;
- uint8_t *pic_start;
- int pic_stride;
- uint8_t *mask;
- int mask_linesize;
uint32_t pal[256];
+ uint8_t *pal_pic;
+ uint8_t *last_pal_pic;
+ int pal_stride;
+ uint8_t *mask;
+ int mask_stride;
+ uint8_t *rgb_pic;
+ uint8_t *last_rgb_pic;
+ int rgb_stride;
int free_colours;
int keyframe;
Model intra_region, inter_region;
Model pivot, edge_mode, split_mode;
PixContext intra_pix_ctx, inter_pix_ctx;
+ int mvX, mvY;
int corrupted;
+ int slice_split;
+ int full_model_syms;
+ SliceContext sc[2];
} MSS12Context;
-int ff_mss12_decode_rect(MSS12Context *ctx, ArithCoder *acoder,
+int ff_mss12_decode_rect(SliceContext *ctx, ArithCoder *acoder,
int x, int y, int width, int height);
void ff_mss12_model_update(Model *m, int val);
void ff_mss12_codec_reset(MSS12Context *ctx);
-av_cold int ff_mss12_decode_init(AVCodecContext *avctx, int version);
-av_cold int ff_mss12_decode_end(AVCodecContext *avctx);
+av_cold int ff_mss12_decode_init(MSS12Context *ctx, int version);
+av_cold int ff_mss12_decode_end(MSS12Context *ctx);
+
+#define ARITH_GET_BIT(VERSION) \
+static int arith ## VERSION ## _get_bit(ArithCoder *c) \
+{ \
+ int range = c->high - c->low + 1; \
+ int bit = (((c->value - c->low) << 1) + 1) / range; \
+ \
+ if (bit) \
+ c->low += range >> 1; \
+ else \
+ c->high = c->low + (range >> 1) - 1; \
+ \
+ arith ## VERSION ## _normalise(c); \
+ \
+ return bit; \
+}
+
+#define ARITH_GET_MODEL_SYM(VERSION) \
+static int arith ## VERSION ## _get_model_sym(ArithCoder *c, Model *m) \
+{ \
+ int idx, val; \
+ \
+ idx = arith ## VERSION ## _get_prob(c, m->cum_prob); \
+ \
+ val = m->idx2sym[idx]; \
+ ff_mss12_model_update(m, idx); \
+ \
+ arith ## VERSION ## _normalise(c); \
+ \
+ return val; \
+}
#endif /* AVCODEC_MSS12_H */