aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/cbs_vp8.h
blob: 9c09e21a1c11a11f1ee0de6341fbf5d482146d74 (plain) (blame)
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
/*
 * This file is part of FFmpeg.
 *
 * FFmpeg is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFmpeg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef AVCODEC_CBS_VP8_H
#define AVCODEC_CBS_VP8_H

#include <stddef.h>
#include <stdint.h>

#include "cbs.h"

enum {
    VP8_START_CODE_0 = 0x9D,
    VP8_START_CODE_1 = 0x01,
    VP8_START_CODE_2 = 0x2A,
};

enum {
    VP8_KEY_FRAME = 0,
    VP8_NON_KEY_FRAME = 1,
};

typedef struct VP8RawFrameHeader {
    // frame tag
    uint8_t frame_type;
    uint8_t profile;
    uint8_t show_frame;
    uint32_t first_partition_length_in_bytes;

    uint16_t width;
    uint8_t horizontal_scale;
    uint16_t height;
    uint8_t vertical_scale;

    // frame header
    uint8_t color_space;
    uint8_t clamping_type;

    // segmentation
    uint8_t segmentation_enable;
    uint8_t update_segment_map;
    uint8_t update_segment_feature_data;
    uint8_t segment_feature_mode;
    uint8_t segment_qp_update[4];
    int8_t segment_qp[4];
    uint8_t segment_loop_filter_level_update[4];
    int8_t segment_loop_filter_level[4];
    uint8_t segment_probs_update[3];
    uint8_t segment_probs[3];

    // loop filter
    uint8_t loop_filter_type;
    uint8_t loop_filter_level;
    uint8_t loop_filter_sharpness;
    uint8_t mode_ref_lf_delta_enable;
    uint8_t mode_ref_lf_delta_update;
    uint8_t ref_lf_deltas_update[4];
    int8_t ref_lf_deltas[4];
    uint8_t mode_lf_deltas_update[4];
    int8_t mode_lf_deltas[4];

    uint8_t log2_token_partitions;

    // qp
    uint8_t base_qindex;
    uint8_t y1dc_delta_q_present;
    int8_t y1dc_delta_q;
    uint8_t y2dc_delta_q_present;
    int8_t y2dc_delta_q;
    uint8_t y2ac_delta_q_present;
    int8_t y2ac_delta_q;
    uint8_t uvdc_delta_q_present;
    int8_t uvdc_delta_q;
    uint8_t uvac_delta_q_present;
    int8_t uvac_delta_q;

    // ref
    uint8_t refresh_golden_frame;
    uint8_t refresh_alternate_frame;
    uint8_t copy_buffer_to_golden;
    uint8_t copy_buffer_to_alternate;
    uint8_t ref_frame_sign_bias_golden;
    uint8_t ref_frame_sign_bias_alternate;
    uint8_t refresh_last_frame;

    uint8_t refresh_entropy_probs;

    // token probs
    uint8_t coeff_prob_update[4][8][3][11];
    uint8_t coeff_prob[4][8][3][11];

    uint8_t mb_no_skip_coeff;
    uint8_t prob_skip_false;

    uint8_t prob_intra;
    uint8_t prob_last;
    uint8_t prob_golden;

    uint8_t intra_16x16_prob_update;
    uint8_t intra_16x16_prob[4];

    uint8_t intra_chrome_prob_update;
    uint8_t intra_chrome_prob[3];

    // mv probs
    uint8_t mv_prob_update[2][19];
    uint8_t mv_prob[2][19];
} VP8RawFrameHeader;

typedef struct VP8RawFrame {
    VP8RawFrameHeader header;

    uint8_t *data;
    AVBufferRef *data_ref;
    size_t data_size;
} VP8RawFrame;

#endif /* AVCODEC_CBS_VP8_H */