-
Notifications
You must be signed in to change notification settings - Fork 125
/
fbm.c
executable file
·706 lines (584 loc) · 19.2 KB
/
fbm.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
/*
* Cedarx framework.
* Copyright (c) 2008-2015 Allwinner Technology Co. Ltd.
* Copyright (c) 2014 BZ Chen <bzchen@allwinnertech.com>
*
* This file is part of Cedarx.
*
* Cedarx is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
//#define CONFIG_LOG_LEVEL OPTION_LOG_LEVEL_DETAIL
#define LOG_TAG "fbm.c"
#include <unistd.h>
#include <stdlib.h>
#include <memory.h>
#include "fbm.h"
#include "adapter.h"
#include "log.h"
#define SUPPORT_REQUEST_MEMORY_DYNAMIC 0
extern const char* strPixelFormat[];
static void FbmEnqueue(FrameNode** ppHead, FrameNode* p)
{
FrameNode* pCur;
pCur = *ppHead;
if(pCur == NULL)
{
*ppHead = p;
p->pNext = NULL;
return;
}
else
{
while(pCur->pNext != NULL)
pCur = pCur->pNext;
pCur->pNext = p;
p->pNext = NULL;
return;
}
}
#if 0
static void FbmEnqueueToHead(FrameNode ** ppHead, FrameNode* p)
{
FrameNode* pCur;
pCur = *ppHead;
*ppHead = p;
p->pNext = pCur;
return;
}
#endif
static FrameNode* FbmDequeue(FrameNode** ppHead)
{
FrameNode* pHead;
pHead = *ppHead;
if(pHead == NULL)
return NULL;
else
{
*ppHead = pHead->pNext;
pHead->pNext = NULL;
return pHead;
}
}
Fbm* FbmCreate(FbmCreateInfo* pFbmCreateInfo)
{
Fbm* p;
int i;
FrameNode* pFrameNode;
int nCreateFrameBuNum = 0;
int nAlignStride = 0;
FbmBufInfo fbmBufferInfo;
int nFrameNum = pFbmCreateInfo->nFrameNum;
int nWidth = pFbmCreateInfo->nWidth;
int nHeight = pFbmCreateInfo->nHeight;
int ePixelFormat = pFbmCreateInfo->ePixelFormat;
int nBufferType = pFbmCreateInfo->nBufferType;
int bProgressiveFlag = pFbmCreateInfo->bProgressiveFlag;
p = (Fbm*)malloc(sizeof(Fbm));
if(p == NULL)
{
loge("memory alloc fail.");
return NULL;
}
memset(p, 0, sizeof(Fbm));
//* allocate frame nodes.
pFrameNode = (FrameNode*)malloc(nFrameNum*sizeof(FrameNode));
if(pFrameNode == NULL)
{
loge("memory alloc fail, alloc %d bytes.", nFrameNum*sizeof(FrameNode));
free(p);
return NULL;
}
memset(pFrameNode, 0, sizeof(nFrameNum*sizeof(FrameNode)));
pthread_mutex_init(&p->mutex, NULL);
p->nMaxFrameNum = nFrameNum;
p->pEmptyBufferQueue = NULL;
p->pValidPictureQueue = NULL;
p->pFrames = pFrameNode;
nCreateFrameBuNum = nFrameNum;
for(i=0; i<nFrameNum; i++)
{
memset((void*)(&pFrameNode->vpicture), 0, sizeof(VideoPicture));
pFrameNode->bUsedByDecoder = 0;
pFrameNode->bUsedByRender = 0;
pFrameNode->bInValidPictureQueue = 0;
pFrameNode->bAlreadyDisplayed = 0;
pFrameNode->pNext = NULL;
pFrameNode->vpicture.nID = i;
pFrameNode->vpicture.ePixelFormat = ePixelFormat;
pFrameNode->vpicture.nWidth = nWidth;
pFrameNode->vpicture.nHeight = nHeight;
pFrameNode->vpicture.nLineStride = pFrameNode->vpicture.nWidth;
pFrameNode->vpicture.bIsProgressive = 1;
pFrameNode->vpicture.nLeftOffset = 0;
pFrameNode->vpicture.nTopOffset = 0;
pFrameNode->vpicture.nRightOffset = nWidth;
pFrameNode->vpicture.nBottomOffset = nHeight;
if(FbmAllocatePictureBuffer(&pFrameNode->vpicture, &nAlignStride, nWidth, nHeight) != 0)
break;
pFrameNode++;
}
p->nAlignValue = nAlignStride;
fbmBufferInfo.nAlignValue = nAlignStride;
//* check whether all picture buffer allocated.
if(i < nFrameNum)
{
//* not all picture buffer allocated, abort the Fbm creating.
int j;
loge("memory alloc fail, only %d frames allocated, we need %d frames.", i, nFrameNum);
for(j = 0; j < i; j++)
FbmFreePictureBuffer(&p->pFrames[j].vpicture);
pthread_mutex_destroy(&p->mutex);
free(p->pFrames);
free(p);
return NULL;
}
//* put all frame to the empty frame queue.
for(i=0; i<nFrameNum; i++)
{
pFrameNode = &p->pFrames[i];
FbmEnqueue(&p->pEmptyBufferQueue, pFrameNode);
}
p->nEmptyBufferNum = nFrameNum;
return p;
}
void FbmDestroy(Fbm* pFbm)
{
logv("FbmDestroy");
int i = 0;
pthread_mutex_destroy(&pFbm->mutex);
for(i=0; i<pFbm->nMaxFrameNum; i++)
FbmFreePictureBuffer(&pFbm->pFrames[i].vpicture);
free(pFbm->pFrames);
free(pFbm);
return;
}
VideoPicture* FbmRequestBuffer(Fbm* pFbm)
{
FrameNode* pFrameNode;
VideoPicture fbmPicBufInfo;
int ret = 0;
logi("FbmRequestBuffer");
pFrameNode = NULL;
memset(&fbmPicBufInfo, 0 , sizeof(VideoPicture));
pthread_mutex_lock(&pFbm->mutex);
pFrameNode = FbmDequeue(&pFbm->pEmptyBufferQueue);
if(pFrameNode != NULL)
{
//* check the picture status.
if(pFrameNode->bUsedByDecoder ||
pFrameNode->bInValidPictureQueue ||
pFrameNode->bUsedByRender ||
pFrameNode->bAlreadyDisplayed)
{
//* the picture is in the pEmptyBufferQueue, these four flags
//* shouldn't be set.
loge("invalid frame status, a picture is just pick out from the pEmptyBufferQueue, \
but bUsedByDecoder=%d, bInValidPictureQueue=%d, bUsedByRender=%d,\
bAlreadyDisplayed=%d.",
pFrameNode->bUsedByDecoder, pFrameNode->bInValidPictureQueue,
pFrameNode->bUsedByRender, pFrameNode->bAlreadyDisplayed);
abort();
}
pFbm->nEmptyBufferNum--;
pFrameNode->bUsedByDecoder = 1;
}
pthread_mutex_unlock(&pFbm->mutex);
return (pFrameNode==NULL)? NULL: &pFrameNode->vpicture;
}
void FbmReturnBuffer(Fbm* pFbm, VideoPicture* pVPicture, int bValidPicture)
{
int index;
FrameNode* pFrameNode;
VideoPicture fbmPicBufInfo;
int bNeedDispBuffer = 0;
int bNeedReturnBuffer = 0;
logv("FbmReturnBuffer pVPicture=%p, bValidPicture=%d", pVPicture, bValidPicture);
index = pVPicture->nID;
//* check the index is valid.
if(index < 0 || index >= pFbm->nMaxFrameNum)
{
logd("FbmReturnBuffer: the picture id is invalid, pVPicture=%p, pVPicture->nID=%d",
pVPicture, pVPicture->nID);
return;
}
else
{
if(pVPicture != &pFbm->pFrames[index].vpicture)
{
logd("FbmReturnBuffer: the picture id is invalid, pVPicture=%p, pVPicture->nID=%d",
pVPicture, pVPicture->nID);
return;
}
}
pFrameNode = &pFbm->pFrames[index];
pthread_mutex_lock(&pFbm->mutex);
if(pFrameNode->bUsedByDecoder == 0)
{
loge("invalid picture status, bUsedByDecoder=0 when picture buffer is returned.");
abort();
}
pFrameNode->bUsedByDecoder = 0;
if(pFrameNode->bInValidPictureQueue)
{
//* picture is in pValidPictureQueue, it was shared before.
//* check status.
if(pFrameNode->bUsedByRender || pFrameNode->bAlreadyDisplayed)
{
loge("invalid frame status, a picture in pValidPictureQueue, \
but bUsedByRender=%d and bAlreadyDisplayed=%d",
pFrameNode->bUsedByRender, pFrameNode->bAlreadyDisplayed);
abort();
}
}
else
{
//* picture not in pValidPictureQueue.
if(pFrameNode->bUsedByRender == 0)
{
//* picture not used by render.
if(pFrameNode->bAlreadyDisplayed == 0)
{
//* picture not been displayed yet.
if(bValidPicture)
{
FbmEnqueue(&pFbm->pValidPictureQueue, pFrameNode);
pFbm->nValidPictureNum++;
pFrameNode->bInValidPictureQueue = 1;
}
else
{
FbmEnqueue(&pFbm->pEmptyBufferQueue, pFrameNode);
pFbm->nEmptyBufferNum++;
}
}
else
{
//* picture had been shared before and had been displayed,
//* put it to pEmptyBufferQueue.
pFrameNode->bAlreadyDisplayed = 0;
FbmEnqueue(&pFbm->pEmptyBufferQueue, pFrameNode);
pFbm->nEmptyBufferNum++;
}
}
}
pthread_mutex_unlock(&pFbm->mutex);
return;
}
void FbmShareBuffer(Fbm* pFbm, VideoPicture* pVPicture)
{
int index;
FrameNode* pFrameNode;
VideoPicture* pDispVPicture = NULL;
VideoPicture fbmPicBufInfo;
int bNeedDispBuffer = 0;
logv("FbmShareBuffer pVPicture=%p", pVPicture);
index = pVPicture->nID;
//* check the index is valid.
if(index < 0 || index >= pFbm->nMaxFrameNum)
{
logd("FbmShareBuffer: the picture id is invalid, pVPicture=%p, pVPicture->nID=%d",
pVPicture, pVPicture->nID);
return;
}
else
{
if(pVPicture != &pFbm->pFrames[index].vpicture)
{
logw("FbmShareBuffer: the picture id is invalid, pVPicture=%p, pVPicture->nID=%d",
pVPicture, pVPicture->nID);
return;
}
}
pFrameNode = &pFbm->pFrames[index];
pthread_mutex_lock(&pFbm->mutex);
//* check status.
if(pFrameNode->bUsedByDecoder == 0 ||
pFrameNode->bInValidPictureQueue == 1 ||
pFrameNode->bAlreadyDisplayed == 1)
{
loge("invalid frame status, a picture is shared but bUsedByDecoder=%d, \
bInValidPictureQueue=%d, bUsedByDecoder=%d, bAlreadyDisplayed=%d.",
pFrameNode->bUsedByDecoder, pFrameNode->bInValidPictureQueue,
pFrameNode->bUsedByDecoder, pFrameNode->bAlreadyDisplayed);
abort();
}
//* put the picture to pValidPictureQueue.
pFrameNode->bInValidPictureQueue = 1;
FbmEnqueue(&pFbm->pValidPictureQueue, pFrameNode);
pFbm->nValidPictureNum++;
pthread_mutex_unlock(&pFbm->mutex);
return;
}
VideoPicture* FbmRequestPicture(Fbm* pFbm)
{
VideoPicture* pVPicture;
FrameNode* pFrameNode;
pthread_mutex_lock(&pFbm->mutex);
// logi("FbmRequestPicture");
pVPicture = NULL;
pFrameNode = FbmDequeue(&pFbm->pValidPictureQueue);
if(pFrameNode != NULL)
{
if(pFrameNode->bInValidPictureQueue == 0 ||
pFrameNode->bUsedByRender == 1 ||
pFrameNode->bAlreadyDisplayed == 1)
{
//* the picture is in the pValidPictureQueue, one of these three flags is invalid.
loge("invalid frame status, a picture is just pick out from the pValidPictureQueue, \
but bInValidPictureQueue=%d, bUsedByRender=%d, bAlreadyDisplayed=%d.",
pFrameNode->bInValidPictureQueue,
pFrameNode->bUsedByRender,
pFrameNode->bAlreadyDisplayed);
abort();
}
pFbm->nValidPictureNum--;
pFrameNode->bInValidPictureQueue = 0;
pVPicture = &pFrameNode->vpicture;
pFrameNode->bUsedByRender = 1;
}
pthread_mutex_unlock(&pFbm->mutex);
return (pFrameNode==NULL)? NULL: pVPicture;
}
int FbmReturnPicture(Fbm* pFbm, VideoPicture* pVPicture)
{
int index;
FrameNode* pFrameNode;
// logi("FbmReturnPicture pVPicture=%p", pVPicture);
index = pVPicture->nID;
//* check the index is valid.
if(index < 0 || index >= pFbm->nMaxFrameNum)
{
logw("FbmReturnPicture: the picture id is invalid, pVPicture=%p, pVPicture->nID=%d",
pVPicture, pVPicture->nID);
return -1;
}
else
{
if(pVPicture != &pFbm->pFrames[index].vpicture)
{
logw("FbmReturnPicture: the picture id is invalid, pVPicture=%p, pVPicture->nID=%d",
pVPicture, pVPicture->nID);
return -1;
}
}
pFrameNode = &pFbm->pFrames[index];
pthread_mutex_lock(&pFbm->mutex);
if(pFrameNode->bUsedByRender == 0 ||
pFrameNode->bInValidPictureQueue == 1 ||
pFrameNode->bAlreadyDisplayed == 1)
{
//* the picture is being returned, but one of these three flags is invalid.
loge("invalid frame status, a picture being returned, \
but bUsedByRender=%d, bInValidPictureQueue=%d, bAlreadyDisplayed=%d.",
pFrameNode->bUsedByRender,
pFrameNode->bInValidPictureQueue,
pFrameNode->bAlreadyDisplayed);
abort();
}
pFrameNode->bUsedByRender = 0;
if(pFrameNode->bUsedByDecoder)
pFrameNode->bAlreadyDisplayed = 1;
else
{
FbmEnqueue(&pFbm->pEmptyBufferQueue, pFrameNode);
pFbm->nEmptyBufferNum++;
}
pthread_mutex_unlock(&pFbm->mutex);
return 0;
}
VideoPicture* FbmNextPictureInfo(Fbm* pFbm)
{
FrameNode* pFrameNode;
// logi("FbmNextPictureInfo");
if(pFbm == NULL)
{
return NULL;
}
if(pFbm->pValidPictureQueue != NULL)
{
pFrameNode = pFbm->pValidPictureQueue;
return &pFrameNode->vpicture;
}
else
return NULL;
}
void FbmFlush(Fbm* pFbm)
{
FrameNode* pFrameNode;
VideoPicture fbmPicBufInfo;
pthread_mutex_lock(&pFbm->mutex);
logv("FbmFlush");
while((pFrameNode = FbmDequeue(&pFbm->pValidPictureQueue)) != NULL)
{
pFbm->nValidPictureNum--;
//* check the picture status.
if(pFrameNode->bUsedByRender || pFrameNode->bAlreadyDisplayed)
{
//* the picture is in the pValidPictureQueue, these two flags
//* shouldn't be set.
loge("invalid frame status, a picture is just pick out from the pValidPictureQueue, \
but bUsedByRender=%d and bAlreadyDisplayed=%d.",
pFrameNode->bUsedByRender, pFrameNode->bAlreadyDisplayed);
abort();
}
pFrameNode->bInValidPictureQueue = 0;
if(pFrameNode->bUsedByDecoder == 0)
{
//* the picture is not used, put it into pEmptyBufferQueue.
FbmEnqueue(&pFbm->pEmptyBufferQueue, pFrameNode);
pFbm->nEmptyBufferNum++;
}
else
{
//* the picture was shared by the video engine,
//* set the bAlreadyDisplayed so the picture won't be put into
//* the pValidPictureQueue when it is returned by the video engine.
pFrameNode->bAlreadyDisplayed = 1;
}
}
pthread_mutex_unlock(&pFbm->mutex);
return;
}
int FbmGetAlignValue(Fbm* pFbm)
{
return 32;
}
int FbmGetBufferInfo(Fbm* pFbm, VideoPicture* pVPicture)
{
FrameNode* pFrameNode;
logi("FbmGetBufferInfo");
//* give the general information of the video pictures.
pFrameNode = &pFbm->pFrames[0];
pVPicture->ePixelFormat = pFrameNode->vpicture.ePixelFormat;
pVPicture->nWidth = pFrameNode->vpicture.nWidth;
pVPicture->nHeight = pFrameNode->vpicture.nHeight;
pVPicture->nLineStride = pFrameNode->vpicture.nLineStride;
pVPicture->nTopOffset = pFrameNode->vpicture.nTopOffset;
pVPicture->nLeftOffset = pFrameNode->vpicture.nLeftOffset;
pVPicture->nFrameRate = pFrameNode->vpicture.nFrameRate;
pVPicture->nAspectRatio = pFrameNode->vpicture.nAspectRatio;
pVPicture->bIsProgressive = pFrameNode->vpicture.bIsProgressive;
return 0;
}
int FbmTotalBufferNum(Fbm* pFbm)
{
logi("FbmTotalBufferNum");
return pFbm->nMaxFrameNum;
}
int FbmEmptyBufferNum(Fbm* pFbm)
{
return pFbm->nEmptyBufferNum;
}
int FbmValidPictureNum(Fbm* pFbm)
{
logi("FbmValidPictureNum");
return pFbm->nValidPictureNum;
}
int FbmAllocatePictureBuffer(VideoPicture* pPicture, int* nAlignValue, int nWidth, int nHeight)
{
int ePixelFormat;
int nHeight16Align;
int nHeight32Align;
char* pMem;
int nMemSizeY;
int nMemSizeC;
int nLineStride;
int nHeight64Align;
ePixelFormat = pPicture->ePixelFormat;
nHeight16Align = (nHeight+15) & ~15;
nHeight32Align = (nHeight+31) & ~31;
nHeight64Align = (nHeight+63) & ~63;
pPicture->pData0 = NULL;
pPicture->pData1 = NULL;
pPicture->pData2 = NULL;
pPicture->pData3 = NULL;
switch(ePixelFormat)
{
case PIXEL_FORMAT_YUV_MB32_420:
case PIXEL_FORMAT_YUV_MB32_422:
case PIXEL_FORMAT_YUV_MB32_444:
//* for decoder,
//* height of Y component is required to be 32 aligned.
//* height of UV component are both required to be 32 aligned.
//* nLineStride should be 32 aligned.
*nAlignValue = 32;
pPicture->nLineStride = (nWidth+31)&~31;
pPicture->nWidth = pPicture->nLineStride;
pPicture->nHeight = nHeight32Align;
nLineStride = (pPicture->nWidth+63) &~ 63;
nMemSizeY = nLineStride*nHeight64Align;
if(ePixelFormat == PIXEL_FORMAT_YUV_MB32_420)
nMemSizeC = nLineStride*nHeight64Align/4;
else if(ePixelFormat == PIXEL_FORMAT_YUV_MB32_422)
nMemSizeC = nLineStride*nHeight64Align/2;
else
nMemSizeC = nLineStride*nHeight64Align;
pMem = (char*)AdapterMemPalloc(nMemSizeY);
if(pMem == NULL)
{
loge("memory alloc fail, require %d bytes for picture buffer.", nMemSizeY);
return -1;
}
pPicture->pData0 = pMem;
pMem = (char*)AdapterMemPalloc(nMemSizeC*2); //* UV is combined.
if(pMem == NULL)
{
loge("memory alloc fail, require %d bytes for picture buffer.", nMemSizeC*2);
AdapterMemPfree(pPicture->pData0);
pPicture->pData0 = NULL;
return -1;
}
pPicture->pData1 = pMem;
pPicture->pData2 = NULL;
pPicture->pData3 = NULL;
break;
default:
loge("pixel format incorrect, ePixelFormat=%d", ePixelFormat);
return -1;
}
if(pPicture->pData0 != NULL)
{
pPicture->phyYBufAddr = (unsigned int)AdapterMemGetPhysicAddress(pPicture->pData0);
}
if(pPicture->pData1 != NULL)
{
pPicture->phyCBufAddr = (unsigned int)AdapterMemGetPhysicAddress(pPicture->pData1);
}
return 0;
}
int FbmFreePictureBuffer(VideoPicture* pPicture)
{
if(pPicture->pData0 != NULL)
{
AdapterMemPfree(pPicture->pData0);
pPicture->pData0 = NULL;
}
if(pPicture->ePixelFormat < PIXEL_FORMAT_YUV_MB32_420)
{
return 0;
}
if(pPicture->pData1 != NULL)
{
AdapterMemPfree(pPicture->pData1);
pPicture->pData1 = NULL;
}
if(pPicture->pData2 != NULL)
{
AdapterMemPfree(pPicture->pData2);
pPicture->pData2 = NULL;
}
if(pPicture->pData3 != NULL)
{
AdapterMemPfree(pPicture->pData3);
pPicture->pData3 = NULL;
}
return 0;
}