1/*
2 * Copyright (c) 2007-2013 Intel Corporation. All Rights Reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
14 * of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25/**
26 * \file va_enc_jpeg.h
27 * \brief JPEG encoding API
28 *
29 * This file contains the \ref api_enc_jpeg "JPEG encoding API".
30 */
31
32#ifndef VA_ENC_JPEG_H
33#define VA_ENC_JPEG_H
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/**
40 * \defgroup api_enc_jpeg JPEG encoding API
41 *
42 * @{
43 */
44
45/**
46 * \brief JPEG Encoding Picture Parameter Buffer Structure
47 *
48 * This structure conveys picture level parameters.
49 *
50 */
51typedef struct  _VAEncPictureParameterBufferJPEG
52{
53    /** \brief holds reconstructed picture. */
54    VASurfaceID reconstructed_picture;
55    /** \brief picture width. */
56    unsigned short picture_width;
57    /** \brief picture height. */
58    unsigned short picture_height;
59    /** \brief holds coded data. */
60    VABufferID coded_buf;
61
62    /**
63     * \brief pic_flags
64     *
65     */
66    union {
67        struct {
68            /**
69             * \brief profile:
70             * 0 - Baseline, 1 - Extended, 2 - Lossless, 3 - Hierarchical
71             */
72            unsigned int profile     : 2;
73            /**
74             * \brief progressive:
75             * 0 - sequential, 1 - extended, 2 - progressive
76             */
77            unsigned int progressive : 1;
78            /**
79             * \brief huffman:
80             * 0 - arithmetic, 1 - huffman
81             */
82            unsigned int huffman     : 1;
83            /**
84             * \brief interleaved:
85             * 0 - non interleaved, 1 - interleaved
86             */
87            unsigned int interleaved : 1;
88            /**
89             * \brief differential:
90             * 0 - non differential, 1 - differential
91             */
92            unsigned int differential   : 1;
93        } bits;
94        unsigned int value;
95    } pic_flags;
96
97    /** \brief number of bits per sample. */
98    unsigned char    sample_bit_depth;
99    /** \brief total number of scans in image. */
100    unsigned char    num_scan;
101    /** \brief number of image components in frame. */
102    unsigned short   num_components;
103    /** \brief Component identifier (Ci). */
104    unsigned char    component_id[4];
105    /** \brief Quantization table selector (Tqi). */
106    unsigned char    quantiser_table_selector[4];
107    /** \brief number from 1 to 100 that specifies quality of image. */
108    unsigned char    quality;
109
110} VAEncPictureParameterBufferJPEG;
111
112
113/**
114 * \brief Slice parameter for JPEG encoding.
115 *
116 * This structure conveys slice (scan) level parameters.
117 *
118 */
119typedef struct _VAEncSliceParameterBufferJPEG {
120    /** \brief Restart interval definition (Ri). */
121    unsigned short    restart_interval;
122    /** \brief number of image components in a scan. */
123    unsigned short    num_components;
124    struct {
125        /** \brief Scan component selector (Csj). */
126        unsigned char   component_selector;
127        /** \brief DC entropy coding table selector (Tdj). */
128        unsigned char   dc_table_selector;
129        /** \brief AC entropy coding table selector (Taj). */
130        unsigned char   ac_table_selector;
131    } components[4];
132} VAEncSliceParameterBufferJPEG;
133
134/**
135 * \brief Quantization table for JPEG encoding.
136 *
137 */
138typedef struct _VAQMatrixBufferJPEG
139{
140    /** \brief load luma quantization table. */
141    int load_lum_quantiser_matrix;
142    /** \brief load chroma quantization table. */
143    int load_chroma_quantiser_matrix;
144    /** \brief luma quantization table. */
145    unsigned char lum_quantiser_matrix[64];
146    /** \brief chroma quantization table. */
147    unsigned char chroma_quantiser_matrix[64];
148} VAQMatrixBufferJPEG;
149
150/**@}*/
151
152#include <va/va_dec_jpeg.h>
153
154#ifdef __cplusplus
155}
156#endif
157
158#endif /* VA_ENC_JPEG_H */
159