author | Mikael Laine <mikael.laine@ixonos.com> |
Fri, 29 Jan 2010 14:08:33 +0200 | |
changeset 0 | 951a5db380a0 |
permissions | -rw-r--r-- |
0
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1 |
/* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2010 Ixonos Plc. |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
5 |
* under the terms of the "Eclipse Public License v1.0" |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
8 |
* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - Initial contribution |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
11 |
* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
12 |
* Contributors: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
13 |
* Ixonos Plc |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
14 |
* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
15 |
* Description: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
16 |
* Picture header decoding functions. |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
17 |
* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
18 |
*/ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
19 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
20 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
21 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
22 |
#include "h263dConfig.h" |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
23 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
24 |
#include "decpich.h" |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
25 |
#include "debug.h" |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
26 |
#include "vdeims.h" |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
27 |
#include "vdeimb.h" |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
28 |
#include "viddemux.h" |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
29 |
#include "sync.h" |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
30 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
31 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
32 |
/* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
33 |
* Global functions |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
34 |
*/ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
35 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
36 |
/* {{-output"dphGetPictureHeader.txt"}} */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
37 |
/* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
38 |
* dphGetPictureHeader |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
39 |
* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
40 |
* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
41 |
* Parameters: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
42 |
* inParam input parameters |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
43 |
* inOutParam input/output parameters, these parameters |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
44 |
* may be modified in the function |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
45 |
* outParam output parameters |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
46 |
* bitErrorIndication bit error indication, see biterr.h for |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
47 |
* the possible values |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
48 |
* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
49 |
* Function: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
50 |
* This function gets and decodes a picture header which should start |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
51 |
* with a PSC at the current position of the bit buffer. At first, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
52 |
* the function reads the picture header fields from the bitstream. |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
53 |
* Then, it checks whether the values of the fields are supported. |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
54 |
* An unsupported value is interpreted as a bit error. Finally, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
55 |
* the function updates VDC instance data and output parameters |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
56 |
* (according to the new picture header). |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
57 |
* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
58 |
* Returns: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
59 |
* DPH_OK |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
60 |
* DPH_OK_BUT_BIT_ERROR |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
61 |
* DPH_ERR |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
62 |
* DPH_ERR_NO_INTRA |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
63 |
* DPH_ERR_FORMAT_CHANGE |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
64 |
* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
65 |
*/ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
66 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
67 |
int dphGetPictureHeader( |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
68 |
const dphInParam_t *inParam, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
69 |
dphInOutParam_t *inOutParam, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
70 |
dphOutParam_t *outParam, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
71 |
int *bitErrorIndication) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
72 |
/* {{-output"dphGetPictureHeader.txt"}} */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
73 |
{ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
74 |
bibBuffer_t *inBuffer = inOutParam->inBuffer; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
75 |
u_char fPrevIntraGot; /* Non-zero if an INTRA frame has been decoded |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
76 |
before the current frame */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
77 |
vdxGetPictureHeaderInputParam_t picHdrIn; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
78 |
vdxPictureHeader_t picHeader; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
79 |
vdcInstance_t *instance = inOutParam->vdcInstance; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
80 |
vdcPictureParam_t *pictureParam = &instance->pictureParam; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
81 |
vdcPictureParam_t prevPictParam; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
82 |
int trd; /* Difference between present and previous tr */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
83 |
int fInterFrame; /* non-zero = INTER frame, 0 = INTRA frame */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
84 |
int fPBFrame; /* Flag indicating a PB-frame */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
85 |
int fRPS; /* 1 = RPS used, 0 = RPS not used */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
86 |
int ret = 0; /* temporary variable to carry return values */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
87 |
int retVal = DPH_OK; /* return value if everything as expected, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
88 |
either DPH_OK or DPH_OK_BUT_SKIP */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
89 |
int16 error = 0; /* snc and mvc module error code */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
90 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
91 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
92 |
/* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
93 |
* Get picture header |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
94 |
*/ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
95 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
96 |
picHdrIn.numStuffBits = inParam->numStuffBits; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
97 |
picHdrIn.fCustomPCF = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
98 |
picHdrIn.fScalabilityMode = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
99 |
picHdrIn.fRPS = instance->fRPS; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
100 |
picHdrIn.flushBits = bibFlushBits; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
101 |
picHdrIn.getBits = bibGetBits; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
102 |
picHdrIn.showBits = bibShowBits; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
103 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
104 |
/* Used to recover the 1st picture segment */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
105 |
u_int32 picHeaderStartPos = bibNumberOfFlushedBits(inBuffer); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
106 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
107 |
if ( inParam->numStuffBits ) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
108 |
bibFlushBits(inParam->numStuffBits, inBuffer, &picHdrIn.numStuffBits, bitErrorIndication, &error); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
109 |
picHdrIn.numStuffBits = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
110 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
111 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
112 |
// Read header bits normally from the bitstream |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
113 |
ret = vdxGetPictureHeader(inBuffer, &picHdrIn, &picHeader, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
114 |
bitErrorIndication); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
115 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
116 |
if ( ret < 0 ) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
117 |
return DPH_ERR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
118 |
else if ( ret == VDX_OK_BUT_BIT_ERROR ) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
119 |
{ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
120 |
// Bit error exists. |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
121 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
122 |
} // end of if ( ret == VDX_OK_BUT_BIT_ERROR ) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
123 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
124 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
125 |
/* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
126 |
* Check picture header validity |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
127 |
*/ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
128 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
129 |
/* Local parameters needed in validity check (and possibly afterwards) */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
130 |
fPrevIntraGot = instance->fIntraGot; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
131 |
fInterFrame = (picHeader.pictureType == VDX_PIC_TYPE_P || |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
132 |
picHeader.pictureType == VDX_PIC_TYPE_PB || |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
133 |
picHeader.pictureType == VDX_PIC_TYPE_IPB); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
134 |
fPBFrame = ((picHeader.pictureType == VDX_PIC_TYPE_PB)|| |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
135 |
(picHeader.pictureType == VDX_PIC_TYPE_IPB)); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
136 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
137 |
/* TR with the same value as in the previous picture can be interpreted |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
138 |
two ways: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
139 |
- if Reference Picture Selection is enabled, it means |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
140 |
a synchronization frame |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
141 |
- if Reference Picture Selection is not used, it means the maximum |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
142 |
difference between two frames. |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
143 |
However, at least VDOPhone uses TR equal to zero always, which |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
144 |
in practice should be interpreted that TR field is not used in |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
145 |
display timing. */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
146 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
147 |
/* At first, check if RPS is used */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
148 |
if (picHeader.fPLUSPTYPE && picHeader.ufep) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
149 |
fRPS = picHeader.fRPS; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
150 |
else |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
151 |
fRPS = instance->fRPS; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
152 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
153 |
/* Calculate temporal reference difference (from the previous frame) */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
154 |
trd = picHeader.tr - instance->pictureParam.tr; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
155 |
if (trd < 0) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
156 |
trd += 256; /* Note: Add ETR support */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
157 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
158 |
/* If TR is the same as in the previous frame and Reference Picture Selection |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
159 |
is not used and not the very first frame (in which case previous tr == 0), |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
160 |
the temporal reference difference is the maximum one. */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
161 |
if (trd == 0 && !fRPS && instance->frameNum > 0) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
162 |
trd = 256; /* Note: Add ETR support */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
163 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
164 |
/* If unsupported picture type */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
165 |
if (picHeader.pictureType != VDX_PIC_TYPE_I |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
166 |
&& picHeader.pictureType != VDX_PIC_TYPE_P |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
167 |
&& picHeader.pictureType != VDX_PIC_TYPE_PB |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
168 |
&& picHeader.pictureType != VDX_PIC_TYPE_IPB |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
169 |
) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
170 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
171 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
172 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
173 |
if (picHeader.pictureType == VDX_PIC_TYPE_PB || |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
174 |
picHeader.pictureType == VDX_PIC_TYPE_IPB) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
175 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
176 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
177 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
178 |
if (picHeader.cpm) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
179 |
/* No CPM support */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
180 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
181 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
182 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
183 |
if (picHeader.fPLUSPTYPE) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
184 |
/* If unsupported modes (and UFEP is whatever) */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
185 |
if (picHeader.fRPR || |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
186 |
picHeader.fRRU) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
187 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
188 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
189 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
190 |
if (picHeader.ufep == 1) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
191 |
/* If unsupported mode */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
192 |
if (picHeader.fISD || |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
193 |
picHeader.fSAC || |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
194 |
picHeader.fAIV || |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
195 |
picHeader.fCustomPCF) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
196 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
197 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
198 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
199 |
if (picHeader.fUMV) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
200 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
201 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
202 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
203 |
if (picHeader.fAP) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
204 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
205 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
206 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
207 |
if (picHeader.fAIC) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
208 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
209 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
210 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
211 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
212 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
213 |
if (picHeader.fDF) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
214 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
215 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
216 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
217 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
218 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
219 |
if (picHeader.fSS) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
220 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
221 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
222 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
223 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
224 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
225 |
if (picHeader.fMQ) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
226 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
227 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
228 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
229 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
230 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
231 |
/* Note: Add check for "The Indenpenent Segment Decoding mode shall not |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
232 |
be used with the Reference Picture Resampling mode" |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
233 |
from section 5.1.4.6 of the H.263 recommendation whenever both of |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
234 |
the modes in question are supported. |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
235 |
Note that this check cannot reside in vdxGetPictureHeader since |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
236 |
ISD and RPR can be turned on in different pictures. */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
237 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
238 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
239 |
/* Else no PLUSPTYPE */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
240 |
else { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
241 |
/* If unsupported modes */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
242 |
if (picHeader.fSAC) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
243 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
244 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
245 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
246 |
if (picHeader.fUMV) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
247 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
248 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
249 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
250 |
if (picHeader.fAP) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
251 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
252 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
253 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
254 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
255 |
/* If no INTRA frame has ever been decoded and the current frame is INTER */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
256 |
if (!fPrevIntraGot && fInterFrame) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
257 |
return DPH_ERR_NO_INTRA; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
258 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
259 |
if (fPrevIntraGot) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
260 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
261 |
/* If width and height are indicated in the header and |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
262 |
they are different from the previous */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
263 |
if ((picHeader.fPLUSPTYPE == 0 || picHeader.ufep == 1) && |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
264 |
(instance->pictureParam.lumWidth != picHeader.lumWidth || |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
265 |
instance->pictureParam.lumHeight != picHeader.lumHeight)) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
266 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
267 |
if (fInterFrame) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
268 |
/* INTER frame, check that the source format has not changed */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
269 |
deb("vdcDecodeFrame: ERROR - Source format has changed " |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
270 |
"(INTER frame)\n"); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
271 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
272 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
273 |
else if ( *bitErrorIndication ) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
274 |
deb("vdcDecodeFrame: ERROR - Frame size changing during " |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
275 |
"the sequence, cause: bitError\n"); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
276 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
277 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
278 |
else { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
279 |
/* At the moment do NOT allow source format changes during |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
280 |
the sequence. */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
281 |
deb("vdcDecodeFrame: ERROR - Frame size changing during " |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
282 |
"the sequence\n"); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
283 |
return DPH_ERR_FORMAT_CHANGE; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
284 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
285 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
286 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
287 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
288 |
/* If the temporal reference of B points after P */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
289 |
if (fPBFrame && trd <= picHeader.trb) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
290 |
deb("vdcDecodeFrame: ERROR - TRB illegal.\n"); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
291 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
292 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
293 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
294 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
295 |
/* Now, the picture header is considered to be error-free, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
296 |
and its contents are used to manipulate instance data */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
297 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
298 |
/* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
299 |
* Update instance data and output parameters |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
300 |
*/ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
301 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
302 |
/* Update frame numbers */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
303 |
{ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
304 |
int32 oldFrameNum = instance->frameNum; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
305 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
306 |
instance->frameNum += trd; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
307 |
if (instance->frameNum < 0) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
308 |
/* Wrap from 0x7fffffff to 0 instead of the largest negative number */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
309 |
instance->frameNum += 0x80000000; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
310 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
311 |
if (fPBFrame) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
312 |
instance->frameNumForBFrame = oldFrameNum + picHeader.trb; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
313 |
if (instance->frameNumForBFrame < 0) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
314 |
/* Wrap from 0x7fffffff to 0 instead of the largest negative number */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
315 |
instance->frameNumForBFrame += 0x80000000; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
316 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
317 |
else |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
318 |
instance->frameNumForBFrame = -1; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
319 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
320 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
321 |
/* Note: If no INTRA has been got the function has already returned */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
322 |
instance->fIntraGot = 1; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
323 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
324 |
outParam->pquant = picHeader.pquant; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
325 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
326 |
instance->fRPS = fRPS; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
327 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
328 |
if (instance->fRPS && picHeader.trpi) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
329 |
outParam->trp = picHeader.trp; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
330 |
else |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
331 |
outParam->trp = -1; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
332 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
333 |
if (instance->fRPS && picHeader.fPLUSPTYPE && picHeader.ufep) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
334 |
instance->rpsMode = picHeader.rpsMode; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
335 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
336 |
/* Store previous picture parameters temporarily */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
337 |
memcpy(&prevPictParam, pictureParam, sizeof(vdcPictureParam_t)); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
338 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
339 |
/* Update picture parameters */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
340 |
pictureParam->tr = picHeader.tr; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
341 |
pictureParam->trd = trd; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
342 |
pictureParam->fSplitScreenIndicator = picHeader.fSplitScreen; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
343 |
pictureParam->fDocumentCameraIndicator = picHeader.fDocumentCamera; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
344 |
pictureParam->fFullPictureFreezeRelease = picHeader.fFreezePictureRelease; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
345 |
pictureParam->pictureType = picHeader.pictureType; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
346 |
pictureParam->fPLUSPTYPE = picHeader.fPLUSPTYPE; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
347 |
pictureParam->cpm = picHeader.cpm; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
348 |
pictureParam->psbi = picHeader.psbi; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
349 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
350 |
if (fPBFrame) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
351 |
pictureParam->trb = picHeader.trb; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
352 |
pictureParam->dbquant = picHeader.dbquant; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
353 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
354 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
355 |
if (!picHeader.fPLUSPTYPE || picHeader.ufep) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
356 |
pictureParam->lumWidth = picHeader.lumWidth; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
357 |
pictureParam->lumHeight = picHeader.lumHeight; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
358 |
pictureParam->fUMV = picHeader.fUMV; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
359 |
pictureParam->fSAC = picHeader.fSAC; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
360 |
pictureParam->fAP = picHeader.fAP; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
361 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
362 |
if (pictureParam->lumWidth % 16) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
363 |
pictureParam->lumMemWidth = |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
364 |
(pictureParam->lumWidth / 16 + 1) * 16; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
365 |
else |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
366 |
pictureParam->lumMemWidth = pictureParam->lumWidth; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
367 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
368 |
if (pictureParam->lumHeight % 16) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
369 |
pictureParam->lumMemHeight = (pictureParam->lumHeight / 16 + 1) * 16; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
370 |
else |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
371 |
pictureParam->lumMemHeight = pictureParam->lumHeight; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
372 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
373 |
if (picHeader.lumHeight <= 400) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
374 |
pictureParam->numMBLinesInGOB = 1; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
375 |
else if (picHeader.lumHeight <= 800) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
376 |
pictureParam->numMBLinesInGOB = 2; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
377 |
else |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
378 |
pictureParam->numMBLinesInGOB = 4; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
379 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
380 |
pictureParam->numMBsInMBLine = pictureParam->lumMemWidth / 16; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
381 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
382 |
{ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
383 |
int |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
384 |
numMBLines = pictureParam->lumMemHeight / 16, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
385 |
numMBLinesInLastGOB = |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
386 |
numMBLines % pictureParam->numMBLinesInGOB; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
387 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
388 |
if (numMBLinesInLastGOB) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
389 |
pictureParam->numGOBs = |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
390 |
numMBLines / pictureParam->numMBLinesInGOB + 1; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
391 |
pictureParam->fLastGOBSizeDifferent = 1; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
392 |
pictureParam->numMBsInLastGOB = |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
393 |
numMBLinesInLastGOB * pictureParam->numMBsInMBLine; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
394 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
395 |
else { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
396 |
pictureParam->numGOBs = |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
397 |
numMBLines / pictureParam->numMBLinesInGOB ; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
398 |
pictureParam->fLastGOBSizeDifferent = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
399 |
pictureParam->numMBsInLastGOB = |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
400 |
pictureParam->numMBLinesInGOB * pictureParam->numMBsInMBLine; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
401 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
402 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
403 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
404 |
pictureParam->numMBsInGOB = |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
405 |
pictureParam->numMBsInMBLine * pictureParam->numMBLinesInGOB; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
406 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
407 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
408 |
else { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
409 |
pictureParam->lumWidth = prevPictParam.lumWidth; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
410 |
pictureParam->lumHeight = prevPictParam.lumHeight; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
411 |
pictureParam->lumMemWidth = prevPictParam.lumMemWidth; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
412 |
pictureParam->lumMemHeight = prevPictParam.lumMemHeight; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
413 |
pictureParam->fUMV = prevPictParam.fUMV; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
414 |
pictureParam->fSAC = prevPictParam.fSAC; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
415 |
pictureParam->fAP = prevPictParam.fAP; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
416 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
417 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
418 |
/* Note: Mode inference rules defined in section 5.1.4.5 of |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
419 |
the H.263 recommendation are (in most cases) not reflected to members |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
420 |
of pictureParam due to the fact that they are implicitly turned |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
421 |
off or irrelevant in the current implementation. (This is particularly |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
422 |
true when assigning inferred state "off".) */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
423 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
424 |
if (picHeader.fPLUSPTYPE) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
425 |
pictureParam->fRPR = picHeader.fRPR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
426 |
pictureParam->fRRU = picHeader.fRRU; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
427 |
pictureParam->rtype = picHeader.rtype; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
428 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
429 |
/* Note: irrelevant if Annex O is not in use */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
430 |
pictureParam->elnum = picHeader.elnum; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
431 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
432 |
if (picHeader.ufep) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
433 |
pictureParam->fCustomSourceFormat = picHeader.fCustomSourceFormat; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
434 |
pictureParam->fAIC = picHeader.fAIC; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
435 |
pictureParam->fDF = picHeader.fDF; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
436 |
pictureParam->fSS = picHeader.fSS; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
437 |
pictureParam->fRPS = picHeader.fRPS; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
438 |
pictureParam->fISD = picHeader.fISD; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
439 |
pictureParam->fAIV = picHeader.fAIV; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
440 |
pictureParam->fMQ = picHeader.fMQ; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
441 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
442 |
pictureParam->fUMVLimited = picHeader.fUMVLimited; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
443 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
444 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
445 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
446 |
/* Else no UFEP */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
447 |
else { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
448 |
pictureParam->fCustomSourceFormat = |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
449 |
prevPictParam.fCustomSourceFormat; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
450 |
pictureParam->fAIC = prevPictParam.fAIC; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
451 |
pictureParam->fDF = prevPictParam.fDF; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
452 |
pictureParam->fSS = prevPictParam.fSS; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
453 |
pictureParam->fRPS = prevPictParam.fRPS; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
454 |
pictureParam->fISD = prevPictParam.fISD; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
455 |
pictureParam->fAIV = prevPictParam.fAIV; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
456 |
pictureParam->fMQ = prevPictParam.fMQ; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
457 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
458 |
pictureParam->fUMVLimited = prevPictParam.fUMVLimited; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
459 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
460 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
461 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
462 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
463 |
/* Else no PLUSPTYPE */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
464 |
else { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
465 |
/* Section 5.1.4.5 of the H.263 recommendation states: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
466 |
"If a picture is sent which does not contain (PLUSPTYPE), |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
467 |
a state "off" shall be assigned to all modes not explicitly set to |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
468 |
"on" in the PTYPE filed, and all modes shall continue to have |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
469 |
an inferred state of "off" until a new picture containing |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
470 |
the optional part of PLUSPTYPE is sent." */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
471 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
472 |
/* Fields occuring in mandatory part of PLUSPTYPE are copied from |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
473 |
the previous picture. */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
474 |
pictureParam->fRPR = prevPictParam.fRPR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
475 |
pictureParam->fRRU = prevPictParam.fRRU; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
476 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
477 |
/* RTYPE is set to zero according to section 6.1.2 of |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
478 |
the H.263 recommendation */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
479 |
pictureParam->rtype = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
480 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
481 |
/* Modes occuring in the optional part of PLUSPTYPE are turned off |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
482 |
(unless occuring in PTYPE field too, like Advanced Prediction). */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
483 |
pictureParam->fCustomSourceFormat = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
484 |
pictureParam->fCustomPCF = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
485 |
pictureParam->fAIC = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
486 |
pictureParam->fDF = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
487 |
pictureParam->fSS = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
488 |
pictureParam->fRPS = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
489 |
pictureParam->fISD = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
490 |
pictureParam->fAIV = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
491 |
pictureParam->fMQ = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
492 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
493 |
/* Other related settings turned off just to be sure that they are |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
494 |
not misused. */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
495 |
pictureParam->fUMVLimited = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
496 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
497 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
498 |
pictureParam->fMVsOverPictureBoundaries = |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
499 |
(pictureParam->fUMV || pictureParam->fAP || |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
500 |
pictureParam->fDF); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
501 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
502 |
/* Initialize motion vector count module */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
503 |
mvcStart( &instance->mvcData, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
504 |
instance->pictureParam.lumMemWidth / 16 - 1, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
505 |
pictureParam->lumMemWidth, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
506 |
pictureParam->lumMemHeight, &error); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
507 |
/* Note: This assumes that the memory for frame->mvcData is filled with 0 |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
508 |
in the first time the function is called. |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
509 |
(This is ensured by setting the instance data to zero when it is |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
510 |
initialized in vdcOpen.) */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
511 |
instance->mvcData.fSS = pictureParam->fSS; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
512 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
513 |
if (error) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
514 |
deb("mvcStart failed.\n"); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
515 |
return DPH_ERR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
516 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
517 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
518 |
/* Get image buffers */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
519 |
{ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
520 |
vdeIms_t *store = instance->imageStore; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
521 |
vdeImsItem_t *imsItem; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
522 |
vdeImb_t *imb; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
523 |
int width, height; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
524 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
525 |
vdeImsSetYUVNeed(store, inParam->fNeedDecodedFrame); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
526 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
527 |
if (vdeImsGetFree(store, instance->pictureParam.lumMemWidth, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
528 |
instance->pictureParam.lumMemHeight, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
529 |
&instance->currFrame) < 0) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
530 |
goto errGetFreeP; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
531 |
imsItem = instance->currFrame; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
532 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
533 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
534 |
if (vdeImsStoreItemToImageBuffer(imsItem, &imb) < 0) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
535 |
goto errAfterGetFreeP; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
536 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
537 |
if (vdeImbYUV(imb, &outParam->currYFrame, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
538 |
&outParam->currUFrame, &outParam->currVFrame, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
539 |
&width, &height) < 0) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
540 |
goto errAfterGetFreeP; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
541 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
542 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
543 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
544 |
/* Initialize the parameters for the advanced intra coding structure. */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
545 |
if (pictureParam->fAIC) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
546 |
{ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
547 |
// not supported |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
548 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
549 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
550 |
/* Initialize the parameters for Slice Structured Mode. */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
551 |
if (pictureParam->fSS) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
552 |
{ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
553 |
// not supported |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
554 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
555 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
556 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
557 |
/* If picture header successfully decoded or reliably recovered */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
558 |
if ( inParam->fReadBits && ret == VDX_OK ) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
559 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
560 |
/* In the beginning, tr is set to -1 */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
561 |
if ( instance->fPrevPicHeaderReliable |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
562 |
&& instance->prevPicHeader->tr >= 0 |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
563 |
&& ( picHeader.pictureType != instance->prevPicHeader->pictureType |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
564 |
|| picHeader.fUMV != instance->prevPicHeader->fUMV |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
565 |
|| picHeader.fAP != instance->prevPicHeader->fAP |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
566 |
|| picHeader.fPLUSPTYPE != instance->prevPicHeader->fPLUSPTYPE |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
567 |
|| ( ( picHeader.fPLUSPTYPE == 0 || picHeader.ufep == 1 ) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
568 |
&& ( picHeader.lumWidth != instance->prevPicHeader->lumWidth |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
569 |
|| picHeader.lumHeight != instance->prevPicHeader->lumHeight ) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
570 |
) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
571 |
|| ( picHeader.fPLUSPTYPE == 1 && picHeader.ufep == 1 |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
572 |
&& ( picHeader.fAIC != instance->prevPicHeader->fAIC |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
573 |
|| picHeader.fDF != instance->prevPicHeader->fDF |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
574 |
|| picHeader.fMQ != instance->prevPicHeader->fMQ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
575 |
|| picHeader.fUMVLimited != instance->prevPicHeader->fUMVLimited |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
576 |
) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
577 |
) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
578 |
) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
579 |
|| ( picHeader.fPLUSPTYPE == 1 |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
580 |
&& picHeader.rtype != instance->prevPicHeader->rtype ) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
581 |
) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
582 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
583 |
/* Some parameter in PTYPE/PLUSPTYPE has changed, GFID should change also */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
584 |
/* Note that some parameters, such as SAC, are not checked since they have not been implemented */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
585 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
586 |
instance->fGFIDShouldChange = 1; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
587 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
588 |
else if ( !instance->fPrevPicHeaderReliable ) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
589 |
/* Previous picture header was not reliable, don't check GFID */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
590 |
instance->fGFIDShouldChange = 1; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
591 |
instance->gfid = -1; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
592 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
593 |
else if ( instance->gfid == -1 ) { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
594 |
/* The very first frame, or a frame after a lost frame, GFID can be whatever */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
595 |
/* Note: instance->gfid == -1 is used to indicate that previous GFID |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
596 |
is not available as in the first picture in first GOB header. |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
597 |
If there is a picture without GOB headers and having a different |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
598 |
picture header than the surrounding pictures, instance->gfid is |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
599 |
reset to -1 in vdcDecodeFrame()! (Otherwise, a wrong GFID may be |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
600 |
used in GFID correctness check.) */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
601 |
instance->fGFIDShouldChange = 1; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
602 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
603 |
else { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
604 |
/* No changes in PTYPE => the same GFID. |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
605 |
* It is better not to change the value of this flag here, since |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
606 |
* if there are no GOB or slice headers where GFID can change, the next |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
607 |
* read GFID in some other frame than the one with the different PTYPE |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
608 |
* will be considered illegal |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
609 |
*/ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
610 |
/* instance->fGFIDShouldChange = 0; */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
611 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
612 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
613 |
/* Header was reliable and can be used when checking the next header */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
614 |
instance->fPrevPicHeaderReliable = 1; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
615 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
616 |
/* Copy the read header to be used if the next header is corrupted or lost */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
617 |
memcpy( instance->prevPicHeader, &picHeader, sizeof( vdxPictureHeader_t ) ); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
618 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
619 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
620 |
/* Else picture header unreliable */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
621 |
else { |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
622 |
/* Since we cannot trust that picture header is reliable, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
623 |
we cannot detect errors based on GFID. |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
624 |
Thus, let's disable GFID checking in GOB level. */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
625 |
instance->fPrevPicHeaderReliable = 0; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
626 |
instance->fGFIDShouldChange = 1; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
627 |
instance->gfid = -1; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
628 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
629 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
630 |
return retVal; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
631 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
632 |
/* Error condition handling, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
633 |
release everything in reverse order */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
634 |
// errAfterGetFreeB: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
635 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
636 |
// vdeImsPutFree(instance->imageStore, instance->bFrame); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
637 |
// errGetFreeB: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
638 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
639 |
errAfterGetFreeP: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
640 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
641 |
vdeImsPutFree(instance->imageStore, instance->currFrame); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
642 |
errGetFreeP: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
643 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
644 |
instance->currFrame = NULL; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
645 |
instance->bFrame = NULL; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
646 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
647 |
return DPH_ERR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
648 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
649 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
650 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
651 |
/* {{-output"dphGetSEI.txt"}} */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
652 |
/* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
653 |
* dphGetSEI |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
654 |
* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
655 |
* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
656 |
* Parameters: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
657 |
* vdcInstance Video Decoder Core instance |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
658 |
* inBuffer Bit Buffer instance |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
659 |
* bitErrorIndication bit error indication, see biterr.h for |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
660 |
* the possible values |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
661 |
* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
662 |
* Function: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
663 |
* This function gets and decodes Supplemental Enhancement |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
664 |
* Information. |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
665 |
* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
666 |
* Returns: |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
667 |
* >= 0 the function was successful |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
668 |
* < 0 an error occured |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
669 |
* |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
670 |
*/ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
671 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
672 |
int dphGetSEI( |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
673 |
vdcInstance_t *vdcInstance, /* Video Decoder Core instance */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
674 |
bibBuffer_t *inBuffer, /* Bit Buffer instance */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
675 |
int *bitErrorIndication) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
676 |
{ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
677 |
/* {{-output"dphGetSEI.txt"}} */ |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
678 |
int |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
679 |
vdxStatus; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
680 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
681 |
vdxSEI_t |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
682 |
sei; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
683 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
684 |
vdxStatus = vdxGetAndParseSEI( |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
685 |
inBuffer, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
686 |
vdcInstance->pictureParam.fPLUSPTYPE, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
687 |
vdcInstance->numAnnexNScalabilityLayers, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
688 |
&sei, |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
689 |
bitErrorIndication); |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
690 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
691 |
if (vdxStatus < 0) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
692 |
return DPH_ERR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
693 |
else if (vdxStatus == VDX_OK_BUT_BIT_ERROR) |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
694 |
return DPH_OK_BUT_BIT_ERROR; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
695 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
696 |
|
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
697 |
return DPH_OK; |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
698 |
} |
951a5db380a0
Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
699 |
// End of File |