1 /* ///////////////////////////////////////////////////////////////////////
2 //
3 //               INTEL CORPORATION PROPRIETARY INFORMATION
4 //  This software is supplied under the terms of a license agreement or
5 //  nondisclosure agreement with Intel Corporation and may not be copied
6 //  or disclosed except in accordance with the terms of that agreement.
7 //        Copyright (c) 2001-2006 Intel Corporation. All Rights Reserved.
8 //
9 //  Description:    VC1 header.
10 //
11 */
12 
13 #ifndef _VC1_COMMON_H_
14 #define _VC1_COMMON_H_
15 
16 /* If the pixel data is left near an emulation prevention sequence, the decoder will be unaware
17    unless we send some previous bytes */
18 //#define PADDING_FOR_EMUL 3
19 #define PADDING_FOR_EMUL 0
20 
21 #define GET_BLSB( name, bitf )  BLSB_MFD_##name##_##bitf
22 #define GET_BMSK( name, bitf )  BMSK_MFD_##name##_##bitf
23 
24 #define BF_READ( name, bitf, value )  ((value & GET_BMSK(name, bitf) ) >> GET_BLSB(name, bitf) )
25 #define BF_WRITE( name, bitf, value, data ) value = ((value & ~GET_BMSK(name, bitf)) | ((data) << GET_BLSB(name, bitf)))
26 
27 enum vc1_workload_item_type
28 {
29    VIDDEC_WORKLOAD_VC1_DMEM = VIDDEC_WORKLOAD_DECODER_SPECIFIC,
30    VIDDEC_WORKLOAD_VC1_BITOFFSET,
31    VIDDEC_WORKLOAD_VC1_BITPLANE0,
32    VIDDEC_WORKLOAD_VC1_BITPLANE1,
33    VIDDEC_WORKLOAD_VC1_BITPLANE2,
34    VIDDEC_WORKLOAD_VC1_PAST_FRAME   = VIDDEC_WORKLOAD_REF_FRAME_SOURCE_0,
35    VIDDEC_WORKLOAD_VC1_FUTURE_FRAME,
36 };
37 
38 typedef enum
39 {
40    vc1_ProgressiveFrame = 0,
41    vc1_InterlacedFrame  = 2,
42    vc1_InterlacedField  = 3,
43    vc1_PictureFormatNone
44 } vc1_fcm;
45 
46 /** This enumeration defines the various frame types as defined in PTYPE syntax
47 element.
48 PTYPE interpretation depends on bitstream profile. The value that needs to get
49 programmed in the frame_type register 0x2218 is this generic enum obtained
50 from Canmore code.
51 Changing this enum to match the spec for each profile caused md5 mismatches.
52 TODO: Why are these the values to program - is this the case with reference decoder?
53 */
54 enum
55 {
56     VC1_I_FRAME       = (1 << 0),
57     VC1_P_FRAME       = (1 << 1),
58     VC1_B_FRAME       = (1 << 2),
59     VC1_BI_FRAME      = VC1_I_FRAME | VC1_B_FRAME,
60     VC1_SKIPPED_FRAME = (1 << 3) | VC1_P_FRAME
61 };
62 
63 enum {
64    vc1_FrameDone   = 1 << 0,
65    vc1_FieldDone   = 1 << 1,
66    vc1_SliceDone   = 1 << 2,
67    vc1_Field1Done  = 1 << 3,
68    vc1_Field2Done  = 1 << 4,
69    vc1_FrameError  = 1 << 8,
70 };
71 
72 typedef struct {
73    /* 0x00 */ uint32_t general;
74    /* 0x04 */ uint32_t stream_format1;
75    /* 0x08 */ uint32_t coded_size;
76    /* 0x0c */ uint32_t stream_format2;
77    /* 0x10 */ uint32_t entrypoint1;
78    /* 0x14 */ uint32_t range_map;
79    /* 0x18 */ uint32_t frame_type;
80    /* 0x1c */ uint32_t recon_control;
81    /* 0x20 */ uint32_t mv_control;
82    /* 0x24 */ uint32_t intcomp_fwd_top;
83    /* 0x28 */ uint32_t ref_bfraction;
84    /* 0x2c */ uint32_t blk_control;
85    /* 0x30 */ uint32_t trans_data;
86    /* 0x34 */ uint32_t vop_dquant;
87 #define NUM_REF_ID 4
88    /* 0x38-0x48 */ uint32_t ref_frm_id[NUM_REF_ID];
89    /* 0x48 */ uint32_t fieldref_ctrl_id;
90    /* 0x4c */ uint32_t auxfrmctrl;
91    /* 0x50 */ uint32_t imgstruct;
92    /* 0x54 */ uint32_t alt_frame_type;
93    /* 0x58 */ uint32_t intcomp_fwd_bot;
94    /* 0x5c */ uint32_t intcomp_bwd_top;
95    /* 0x60 */ uint32_t intcomp_bwd_bot;
96    /* 0x64 */ uint32_t _stuffing;
97 } VC1D_SPR_REGS;
98 
99 /*
100 In VC1, past reference is the fwd reference and future reference is the backward reference
101 i.e. P frame has only a forward reference and B frame has both a forward and a backward reference.
102 */
103 enum {
104    VC1_FRAME_CURRENT_REF = 0,
105    VC1_FRAME_CURRENT_DIS,
106    VC1_FRAME_PAST,
107    VC1_FRAME_FUTURE,
108 };
109 
110 #endif  //_VC1_COMMON_H_
111 
112