FFmpeg
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
libavcodec
mss12.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012 Konstantin Shishkov
3
*
4
* This file is part of FFmpeg.
5
*
6
* FFmpeg is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version.
10
*
11
* FFmpeg is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with FFmpeg; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
21
/**
22
* @file
23
* Common header for Microsoft Screen 1 and 2
24
*/
25
26
#ifndef AVCODEC_MSS12_H
27
#define AVCODEC_MSS12_H
28
29
#include "
libavutil/intreadwrite.h
"
30
#include "
avcodec.h
"
31
#include "
get_bits.h
"
32
#include "
bytestream.h
"
33
34
#define MODEL_MIN_SYMS 2
35
#define MODEL_MAX_SYMS 256
36
#define THRESH_ADAPTIVE -1
37
#define THRESH_LOW 15
38
#define THRESH_HIGH 50
39
40
typedef
struct
Model
{
41
int16_t
cum_prob
[
MODEL_MAX_SYMS
+ 1];
42
int16_t
weights
[
MODEL_MAX_SYMS
+ 1];
43
uint8_t
idx2sym
[
MODEL_MAX_SYMS
+ 1];
44
int
num_syms
;
45
int
thr_weight
,
threshold
;
46
}
Model
;
47
48
typedef
struct
ArithCoder
{
49
int
low
,
high
,
value
;
50
union
{
51
GetBitContext
*
gb
;
52
GetByteContext
*
gB
;
53
}
gbc
;
54
int (*
get_model_sym
)(
struct
ArithCoder
*
c
,
Model
*
m
);
55
int (*
get_number
) (
struct
ArithCoder
*
c
,
int
n
);
56
}
ArithCoder
;
57
58
typedef
struct
PixContext
{
59
int
cache_size
,
num_syms
;
60
uint8_t
cache
[12];
61
Model
cache_model
,
full_model
;
62
Model
sec_models
[15][4];
63
int
special_initial_cache
;
64
}
PixContext
;
65
66
struct
MSS12Context
;
67
68
typedef
struct
SliceContext
{
69
struct
MSS12Context
*
c
;
70
Model
intra_region
,
inter_region
;
71
Model
pivot
,
edge_mode
,
split_mode
;
72
PixContext
intra_pix_ctx
,
inter_pix_ctx
;
73
}
SliceContext
;
74
75
typedef
struct
MSS12Context
{
76
AVCodecContext
*
avctx
;
77
uint32_t
pal
[256];
78
uint8_t
*
pal_pic
;
79
uint8_t
*
last_pal_pic
;
80
int
pal_stride
;
81
uint8_t
*
mask
;
82
int
mask_stride
;
83
uint8_t
*
rgb_pic
;
84
uint8_t
*
last_rgb_pic
;
85
int
rgb_stride
;
86
int
free_colours
;
87
int
keyframe
;
88
int
mvX
,
mvY
;
89
int
corrupted
;
90
int
slice_split
;
91
int
full_model_syms
;
92
}
MSS12Context
;
93
94
int
ff_mss12_decode_rect
(
SliceContext
*ctx,
ArithCoder
*acoder,
95
int
x,
int
y
,
int
width
,
int
height
);
96
void
ff_mss12_model_update
(
Model
*
m
,
int
val
);
97
void
ff_mss12_slicecontext_reset
(
SliceContext
*sc);
98
int
ff_mss12_decode_init
(
MSS12Context
*
c
,
int
version
,
99
SliceContext
*sc1,
SliceContext
*sc2);
100
int
ff_mss12_decode_end
(
MSS12Context
*ctx);
101
102
#define ARITH_GET_BIT(prefix) \
103
static int prefix ## _get_bit(ArithCoder *c) \
104
{ \
105
int range = c->high - c->low + 1; \
106
int bit = 2 * c->value - c->low >= c->high; \
107
\
108
if (bit) \
109
c->low += range >> 1; \
110
else \
111
c->high = c->low + (range >> 1) - 1; \
112
\
113
prefix ## _normalise(c); \
114
\
115
return bit; \
116
}
117
118
#define ARITH_GET_MODEL_SYM(prefix) \
119
static int prefix ## _get_model_sym(ArithCoder *c, Model *m) \
120
{ \
121
int idx, val; \
122
\
123
idx = prefix ## _get_prob(c, m->cum_prob); \
124
\
125
val = m->idx2sym[idx]; \
126
ff_mss12_model_update(m, idx); \
127
\
128
prefix ## _normalise(c); \
129
\
130
return val; \
131
}
132
133
#endif
/* AVCODEC_MSS12_H */
val
const char const char void * val
Definition:
avisynth_c.h:634
GetByteContext
Definition:
bytestream.h:33
SliceContext::inter_pix_ctx
PixContext inter_pix_ctx
Definition:
mss12.h:72
ArithCoder::high
int high
Definition:
mss12.h:49
Model
Definition:
mss12.h:40
ArithCoder::value
int value
Definition:
mss12.h:49
MSS12Context::corrupted
int corrupted
Definition:
mss12.h:89
ArithCoder::gbc
union ArithCoder::@72 gbc
Model::weights
int16_t weights[MODEL_MAX_SYMS+1]
Definition:
mss12.h:42
version
int version
Definition:
avisynth_c.h:629
MSS12Context::rgb_pic
uint8_t * rgb_pic
Definition:
mss12.h:83
MSS12Context::mask_stride
int mask_stride
Definition:
mss12.h:82
Model::thr_weight
int thr_weight
Definition:
mss12.h:45
PixContext
Definition:
mss12.h:58
MSS12Context::slice_split
int slice_split
Definition:
mss12.h:90
MSS12Context::pal
uint32_t pal[256]
Definition:
mss12.h:77
uint8_t
uint8_t
Definition:
audio_convert.c:194
MSS12Context::last_pal_pic
uint8_t * last_pal_pic
Definition:
mss12.h:79
MSS12Context::rgb_stride
int rgb_stride
Definition:
mss12.h:85
MSS12Context::keyframe
int keyframe
Definition:
mss12.h:87
SliceContext::inter_region
Model inter_region
Definition:
mss12.h:70
ArithCoder::gB
GetByteContext * gB
Definition:
mss12.h:52
get_bits.h
bitstream reader API header.
PixContext::full_model
Model full_model
Definition:
mss12.h:61
ArithCoder::get_model_sym
int(* get_model_sym)(struct ArithCoder *c, Model *m)
Definition:
mss12.h:54
m
unsigned m
Definition:
audioconvert.c:187
PixContext::sec_models
Model sec_models[15][4]
Definition:
mss12.h:62
MSS12Context
Definition:
mss12.h:75
SliceContext::pivot
Model pivot
Definition:
mss12.h:71
SliceContext
Definition:
mss12.h:68
MSS12Context::full_model_syms
int full_model_syms
Definition:
mss12.h:91
MSS12Context::mvY
int mvY
Definition:
mss12.h:88
PixContext::cache_size
int cache_size
Definition:
mss12.h:59
avcodec.h
Libavcodec external API header.
MSS12Context::pal_stride
int pal_stride
Definition:
mss12.h:80
bytestream.h
MSS12Context::avctx
AVCodecContext * avctx
Definition:
mss12.h:76
SliceContext::edge_mode
Model edge_mode
Definition:
mss12.h:71
y
float y
Definition:
avf_showspectrum.c:96
SliceContext::intra_pix_ctx
PixContext intra_pix_ctx
Definition:
mss12.h:72
intreadwrite.h
MODEL_MAX_SYMS
#define MODEL_MAX_SYMS
Definition:
mss12.h:35
ArithCoder
Definition:
mss12.h:48
n
int n
Definition:
avisynth_c.h:547
SliceContext::c
struct MSS12Context * c
Definition:
mss12.h:69
ff_mss12_decode_end
int ff_mss12_decode_end(MSS12Context *ctx)
Definition:
mss12.c:676
ff_mss12_decode_rect
int ff_mss12_decode_rect(SliceContext *ctx, ArithCoder *acoder, int x, int y, int width, int height)
Definition:
mss12.c:528
MSS12Context::mask
uint8_t * mask
Definition:
mss12.h:81
AVCodecContext
main external API structure.
Definition:
avcodec.h:1241
Model::num_syms
int num_syms
Definition:
mss12.h:44
PixContext::cache_model
Model cache_model
Definition:
mss12.h:61
ff_mss12_decode_init
int ff_mss12_decode_init(MSS12Context *c, int version, SliceContext *sc1, SliceContext *sc2)
Definition:
mss12.c:564
height
BYTE int const BYTE int int int height
Definition:
avisynth_c.h:676
Model::idx2sym
uint8_t idx2sym[MODEL_MAX_SYMS+1]
Definition:
mss12.h:43
PixContext::special_initial_cache
int special_initial_cache
Definition:
mss12.h:63
SliceContext::split_mode
Model split_mode
Definition:
mss12.h:71
ff_mss12_slicecontext_reset
void ff_mss12_slicecontext_reset(SliceContext *sc)
Definition:
mss12.c:428
GetBitContext
Definition:
get_bits.h:54
c
static double c[64]
Definition:
vsrc_mptestsrc.c:87
Model::threshold
int threshold
Definition:
mss12.h:45
MSS12Context::free_colours
int free_colours
Definition:
mss12.h:86
ArithCoder::low
int low
Definition:
mss12.h:49
MSS12Context::last_rgb_pic
uint8_t * last_rgb_pic
Definition:
mss12.h:84
SliceContext::intra_region
Model intra_region
Definition:
mss12.h:70
MSS12Context::mvX
int mvX
Definition:
mss12.h:88
PixContext::cache
uint8_t cache[12]
Definition:
mss12.h:60
ArithCoder::gb
GetBitContext * gb
Definition:
mss12.h:51
ArithCoder::get_number
int(* get_number)(struct ArithCoder *c, int n)
Definition:
mss12.h:55
PixContext::num_syms
int num_syms
Definition:
mss12.h:59
MSS12Context::pal_pic
uint8_t * pal_pic
Definition:
mss12.h:78
ff_mss12_model_update
void ff_mss12_model_update(Model *m, int val)
Definition:
mss12.c:95
Model::cum_prob
int16_t cum_prob[MODEL_MAX_SYMS+1]
Definition:
mss12.h:41
width
static int width
Definition:
demuxing_decoding.c:39
Generated on Wed Jun 10 2015 01:56:46 for FFmpeg by
1.8.6