1 /*
2 * Copyright (c) 2017, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file     codec_def_decode_jpeg.h
24 //! \brief    Defines decode JPEG types and macros shared by CodecHal, MHW, and DDI layer
25 //! \details  Applies to JPEG decode only. Should not contain any DDI specific code.
26 //!
27 #ifndef __CODEC_DEF_DECODE_JPEG_H__
28 #define __CODEC_DEF_DECODE_JPEG_H__
29 
30 #include "codec_def_common_jpeg.h"
31 #include "media_defs.h"
32 #define CODEC_DECODE_JPEG_BLOCK_SIZE 8
33 //!
34 //! \enum CodecDecodeJpegRotationType
35 //! \brief JPEG Rotation Types
36 //!
37 enum CodecDecodeJpegRotationType
38 {
39     jpegRotation0       = 0,    //!< Rotation of 0 digree
40     jpegRotation90      = 1,    //!< Rotation of 90 digrees
41     jpegRotation270     = 2,    //!< Rotation of 270 digrees
42     jpegRotation180     = 3,    //!< Rotation of 180 digrees
43 };
44 
45 //!
46 //! \struct CodecDecodeJpegImageLayout
47 //! \brief Information pertaining to the output of the decode render target
48 //!
49 struct CodecDecodeJpegImageLayout
50 {
51     uint32_t       m_componentDataOffset[jpegNumComponent];       //!< The offset within the decode render target for YUV components (Y/U/V/A)
52     uint32_t       m_pitch;                                       //!< Pitch of the decode render target
53 };
54 
55 //!
56 //! JPEG Scan Parameter
57 //! \brief JPEG Scan Parameter
58 //! Note: Some DDIs treat scans as slices
59 //!
60 struct CodecDecodeJpegScanParameter
61 {
62     struct
63     {
64         uint16_t              NumComponents;                         //!<  Number of components
65         uint8_t               ComponentSelector[jpegNumComponent];   //!<  Component selector
66         uint8_t               DcHuffTblSelector[jpegNumComponent];   //!<  DC Huffman table selector
67         uint8_t               AcHuffTblSelector[jpegNumComponent];   //!<  AC Huffman table selector
68         uint16_t              RestartInterval;                       //!<  Indicate restart interval
69         uint32_t              MCUCount;                              //!<  MCU count
70         uint16_t              ScanHoriPosition;                      //!<  Scan horizontal position
71         uint16_t              ScanVertPosition;                      //!<  Scan vertical position
72         uint32_t              DataOffset;                            //!<  Data offset
73         uint32_t              DataLength;                            //!<  Data length
74     }ScanHeader[jpegNumComponent];
75 
76     uint16_t              NumScans;
77 };
78 
79 typedef struct tagJPEG_DECODE_QUERY_STATUS
80 {
81     uint32_t StatusReportFeedbackNumber;
82     uint8_t  bStatus;
83     uint8_t  reserved8bits;
84     uint16_t reserved16bits;
85 } JPEG_DECODE_QUERY_STATUS, *PJPEG_DECODE_QUERY_STATUS;
86 #endif  // __CODEC_DEF_DECODE_JPEG_H__
87 
88