1/*
2 * VC3/DNxHD encoder structure definitions and prototypes
3 * Copyright (c) 2007 Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
4 *
5 * VC-3 encoder funded by the British Broadcasting Corporation
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#ifndef AVCODEC_DNXHDENC_H
25#define AVCODEC_DNXHDENC_H
26
27#include <stdint.h>
28#include "libavcodec/mpegvideo.h"
29#include "libavcodec/dnxhddata.h"
30
31typedef struct {
32    uint16_t mb;
33    int value;
34} RCCMPEntry;
35
36typedef struct {
37    int ssd;
38    int bits;
39} RCEntry;
40
41typedef struct DNXHDEncContext {
42    MpegEncContext m; ///< Used for quantization dsp functions
43
44    AVFrame frame;
45    int cid;
46    const CIDEntry *cid_table;
47    uint8_t *msip; ///< Macroblock Scan Indexes Payload
48    uint32_t *slice_size;
49    uint32_t *slice_offs;
50
51    struct DNXHDEncContext *thread[MAX_THREADS];
52
53    unsigned dct_y_offset;
54    unsigned dct_uv_offset;
55    int interlaced;
56    int cur_field;
57
58    DECLARE_ALIGNED(16, DCTELEM, blocks)[8][64];
59
60    int      (*qmatrix_c)     [64];
61    int      (*qmatrix_l)     [64];
62    uint16_t (*qmatrix_l16)[2][64];
63    uint16_t (*qmatrix_c16)[2][64];
64
65    unsigned frame_bits;
66    uint8_t *src[3];
67
68    uint32_t *vlc_codes;
69    uint8_t  *vlc_bits;
70    uint16_t *run_codes;
71    uint8_t  *run_bits;
72
73    /** Rate control */
74    unsigned slice_bits;
75    unsigned qscale;
76    unsigned lambda;
77
78    unsigned thread_size;
79
80    uint16_t *mb_bits;
81    uint8_t  *mb_qscale;
82
83    RCCMPEntry *mb_cmp;
84    RCEntry   (*mb_rc)[8160];
85
86    void (*get_pixels_8x4_sym)(DCTELEM */*align 16*/, const uint8_t *, int);
87} DNXHDEncContext;
88
89void ff_dnxhd_init_mmx(DNXHDEncContext *ctx);
90
91#endif /* AVCODEC_DNXHDENC_H */
92