1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 /**
19 This file contains declarations of internal functions for common encoder/decoder library.
20 @publishedAll
21 */
22 #ifndef AVCCOMMON_LIB_H_INCLUDED
23 #define AVCCOMMON_LIB_H_INCLUDED
24 
25 #include <stdlib.h>
26 
27 #ifndef AVCINT_COMMON_H_INCLUDED
28 #include "avcint_common.h"
29 #endif
30 
31 /*----------- deblock.c --------------*/
32 /**
33 This function performs conditional deblocking on a complete picture.
34 \param "video"  "Pointer to AVCCommonObj."
35 \return "AVC_SUCCESS for success and AVC_FAIL otherwise."
36 */
37 OSCL_IMPORT_REF AVCStatus DeblockPicture(AVCCommonObj *video);
38 
39 /**
40 This function performs MB-based deblocking when MB_BASED_DEBLOCK
41 is defined at compile time.
42 \param "video"  "Pointer to AVCCommonObj."
43 \return "AVC_SUCCESS for success and AVC_FAIL otherwise."
44 */
45 void MBInLoopDeblock(AVCCommonObj *video);
46 
47 
48 /*---------- dpb.c --------------------*/
49 /**
50 This function is called everytime a new sequence is detected.
51 \param "avcHandle"  "Pointer to AVCHandle."
52 \param "video" "Pointer to AVCCommonObj."
53 \param "padding"    "Flag specifying whether padding in luma component is needed (used for encoding)."
54 \return "AVC_SUCCESS or AVC_FAIL."
55 */
56 OSCL_IMPORT_REF AVCStatus AVCConfigureSequence(AVCHandle *avcHandle, AVCCommonObj *video, bool padding);
57 
58 /**
59 This function allocates and initializes the decoded picture buffer structure based on
60 the profile and level for the first sequence parameter set. Currently,
61 it does not allow changing in profile/level for subsequent SPS.
62 \param "avcHandle"  "Pointer to AVCHandle."
63 \param "video" "Pointer to AVCCommonObj."
64 \param "FrameHeightInMbs"   "Height of the frame in the unit of MBs."
65 \param "PicWidthInMbs"  "Width of the picture in the unit of MBs."
66 \param "padding"    "Flag specifying whether padding in luma component is needed (used for encoding)."
67 \return "AVC_SUCCESS or AVC_FAIL."
68 */
69 AVCStatus InitDPB(AVCHandle *avcHandle, AVCCommonObj *video, int FrameHeightInMbs, int PicWidthInMbs, bool padding);
70 
71 /**
72 This function frees the DPB memory.
73 \param "avcHandle"  "Pointer to AVCHandle."
74 \param "video" "Pointer to AVCCommonObj."
75 \return "AVC_SUCCESS or AVC_FAIL."
76 */
77 OSCL_IMPORT_REF AVCStatus CleanUpDPB(AVCHandle *avcHandle, AVCCommonObj *video);
78 
79 /**
80 This function finds empty frame in the decoded picture buffer to be used for the
81 current picture, initializes the corresponding picture structure with Sl, Scb, Scr,
82 width, height and pitch.
83 \param "avcHandle" "Pointer to the main handle object."
84 \param "video"  "Pointer to AVCCommonObj."
85 \return "AVC_SUCCESS or AVC_FAIL."
86 */
87 OSCL_IMPORT_REF AVCStatus DPBInitBuffer(AVCHandle *avcHandle, AVCCommonObj *video);
88 /**
89 This function finds empty frame in the decoded picture buffer to be used for the
90 current picture, initializes the corresponding picture structure with Sl, Scb, Scr,
91 width, height and pitch.
92 \param "video"  "Pointer to AVCCommonObj."
93 \param "CurrPicNum" "Current picture number (only used in decoder)."
94 \return "AVC_SUCCESS or AVC_FAIL."
95 */
96 
97 OSCL_IMPORT_REF void DPBInitPic(AVCCommonObj *video, int CurrPicNum);
98 
99 /**
100 This function releases the current frame back to the available pool for skipped frame after encoding.
101 \param "avcHandle" "Pointer to the main handle object."
102 \param "video" "Pointer to the AVCCommonObj."
103 \return "void."
104 */
105 OSCL_IMPORT_REF void DPBReleaseCurrentFrame(AVCHandle *avcHandle, AVCCommonObj *video);
106 
107 /**
108 This function performs decoded reference picture marking process and store the current picture to the
109 corresponding frame storage in the decoded picture buffer.
110 \param "avcHandle" "Pointer to the main handle object."
111 \param "video" "Pointer to the AVCCommonObj."
112 \return "AVC_SUCCESS or AVC_FAIL."
113 */
114 OSCL_IMPORT_REF AVCStatus StorePictureInDPB(AVCHandle *avcHandle, AVCCommonObj *video);
115 
116 /**
117 This function perform sliding window operation on the reference picture lists, see subclause 8.2.5.3.
118 It removes short-term ref frames with smallest FrameNumWrap from the reference list.
119 \param "avcHandle" "Pointer to the main handle object."
120 \param "video" "Pointer to the AVCCommonObj."
121 \param "dpb"  "Pointer to the AVCDecPicBuffer."
122 \return "AVC_SUCCESS or AVC_FAIL (contradicting values or scenario as in the Note in the draft)."
123 */
124 AVCStatus sliding_window_process(AVCHandle *avcHandle, AVCCommonObj *video, AVCDecPicBuffer *dpb);
125 
126 
127 /**
128 This function perform adaptive memory marking operation on the reference picture lists,
129 see subclause 8.2.5.4. It calls other functions for specific operations.
130 \param "video" "Pointer to the AVCCommonObj."
131 \param "dpb"  "Pointer to the AVCDecPicBuffer."
132 \param "sliceHdr"   "Pointer to the AVCSliceHeader."
133 \return "AVC_SUCCESS or AVC_FAIL (contradicting values or scenario as in the Note in the draft)."
134 */
135 AVCStatus adaptive_memory_marking(AVCHandle *avcHandle, AVCCommonObj *video, AVCDecPicBuffer *dpb, AVCSliceHeader *sliceHdr);
136 
137 /**
138 This function performs memory management control operation 1, marking a short-term picture
139 as unused for reference. See subclause 8.2.5.4.1.
140 \param "video" "Pointer to the AVCCommonObj."
141 \param "dpb"  "Pointer to the AVCDecPicBuffer."
142 \param "difference_of_pic_nums_minus1"  "From the syntax in dec_ref_pic_marking()."
143 */
144 void MemMgrCtrlOp1(AVCHandle *avcHandle, AVCCommonObj *video, AVCDecPicBuffer *dpb, int difference_of_pic_nums_minus1);
145 
146 /**
147 This function performs memory management control operation 2, marking a long-term picture
148 as unused for reference. See subclause 8.2.5.4.2.
149 \param "dpb"  "Pointer to the AVCDecPicBuffer."
150 \param "field_pic_flag"  "Flag whether the current picture is field or not."
151 \param "long_term_pic_num"  "From the syntax in dec_ref_pic_marking()."
152 */
153 void MemMgrCtrlOp2(AVCHandle *avcHandle, AVCDecPicBuffer *dpb, int long_term_pic_num);
154 
155 /**
156 This function performs memory management control operation 3, assigning a LongTermFrameIdx to
157 a short-term reference picture. See subclause 8.2.5.4.3.
158 \param "video" "Pointer to the AVCCommonObj."
159 \param "dpb"  "Pointer to the AVCDecPicBuffer."
160 \param "difference_of_pic_nums_minus1"  "From the syntax in dec_ref_pic_marking()."
161 \param "long_term_pic_num"  "From the syntax in dec_ref_pic_marking()."
162 */
163 void MemMgrCtrlOp3(AVCHandle *avcHandle, AVCCommonObj *video, AVCDecPicBuffer *dpb, uint difference_of_pic_nums_minus1,
164                    uint long_term_frame_idx);
165 
166 /**
167 This function performs memory management control operation 4, getting new MaxLongTermFrameIdx.
168  See subclause 8.2.5.4.4.
169 \param "video" "Pointer to the AVCCommonObj."
170 \param "dpb"  "Pointer to the AVCDecPicBuffer."
171 \param "max_long_term_frame_idx_plus1"  "From the syntax in dec_ref_pic_marking()."
172 */
173 void MemMgrCtrlOp4(AVCHandle *avcHandle, AVCCommonObj *video, AVCDecPicBuffer *dpb, uint max_long_term_frame_idx_plus1);
174 
175 /**
176 This function performs memory management control operation 5, marking all reference pictures
177 as unused for reference and set MaxLongTermFrameIdx to no long-termframe indices.
178  See subclause 8.2.5.4.5.
179 \param "video" "Pointer to the AVCCommonObj."
180 \param "dpb"  "Pointer to the AVCDecPicBuffer."
181 */
182 void MemMgrCtrlOp5(AVCHandle *avcHandle, AVCCommonObj *video, AVCDecPicBuffer *dpb);
183 
184 /**
185 This function performs memory management control operation 6, assigning a long-term frame index
186 to the current picture. See subclause 8.2.5.4.6.
187 \param "video" "Pointer to the AVCCommonObj."
188 \param "dpb"  "Pointer to the AVCDecPicBuffer."
189 \param "long_term_frame_idx"  "From the syntax in dec_ref_pic_marking()."
190 */
191 void MemMgrCtrlOp6(AVCHandle *avcHandle, AVCCommonObj *video, AVCDecPicBuffer *dpb, uint long_term_frame_idx);
192 
193 /**
194 This function mark a long-term ref frame with a specific frame index as unused for reference.
195 \param "dpb"  "Pointer to the AVCDecPicBuffer."
196 \param "long_term_frame_idx"  "To look for"
197 */
198 void unmark_long_term_frame_for_reference_by_frame_idx(AVCHandle *avcHandle, AVCDecPicBuffer *dpb, uint long_term_frame_idx);
199 
200 /**
201 This function mark a long-term ref field with a specific frame index as unused for reference except
202 a frame that contains a picture with picNumX.
203 \param "dpb"  "Pointer to the AVCDecPicBuffer."
204 \param "long_term_frame_idx"  "To look for."
205 \param "picNumX"    "To look for."
206 */
207 void unmark_long_term_field_for_reference_by_frame_idx(AVCCommonObj *video, AVCDecPicBuffer *dpb, uint long_term_frame_indx, int picNumX);
208 
209 /**
210 This function mark a frame to unused for reference.
211 \param "fs" "Pointer to AVCFrameStore to be unmarked."
212 */
213 void unmark_for_reference(AVCHandle *avcHandle, AVCDecPicBuffer *dpb, uint idx);
214 
215 void update_ref_list(AVCDecPicBuffer *dpb);
216 
217 
218 /*---------- fmo.c --------------*/
219 /**
220 This function initializes flexible macroblock reordering.
221 \param "video"  "Pointer to AVCCommonObj."
222 \return "AVC_SUCCESS for success and AVC_FAIL otherwise."
223 */
224 OSCL_IMPORT_REF AVCStatus FMOInit(AVCCommonObj *video);
225 
226 /**
227 This function fills up an array that maps Map unit to the slice group
228 following the interleaved slice group map type.
229 \param "mapUnitToSliceGroupMap" "Array of slice group mapping."
230 \param "run_length_minus1"  "Array of the run-length."
231 \param "num_slice_groups_minus_1"   "Number of slice group minus 1."
232 \param "PicSizeInMapUnit"   "Size of the picture in number Map units."
233 \return "Void."
234 */
235 void FmoGenerateType0MapUnitMap(int *mapUnitToSliceGroupMap, uint *run_length_minus1, uint num_slice_groups_minus1, uint PicSizeInMapUnits);
236 
237 /**
238 This function fills up an array that maps Map unit to the slice group
239 following the dispersed slice group map type.
240 \param "mapUnitToSliceGroupMap" "Array of slice group mapping."
241 \param "PicWidthInMbs"  "Width of the luma picture in macroblock unit."
242 \param "num_slice_groups_minus_1"   "Number of slice group minus 1."
243 \param "PicSizeInMapUnit"   "Size of the picture in number Map units."
244 \return "Void."
245 */
246 void FmoGenerateType1MapUnitMap(int *mapUnitToSliceGroupMap, int PicWidthInMbs, uint num_slice_groups_minus1, uint PicSizeInMapUnits);
247 
248 /**
249 This function fills up an array that maps Map unit to the slice group
250 following the foreground with left-over slice group map type.
251 \param "pps"    "Pointer to AVCPicParamSets structure."
252 \param "mapUnitToSliceGroupMap" "Array of slice group mapping."
253 \param "PicWidthInMbs"  "Width of the luma picture in macroblock unit."
254 \param "num_slice_groups_minus_1"   "Number of slice group minus 1."
255 \param "PicSizeInMapUnit"   "Size of the picture in number Map units."
256 \return "Void."
257 */
258 void FmoGenerateType2MapUnitMap(AVCPicParamSet *pps, int *mapUnitToSliceGroupMap, int PicWidthInMbs,
259                                 uint num_slice_groups_minus1, uint PicSizeInMapUnits);
260 
261 /**
262 This function fills up an array that maps Map unit to the slice group
263 following the box-out slice group map type.
264 \param "pps"    "Pointer to AVCPicParamSets structure."
265 \param "mapUnitToSliceGroupMap" "Array of slice group mapping."
266 \param "PicWidthInMbs"  "Width of the luma picture in macroblock unit."
267 \return "Void."
268 */
269 void FmoGenerateType3MapUnitMap(AVCCommonObj *video, AVCPicParamSet* pps, int *mapUnitToSliceGroupMap,
270                                 int PicWidthInMbs);
271 
272 /**
273 This function fills up an array that maps Map unit to the slice group
274 following the raster scan slice group map type.
275 \param "mapUnitToSliceGroupMap" "Array of slice group mapping."
276 \param "MapUnitsInSliceGroup0"  "Derived in subclause 7.4.3."
277 \param "slice_group_change_direction_flag"  "A value from the slice header."
278 \param "PicSizeInMapUnit"   "Size of the picture in number Map units."
279 \return "void"
280 */
281 void FmoGenerateType4MapUnitMap(int *mapUnitToSliceGroupMap, int MapUnitsInSliceGroup0,
282                                 int slice_group_change_direction_flag, uint PicSizeInMapUnits);
283 
284 /**
285 This function fills up an array that maps Map unit to the slice group
286 following wipe slice group map type.
287 \param "mapUnitToSliceGroupMap" "Array of slice group mapping."
288 \param "video"  "Pointer to AVCCommonObj structure."
289 \param "slice_group_change_direction_flag"  "A value from the slice header."
290 \param "PicSizeInMapUnit"   "Size of the picture in number Map units."
291 \return "void"
292 */
293 void FmoGenerateType5MapUnitMap(int *mapUnitsToSliceGroupMap, AVCCommonObj *video,
294                                 int slice_group_change_direction_flag, uint PicSizeInMapUnits);
295 
296 /**
297 This function fills up an array that maps Map unit to the slice group
298 following wipe slice group map type.
299 \param "mapUnitToSliceGroupMap" "Array of slice group mapping."
300 \param "slice_group_id" "Array of slice_group_id from AVCPicParamSet structure."
301 \param "PicSizeInMapUnit"   "Size of the picture in number Map units."
302 \return "void"
303 */
304 void FmoGenerateType6MapUnitMap(int *mapUnitsToSliceGroupMap, int *slice_group_id, uint PicSizeInMapUnits);
305 
306 /*------------- itrans.c --------------*/
307 /**
308 This function performs transformation of the Intra16x16DC value according to
309 subclause 8.5.6.
310 \param "block"  "Pointer to the video->block[0][0][0]."
311 \param "QPy"    "Quantization parameter."
312 \return "void."
313 */
314 void Intra16DCTrans(int16 *block, int Qq, int Rq);
315 
316 /**
317 This function performs transformation of a 4x4 block according to
318 subclause 8.5.8.
319 \param "block"  "Pointer to the origin of transform coefficient area."
320 \param "pred"   "Pointer to the origin of predicted area."
321 \param "cur"    "Pointer to the origin of the output area."
322 \param "width"  "Pitch of cur."
323 \return "void."
324 */
325 void itrans(int16 *block, uint8 *pred, uint8 *cur, int width);
326 
327 /*
328 This function is the same one as itrans except for chroma.
329 \param "block"  "Pointer to the origin of transform coefficient area."
330 \param "pred"   "Pointer to the origin of predicted area."
331 \param "cur"    "Pointer to the origin of the output area."
332 \param "width"  "Pitch of cur."
333 \return "void."
334 */
335 void ictrans(int16 *block, uint8 *pred, uint8 *cur, int width);
336 
337 /**
338 This function performs transformation of the DCChroma value according to
339 subclause 8.5.7.
340 \param "block"  "Pointer to the video->block[0][0][0]."
341 \param "QPc"    "Quantization parameter."
342 \return "void."
343 */
344 void ChromaDCTrans(int16 *block, int Qq, int Rq);
345 
346 /**
347 This function copies a block from pred to cur.
348 \param "pred"   "Pointer to prediction block."
349 \param "cur"    "Pointer to the current YUV block."
350 \param "width"  "Pitch of cur memory."
351 \param "pred_pitch" "Pitch for pred memory.
352 \return "void."
353 */
354 void copy_block(uint8 *pred, uint8 *cur, int width, int pred_pitch);
355 
356 /*--------- mb_access.c ----------------*/
357 /**
358 This function initializes the neighboring information before start macroblock decoding.
359 \param "video"  "Pointer to AVCCommonObj."
360 \param "mbNum"  "The current macroblock index."
361 \param "currMB" "Pointer to the current AVCMacroblock structure."
362 \return "void"
363 */
364 OSCL_IMPORT_REF void InitNeighborAvailability(AVCCommonObj *video, int mbNum);
365 
366 /**
367 This function checks whether the requested neighboring macroblock is available.
368 \param "MbToSliceGroupMap"  "Array containing the slice group ID mapping to MB index."
369 \param "PicSizeInMbs"   "Size of the picture in number of MBs."
370 \param "mbAddr"     "Neighboring macroblock index to check."
371 \param "currMbAddr" "Current macroblock index."
372 \return "TRUE if the neighboring MB is available, FALSE otherwise."
373 */
374 bool mb_is_available(AVCMacroblock *mblock, uint PicSizeInMbs, int mbAddr, int currMbAddr);
375 
376 /**
377 This function performs prediction of the nonzero coefficient for a luma block (i,j).
378 \param "video"  "Pointer to AVCCommonObj."
379 \param "i"  "Block index, horizontal."
380 \param "j"  "Block index, vertical."
381 \return "Predicted number of nonzero coefficient."
382 */
383 OSCL_IMPORT_REF int predict_nnz(AVCCommonObj *video, int i, int j);
384 
385 /**
386 This function performs prediction of the nonzero coefficient for a chroma block (i,j).
387 \param "video"  "Pointer to AVCCommonObj."
388 \param "i"  "Block index, horizontal."
389 \param "j"  "Block index, vertical."
390 \return "Predicted number of nonzero coefficient."
391 */
392 OSCL_IMPORT_REF int predict_nnz_chroma(AVCCommonObj *video, int i, int j);
393 
394 /**
395 This function calculates the predicted motion vectors for the current macroblock.
396 \param "video" "Pointer to AVCCommonObj."
397 \param "encFlag"    "Boolean whether this function is used by encoder or decoder."
398 \return "void."
399 */
400 OSCL_IMPORT_REF void GetMotionVectorPredictor(AVCCommonObj *video, int encFlag);
401 
402 /*---------- reflist.c -----------------*/
403 /**
404 This function initializes reference picture list used in INTER prediction
405 at the beginning of each slice decoding. See subclause 8.2.4.
406 \param "video"  "Pointer to AVCCommonObj."
407 \return "void"
408 Output is video->RefPicList0, video->RefPicList1, video->refList0Size and video->refList1Size.
409 */
410 OSCL_IMPORT_REF void RefListInit(AVCCommonObj *video);
411 
412 /**
413 This function generates picture list from frame list. Used when current picture is field.
414 see subclause 8.2.4.2.5.
415 \param "video"  "Pointer to AVCCommonObj."
416 \param "IsL1"   "Is L1 list?"
417 \param "long_term"  "Is long-term prediction?"
418 \return "void"
419 */
420 void    GenPicListFromFrameList(AVCCommonObj *video, int IsL1, int long_term);
421 
422 /**
423 This function performs reference picture list reordering according to the
424 ref_pic_list_reordering() syntax. See subclause 8.2.4.3.
425 \param "video"  "Pointer to AVCCommonObj."
426 \return "AVC_SUCCESS or AVC_FAIL"
427 Output is video->RefPicList0, video->RefPicList1, video->refList0Size and video->refList1Size.
428 */
429 OSCL_IMPORT_REF AVCStatus ReOrderList(AVCCommonObj *video);
430 
431 /**
432 This function performs reference picture list reordering according to the
433 ref_pic_list_reordering() syntax regardless of list 0 or list 1. See subclause 8.2.4.3.
434 \param "video"  "Pointer to AVCCommonObj."
435 \param "isL1"   "Is list 1 or not."
436 \return "AVC_SUCCESS or AVC_FAIL"
437 Output is video->RefPicList0 and video->refList0Size or video->RefPicList1 and video->refList1Size.
438 */
439 AVCStatus ReorderRefPicList(AVCCommonObj *video, int isL1);
440 
441 /**
442 This function performs reordering process of reference picture list for short-term pictures.
443 See subclause 8.2.4.3.1.
444 \param "video"  "Pointer to AVCCommonObj."
445 \param "picNumLX"   "picNumLX of an entry in the reference list."
446 \param "refIdxLX"   "Pointer to the current entry index in the reference."
447 \param "isL1"       "Is list 1 or not."
448 \return "AVC_SUCCESS or AVC_FAIL"
449 */
450 AVCStatus ReorderShortTerm(AVCCommonObj *video, int picNumLX, int *refIdxLX, int isL1);
451 
452 /**
453 This function performs reordering process of reference picture list for long-term pictures.
454 See subclause 8.2.4.3.2.
455 \param "video"  "Pointer to AVCCommonObj."
456 \param "LongTermPicNum" "LongTermPicNum of an entry in the reference list."
457 \param "refIdxLX"   "Pointer to the current entry index in the reference."
458 \param "isL1"       "Is list 1 or not."
459 \return "AVC_SUCCESS or AVC_FAIL"
460 */
461 AVCStatus ReorderLongTerm(AVCCommonObj *video, int LongTermPicNum, int *refIdxLX, int isL1);
462 
463 /**
464 This function gets the pictures in DPB according to the PicNum.
465 \param "video"  "Pointer to AVCCommonObj."
466 \param "picNum" "PicNum of the picture we are looking for."
467 \return "Pointer to the AVCPictureData or NULL if not found"
468 */
469 AVCPictureData*  GetShortTermPic(AVCCommonObj *video, int picNum);
470 
471 /**
472 This function gets the pictures in DPB according to the LongtermPicNum.
473 \param "video"  "Pointer to AVCCommonObj."
474 \param "LongtermPicNum" "LongtermPicNum of the picture we are looking for."
475 \return "Pointer to the AVCPictureData."
476 */
477 AVCPictureData*  GetLongTermPic(AVCCommonObj *video, int LongtermPicNum);
478 
479 /**
480 This function indicates whether the picture is used for short-term reference or not.
481 \param "s"  "Pointer to AVCPictureData."
482 \return "1 if it is used for short-term, 0 otherwise."
483 */
484 int is_short_ref(AVCPictureData *s);
485 
486 /**
487 This function indicates whether the picture is used for long-term reference or not.
488 \param "s"  "Pointer to AVCPictureData."
489 \return "1 if it is used for long-term, 0 otherwise."
490 */
491 int is_long_ref(AVCPictureData *s);
492 
493 /**
494 This function sorts array of pointers to AVCPictureData in descending order of
495 the PicNum value.
496 \param "data"   "Array of pointers to AVCPictureData."
497 \param "num"    "Size of the array."
498 \return "void"
499 */
500 void SortPicByPicNum(AVCPictureData *data[], int num);
501 
502 /**
503 This function sorts array of pointers to AVCPictureData in ascending order of
504 the PicNum value.
505 \param "data"   "Array of pointers to AVCPictureData."
506 \param "num"    "Size of the array."
507 \return "void"
508 */
509 void SortPicByPicNumLongTerm(AVCPictureData *data[], int num);
510 
511 /**
512 This function sorts array of pointers to AVCFrameStore in descending order of
513 the FrameNumWrap value.
514 \param "data"   "Array of pointers to AVCFrameStore."
515 \param "num"    "Size of the array."
516 \return "void"
517 */
518 void SortFrameByFrameNumWrap(AVCFrameStore *data[], int num);
519 
520 /**
521 This function sorts array of pointers to AVCFrameStore in ascending order of
522 the LongTermFrameIdx value.
523 \param "data"   "Array of pointers to AVCFrameStore."
524 \param "num"    "Size of the array."
525 \return "void"
526 */
527 void SortFrameByLTFrameIdx(AVCFrameStore *data[], int num);
528 
529 /**
530 This function sorts array of pointers to AVCPictureData in descending order of
531 the PicOrderCnt value.
532 \param "data"   "Array of pointers to AVCPictureData."
533 \param "num"    "Size of the array."
534 \return "void"
535 */
536 void SortPicByPOC(AVCPictureData *data[], int num, int descending);
537 
538 /**
539 This function sorts array of pointers to AVCPictureData in ascending order of
540 the LongTermPicNum value.
541 \param "data"   "Array of pointers to AVCPictureData."
542 \param "num"    "Size of the array."
543 \return "void"
544 */
545 void SortPicByLTPicNum(AVCPictureData *data[], int num);
546 
547 /**
548 This function sorts array of pointers to AVCFrameStore in descending order of
549 the PicOrderCnt value.
550 \param "data"   "Array of pointers to AVCFrameStore."
551 \param "num"    "Size of the array."
552 \return "void"
553 */
554 void SortFrameByPOC(AVCFrameStore *data[], int num, int descending);
555 
556 
557 #endif /* _AVCCOMMON_LIB_H_ */
558