-
Notifications
You must be signed in to change notification settings - Fork 1
/
picture.hpp
143 lines (100 loc) · 3.62 KB
/
picture.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#ifndef PICTURE_HPP
#define PICTURE_HPP
enum PictureType { I = 1, P, B };
#include "mpegheader.hpp"
class Frame;
class FrameHandle;
class DecodeSlices;
class DecodeEngine;
class Picture : public MPEGHeader
{
private:
File *file;
int coded_order, display_order;
PictureType type;
uint16_t temporal_reference;
uint16_t vbv_delay;
Sequence *sequence;
PictureCodingExtension *extension;
bool unclean_last_anchor;
bool incomplete;
bool broken;
bool unknown_quantiser_matrix;
bool invalid;
double presentation_time;
uint8_t *intra_quantiser_matrix,
*non_intra_quantiser_matrix;
Slice **first_slice_in_row;
Picture *forward_reference, *backward_reference;
void setup_decoder( mpeg2_decoder_t *d,
uint8_t *current_fbuf[3],
uint8_t *forward_fbuf[3],
uint8_t *backward_fbuf[3] );
static void motion_setup( mpeg2_decoder_t *d );
FrameHandle *fh;
pthread_mutex_t decoding_mutex;
pthread_cond_t decoding_activity;
int decoding;
off_t slices_start, slices_end;
public:
int get_coded( void ) { return coded_order; }
void set_coded( int s_coded ) { coded_order = s_coded; }
int get_display( void ) { return display_order; }
void set_display( int s_display ) { display_order = s_display; }
bool get_unclean( void ) { return unclean_last_anchor; }
void set_unclean( bool s_unclean ) { unclean_last_anchor = s_unclean; }
bool get_broken( void ) { return broken; }
void set_broken( bool s ) { broken = s; }
void set_unknown_quantiser_matrix( bool s_unknown ) { unknown_quantiser_matrix = s_unknown; }
bool get_unknown_quantiser_matrix( void ) { return unknown_quantiser_matrix; }
bool get_incomplete( void ) { return incomplete; }
bool get_invalid( void ) { return invalid; }
bool problem( void ) { return (get_broken() || get_unknown_quantiser_matrix() || get_incomplete() || get_invalid()); }
double get_time( void ) { return presentation_time; }
void set_time( double s_time ) { presentation_time = s_time; }
void set_intra( uint8_t *s ) { intra_quantiser_matrix = s; }
void set_non_intra( uint8_t *s ) { non_intra_quantiser_matrix = s; }
uint num_fields( void );
PictureType get_type( void ) { return type; }
char get_type_char( void ) { return "XIPB"[type]; }
void set_sequence( Sequence *s )
{
ahabassert( sequence == NULL );
sequence = s;
}
Sequence *get_sequence( void ) {
ahabassert( sequence );
return sequence;
}
PictureCodingExtension *get_extension( void ) {
ahabassert( extension );
return extension;
}
void set_forward( Picture *s ) {
ahabassert( forward_reference == NULL );
ahabassert( (type == P) || (type == B) );
forward_reference = s;
}
void set_backward( Picture *s ) {
ahabassert( backward_reference == NULL );
ahabassert( type == B );
backward_reference = s;
}
Picture *get_forward( void ) { return forward_reference; }
Picture *get_backward( void ) { return backward_reference; }
Slice *get_first_slice_in_row( uint row ) { return first_slice_in_row[ row ]; }
int get_f_code_fv( void ) { return get_extension()->f_code_fv; }
int get_f_code_bv( void ) { return get_extension()->f_code_bv; }
FrameHandle *get_framehandle( void ) { return fh; }
Picture( BitReader &hdr, File *s_file );
~Picture();
void init_fh( BufferPool *pool );
virtual void print_info( void );
virtual void link( void );
void lock_and_decodeall();
void start_parallel_decode( DecodeEngine *engine, bool leave_locked );
void decoder_internal( DecodeSlices *job );
void decoder_cleanup_internal( bool leave_locked );
void register_slice_extent( off_t start, off_t end );
};
#endif