forked from 1658988725/hisi_rtsp_demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalcy_vpsschndump.c
executable file
·656 lines (548 loc) · 17.8 KB
/
calcy_vpsschndump.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
#include <sys/mman.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <sys/ioctl.h>
#include "hi_common.h"
#include "hi_comm_video.h"
#include "hi_comm_sys.h"
#include "mpi_sys.h"
#include "hi_comm_vb.h"
#include "mpi_vb.h"
#include "hi_comm_vpss.h"
#include "mpi_vpss.h"
#include "mpi_vgs.h"
#define MAX_FRM_WIDTH 2048
#define VALUE_BETWEEN(x,min,max) (((x)>=(min)) && ((x) <= (max)))
char pFrameData[307200];
typedef struct hiDUMP_MEMBUF_S
{
VB_BLK hBlock;
VB_POOL hPool;
HI_U32 u32PoolId;
HI_U32 u32PhyAddr;
HI_U8* pVirAddr;
HI_S32 s32Mdev;
} DUMP_MEMBUF_S;
static HI_S32 s_s32MemDev = -1;
static HI_U32 u32VpssDepthFlag = 0;
static HI_U32 u32SignalFlag = 0;
static VPSS_GRP VpssGrp = 0;
static VPSS_CHN VpssChn = 0;
static HI_U32 u32OrigDepth = 0;
static VIDEO_FRAME_INFO_S stFrame;
static VB_POOL hPool = VB_INVALID_POOLID;
static DUMP_MEMBUF_S stMem = {0};
static VGS_HANDLE hHandle = -1;
static HI_U32 u32BlkSize = 0;
static HI_CHAR* pUserPageAddr[2] = {HI_NULL,HI_NULL};
static HI_U32 u32Size = 0;
static FILE* pfd = HI_NULL;
static int cw = 200;
static int ch = 200;
static int cXb = 0x00;
static int cYb = 0x00;
#define MEM_DEV_OPEN() \
do {\
if (s_s32MemDev <= 0)\
{\
s_s32MemDev = open("/dev/mem", O_CREAT|O_RDWR|O_SYNC);\
if (s_s32MemDev < 0)\
{\
perror("Open dev/mem error");\
return -1;\
}\
}\
}while(0)
#define MEM_DEV_CLOSE() \
do {\
HI_S32 s32Ret;\
if (s_s32MemDev > 0)\
{\
s32Ret = close(s_s32MemDev);\
if(HI_SUCCESS != s32Ret)\
{\
perror("Close mem/dev Fail");\
return s32Ret;\
}\
s_s32MemDev = -1;\
}\
}while(0)
/*When saving a file,sp420 will be denoted by p420 and sp422 will be denoted by p422 in the name of the file */
void sample_yuv_dump(VIDEO_FRAME_S* pVBuf, FILE* pfd)
{
unsigned int w, h;
char* pVBufVirt_Y;
char* pVBufVirt_C;
char* pMemContent;
unsigned char TmpBuff[MAX_FRM_WIDTH]; //If this value is too small and the image is big, this memory may not be enough
HI_U32 phy_addr;
PIXEL_FORMAT_E enPixelFormat = pVBuf->enPixelFormat;
HI_U32 u32UvHeight;/*When the storage format is a planar format, this variable is used to keep the height of the UV component */
if (PIXEL_FORMAT_YUV_SEMIPLANAR_420 == enPixelFormat)
{
u32Size = (pVBuf->u32Stride[0]) * (pVBuf->u32Height) * 3 / 2;
u32UvHeight = pVBuf->u32Height / 2;
}
else if(PIXEL_FORMAT_YUV_SEMIPLANAR_422 == enPixelFormat)
{
u32Size = (pVBuf->u32Stride[0]) * (pVBuf->u32Height) * 2;
u32UvHeight = pVBuf->u32Height;
}
else if(PIXEL_FORMAT_YUV_400 == enPixelFormat)
{
u32Size = (pVBuf->u32Stride[0]) * (pVBuf->u32Height);
u32UvHeight = pVBuf->u32Height;
}
phy_addr = pVBuf->u32PhyAddr[0];
//printf("phy_addr:%x, size:%d\n", phy_addr, size);
pUserPageAddr[0] = (HI_CHAR*) HI_MPI_SYS_Mmap(phy_addr, u32Size);
if (HI_NULL == pUserPageAddr[0])
{
return;
}
//printf("stride: %d,%d\n",pVBuf->u32Stride[0],pVBuf->u32Stride[1] );
pVBufVirt_Y = pUserPageAddr[0];
pVBufVirt_C = pVBufVirt_Y + (pVBuf->u32Stride[0]) * (pVBuf->u32Height);
/* save Y ----------------------------------------------------------------*/
fprintf(stderr, "saving......Y......");
fflush(stderr);
for (h = 0; h < pVBuf->u32Height; h++)
{
pMemContent = pVBufVirt_Y + h * pVBuf->u32Stride[0];
fwrite(pMemContent, pVBuf->u32Width, 1, pfd);
}
if(PIXEL_FORMAT_YUV_400 != enPixelFormat)
{
fflush(pfd);
/* save U ----------------------------------------------------------------*/
fprintf(stderr, "U......");
fflush(stderr);
for (h = 0; h < u32UvHeight; h++)
{
pMemContent = pVBufVirt_C + h * pVBuf->u32Stride[1];
pMemContent += 1;
for (w = 0; w < pVBuf->u32Width / 2; w++)
{
TmpBuff[w] = *pMemContent;
pMemContent += 2;
}
fwrite(TmpBuff, pVBuf->u32Width / 2, 1, pfd);
}
fflush(pfd);
/* save V ----------------------------------------------------------------*/
fprintf(stderr, "V......");
fflush(stderr);
for (h = 0; h < u32UvHeight; h++)
{
pMemContent = pVBufVirt_C + h * pVBuf->u32Stride[1];
for (w = 0; w < pVBuf->u32Width / 2; w++)
{
TmpBuff[w] = *pMemContent;
pMemContent += 2;
}
fwrite(TmpBuff, pVBuf->u32Width / 2, 1, pfd);
}
}
fflush(pfd);
fprintf(stderr, "done %d!\n", pVBuf->u32TimeRef);
fflush(stderr);
HI_MPI_SYS_Munmap(pUserPageAddr[0], u32Size);
pUserPageAddr[0] = HI_NULL;
}
//定义每250ms可以拍多少张照片
#define N250 8
#define EYE_OPEN 1
#define EYE_CLOSE 2
#define EYE_NULL 3
unsigned char eyeStatus[11*N250];
unsigned char eyeStatus_bak[11*N250];
/*
眨眼状态,拍照状态
111 111 222 222 222 111 111 111....
500ms - 750ms - 500ms
录像 1.5 - 2s
111 111 222 222 222 222 222 222 222 111 111 111....
500ms - 1750ms - 500ms
*/
void PhotoCtl()
{
int count = 0;
int i;
for(i=0;i< 7*N250;i++)
{
if(eyeStatus[i] == EYE_NULL)count ++;
}
//如果有500ms以上的NULL 则为无效数据
if(count > 2*N250) return;
//判断眨眼
}
void AddCalcToList(unsigned char flag)
{
memcpy(eyeStatus,eyeStatus_bak,sizeof(eyeStatus_bak));
eyeStatus[0] = flag;
memcpy(eyeStatus+1,eyeStatus_bak,sizeof(eyeStatus_bak)-1);
}
#define OPEN_Y_MIN 60
#define OPEN_Y_MAX 80
#define CLOSE_Y_MIN 40
#define CLOSE_Y_MIN 70
long get_timestamp()
{
struct timeval tv_date;
/* gettimeofday() could return an error, and should be tested. However, the
* only possible error, according to 'man', is EFAULT, which can not happen
* here, since tv is a local variable. */
gettimeofday( &tv_date, NULL );
return( (long ) tv_date.tv_sec * 1000000 + (long ) tv_date.tv_usec );
}
int nCalcCount = 0;
long preTime = 0;
/*When saving a file,sp420 will be denoted by p420 and sp422 will be denoted by p422 in the name of the file */
void calc_yuv_dump_y(VIDEO_FRAME_S* pVBuf)
{
unsigned int h;
char* pVBufVirt_Y;
char* pVBufVirt_C;
char* pMemContent;
unsigned char TmpBuff[MAX_FRM_WIDTH]; //If this value is too small and the image is big, this memory may not be enough
HI_U32 phy_addr;
PIXEL_FORMAT_E enPixelFormat = pVBuf->enPixelFormat;
HI_U32 u32UvHeight;/*When the storage format is a planar format, this variable is used to keep the height of the UV component */
if (PIXEL_FORMAT_YUV_SEMIPLANAR_420 == enPixelFormat)
{
u32Size = (pVBuf->u32Stride[0]) * (pVBuf->u32Height) * 3 / 2;
u32UvHeight = pVBuf->u32Height / 2;
}
else if(PIXEL_FORMAT_YUV_SEMIPLANAR_422 == enPixelFormat)
{
u32Size = (pVBuf->u32Stride[0]) * (pVBuf->u32Height) * 2;
u32UvHeight = pVBuf->u32Height;
}
else if(PIXEL_FORMAT_YUV_400 == enPixelFormat)
{
u32Size = (pVBuf->u32Stride[0]) * (pVBuf->u32Height);
u32UvHeight = pVBuf->u32Height;
}
phy_addr = pVBuf->u32PhyAddr[0];
//printf("phy_addr:%x, size:%d\n", phy_addr, size);
pUserPageAddr[0] = (HI_CHAR*) HI_MPI_SYS_Mmap(phy_addr, u32Size);
if (HI_NULL == pUserPageAddr[0])
{
return;
}
//printf("stride: %d,%d\n",pVBuf->u32Stride[0],pVBuf->u32Stride[1] );
pVBufVirt_Y = pUserPageAddr[0];
pVBufVirt_C = pVBufVirt_Y + (pVBuf->u32Stride[0]) * (pVBuf->u32Height);
//Get Y data.
//配置是640*480的图像.
//char chFrameTmp[640*480];
int ex = 0 ;
if(pVBuf->u32Height == 480 && pVBuf->u32Width == 640)
{
//获取Y数据,一行一行的copy
for (h = 0; h < pVBuf->u32Height; h++)
{
pMemContent = pVBufVirt_Y + h * pVBuf->u32Stride[0];
memcpy(pFrameData+ex, pMemContent,pVBuf->u32Width);
ex += pVBuf->u32Width;
}
//以图像中心点计算w=cw h=ch方框的Y值
//然后取平均值.
int xcb = cXb;
int ycb = cYb;
int xce = xcb + cw;
int yce = ycb + ch;
int x =0,y = 0;
unsigned long avg = 0,index = 0;
for(x = xcb;x <= xce;x++)
for(y = ycb;y <= yce;y++)
{
avg += pFrameData[y*640+x];
index ++;
}
avg = (avg/index);
#if 0
nCalcCount ++;
if(nCalcCount%100 == 0)
{
nCalcCount = 0;
long nowTime = get_timestamp();
printf("%d \n",nowTime - preTime);
preTime = nowTime;
printf("avg y :%d\n",avg);
}
#endif
printf("avg y :%d\n",avg);
//Calc Y avg..
}
HI_MPI_SYS_Munmap(pUserPageAddr[0], u32Size);
pUserPageAddr[0] = HI_NULL;
}
HI_S32 VPSS_Restore(VPSS_GRP VpssGrp, VPSS_CHN VpssChn)
{
if(VB_INVALID_POOLID != stFrame.u32PoolId)
{
HI_MPI_VPSS_ReleaseChnFrame(VpssGrp, VpssChn, &stFrame);
stFrame.u32PoolId = VB_INVALID_POOLID;
}
if(-1 != hHandle)
{
HI_MPI_VGS_CancelJob(hHandle);
hHandle = -1;
}
if(HI_NULL != stMem.pVirAddr)
{
HI_MPI_SYS_Munmap((HI_VOID*)stMem.pVirAddr, u32BlkSize );
stMem.u32PhyAddr = HI_NULL;
}
if(VB_INVALID_POOLID != stMem.hPool)
{
HI_MPI_VB_ReleaseBlock(stMem.hBlock);
stMem.hPool = VB_INVALID_POOLID;
}
if (VB_INVALID_POOLID != hPool)
{
HI_MPI_VB_DestroyPool( hPool );
hPool = VB_INVALID_POOLID;
}
if(HI_NULL != pUserPageAddr[0])
{
HI_MPI_SYS_Munmap(pUserPageAddr[0], u32Size);
pUserPageAddr[0] = HI_NULL;
}
if(u32VpssDepthFlag)
{
if (HI_MPI_VPSS_SetDepth(VpssGrp, VpssChn, u32OrigDepth) != HI_SUCCESS)
{
printf("set depth error!!!\n");
}
u32VpssDepthFlag = 0;
}
MEM_DEV_CLOSE();
return HI_SUCCESS;
}
void VPSS_Chn_Dump_HandleSig(HI_S32 signo)
{
if(u32SignalFlag)
{
exit(-1);
}
if (SIGINT == signo || SIGTERM == signo)
{
u32SignalFlag++;
VPSS_Restore(VpssGrp, VpssChn);
u32SignalFlag--;
printf("\033[0;31mprogram termination abnormally!\033[0;39m\n");
}
exit(-1);
}
HI_VOID* SAMPLE_MISC_VpssDump(VPSS_GRP Grp, VPSS_CHN Chn )
{
//HI_CHAR szYuvName[128];
//HI_CHAR szPixFrm[10];
HI_U32 u32Depth = 2;
HI_S32 s32MilliSec = 200;
HI_S32 s32Times = 10;
HI_BOOL bSendToVgs = HI_FALSE;
VIDEO_FRAME_INFO_S stFrmInfo;
VGS_TASK_ATTR_S stTask;
HI_U32 u32LumaSize = 0;
HI_U32 u32ChrmSize = 0;
HI_U32 u32PicLStride = 0;
HI_U32 u32PicCStride = 0;
HI_U32 u32Width = 0;
HI_U32 u32Height = 0;
HI_S32 i = 0;
HI_S32 s32Ret;
if (HI_MPI_VPSS_GetDepth(Grp, Chn, &u32OrigDepth) != HI_SUCCESS)
{
printf("get depth error!!!\n");
return (HI_VOID*) - 1;
}
if (HI_MPI_VPSS_SetDepth(Grp, Chn, u32Depth) != HI_SUCCESS)
{
printf("set depth error!!!\n");
VPSS_Restore(Grp, Chn);
return (HI_VOID*) - 1;
}
u32VpssDepthFlag = 1;
/* get frame */
while (1)
{
if (HI_MPI_VPSS_GetChnFrame(Grp, Chn, &stFrame, s32MilliSec) != HI_SUCCESS)
{
printf("Get frame fail \n");
usleep(1000);
continue;
}
bSendToVgs = ((stFrame.stVFrame.enCompressMode > 0) || (stFrame.stVFrame.enVideoFormat > 0));
if (bSendToVgs)
{
u32PicLStride = stFrame.stVFrame.u32Stride[0];
u32PicCStride = stFrame.stVFrame.u32Stride[0];
u32LumaSize = stFrame.stVFrame.u32Stride[0] * stFrame.stVFrame.u32Height;
u32Width = stFrame.stVFrame.u32Width;
u32Height = stFrame.stVFrame.u32Height;
if(PIXEL_FORMAT_YUV_SEMIPLANAR_420 == stFrame.stVFrame.enPixelFormat)
{
u32BlkSize = stFrame.stVFrame.u32Stride[0] * stFrame.stVFrame.u32Height * 3 >> 1;
u32ChrmSize = stFrame.stVFrame.u32Stride[0] * stFrame.stVFrame.u32Height >> 2;
}
else if(PIXEL_FORMAT_YUV_SEMIPLANAR_422 == stFrame.stVFrame.enPixelFormat)
{
u32BlkSize = stFrame.stVFrame.u32Stride[0] * stFrame.stVFrame.u32Height * 2;
u32ChrmSize = stFrame.stVFrame.u32Stride[0] * stFrame.stVFrame.u32Height >> 1;
}
else if(PIXEL_FORMAT_YUV_400 == stFrame.stVFrame.enPixelFormat)
{
u32BlkSize = stFrame.stVFrame.u32Stride[0] * stFrame.stVFrame.u32Height;
u32ChrmSize = 0;
}
else
{
printf("Unsupported pixelformat %d\n",stFrame.stVFrame.enPixelFormat);
VPSS_Restore(Grp, Chn);
return (HI_VOID*) - 1;
}
/*create comm vb pool*/
hPool = HI_MPI_VB_CreatePool( u32BlkSize, 1, HI_NULL);
if (hPool == VB_INVALID_POOLID)
{
printf("HI_MPI_VB_CreatePool failed! \n");
VPSS_Restore(Grp, Chn);
return (HI_VOID*) - 1;
}
stMem.hPool = hPool;
while ((stMem.hBlock = HI_MPI_VB_GetBlock(stMem.hPool, u32BlkSize, HI_NULL)) == VB_INVALID_HANDLE)
{
;
}
stMem.u32PhyAddr = HI_MPI_VB_Handle2PhysAddr(stMem.hBlock);
stMem.pVirAddr = (HI_U8*) HI_MPI_SYS_Mmap( stMem.u32PhyAddr, u32BlkSize );
if (stMem.pVirAddr == HI_NULL)
{
printf("Mem dev may not open\n");
VPSS_Restore(Grp, Chn);
return (HI_VOID*) - 1;
}
memset(&stFrmInfo.stVFrame, 0, sizeof(VIDEO_FRAME_S));
stFrmInfo.stVFrame.u32PhyAddr[0] = stMem.u32PhyAddr;
stFrmInfo.stVFrame.u32PhyAddr[1] = stFrmInfo.stVFrame.u32PhyAddr[0] + u32LumaSize;
stFrmInfo.stVFrame.u32PhyAddr[2] = stFrmInfo.stVFrame.u32PhyAddr[1] + u32ChrmSize;
stFrmInfo.stVFrame.pVirAddr[0] = stMem.pVirAddr;
stFrmInfo.stVFrame.pVirAddr[1] = (HI_U8*) stFrmInfo.stVFrame.pVirAddr[0] + u32LumaSize;
stFrmInfo.stVFrame.pVirAddr[2] = (HI_U8*) stFrmInfo.stVFrame.pVirAddr[1] + u32ChrmSize;
stFrmInfo.stVFrame.u32Width = u32Width;
stFrmInfo.stVFrame.u32Height = u32Height;
stFrmInfo.stVFrame.u32Stride[0] = u32PicLStride;
stFrmInfo.stVFrame.u32Stride[1] = u32PicCStride;
stFrmInfo.stVFrame.u32Stride[2] = u32PicCStride;
stFrmInfo.stVFrame.enCompressMode = COMPRESS_MODE_NONE;
stFrmInfo.stVFrame.enPixelFormat = stFrame.stVFrame.enPixelFormat;
stFrmInfo.stVFrame.enVideoFormat = VIDEO_FORMAT_LINEAR;
stFrmInfo.stVFrame.u64pts = (i * 40);
stFrmInfo.stVFrame.u32TimeRef = (i * 2);
stFrmInfo.u32PoolId = hPool;
s32Ret = HI_MPI_VGS_BeginJob(&hHandle);
if (s32Ret != HI_SUCCESS)
{
printf("HI_MPI_VGS_BeginJob failed\n");
hHandle = -1;
VPSS_Restore(Grp, Chn);
return (HI_VOID*) - 1;
}
memcpy(&stTask.stImgIn, &stFrame.stVFrame, sizeof(VIDEO_FRAME_INFO_S));
memcpy(&stTask.stImgOut , &stFrmInfo, sizeof(VIDEO_FRAME_INFO_S));
s32Ret = HI_MPI_VGS_AddScaleTask(hHandle, &stTask);
if (s32Ret != HI_SUCCESS)
{
printf("HI_MPI_VGS_AddScaleTask failed\n");
VPSS_Restore(Grp, Chn);
return (HI_VOID*) - 1;
}
s32Ret = HI_MPI_VGS_EndJob(hHandle);
if (s32Ret != HI_SUCCESS)
{
printf("HI_MPI_VGS_EndJob failed\n");
VPSS_Restore(Grp, Chn);
return (HI_VOID*) - 1;
}
hHandle = -1;
/* save VO frame to file */
//sample_yuv_dump(&stFrmInfo.stVFrame, pfd);
calc_yuv_dump_y(&stFrmInfo.stVFrame);
HI_MPI_VB_ReleaseBlock(stMem.hBlock);
stMem.hPool = VB_INVALID_POOLID;
hHandle = -1;
if(HI_NULL != stMem.pVirAddr)
{
HI_MPI_SYS_Munmap((HI_VOID*)stMem.pVirAddr, u32BlkSize );
stMem.u32PhyAddr = HI_NULL;
}
if (hPool != VB_INVALID_POOLID)
{
HI_MPI_VB_DestroyPool( hPool );
hPool = VB_INVALID_POOLID;
}
}
else
{
//sample_yuv_dump(&stFrame.stVFrame, pfd);
calc_yuv_dump_y(&stFrmInfo.stVFrame);
}
//printf("Get VpssGrp %d frame %d!!\n", Grp, u32Cnt);
/* release frame after using */
HI_MPI_VPSS_ReleaseChnFrame(Grp, Chn, &stFrame);
stFrame.u32PoolId = VB_INVALID_POOLID;
}
VPSS_Restore(Grp, Chn);
return (HI_VOID*)0;
}
HI_S32 main(int argc, char* argv[])
{
#if 0
if (argc == 3)
{
cw = atoi(argv[1]);
ch = atoi(argv[2]);
}
if( cw < 0 || cw > 640) cw = 200;
if( ch < 0 || ch > 480) ch = 200;
printf("calc w = %d,h = %d\n",cw,ch);
#endif
if (argc == 3)
{
cXb = atoi(argv[1]);
cXb = atoi(argv[2]);
}
if(argc == 5)
{
cXb = atoi(argv[1]);
cXb = atoi(argv[2]);
cw = atoi(argv[3]);
ch = atoi(argv[4]);
}
printf("calc point(%d,%d),w = %d,h = %d\n",cXb,cYb,cw,ch);
VpssGrp = 0;
VpssChn = 1;
u32VpssDepthFlag = 0;
u32SignalFlag = 0;
pUserPageAddr[0] = HI_NULL;
stFrame.u32PoolId = VB_INVALID_POOLID;
u32OrigDepth = 0;
hPool = VB_INVALID_POOLID;
hHandle = -1;
u32BlkSize = 0;
u32Size = 0;
//pfd = HI_NULL;
signal(SIGINT, VPSS_Chn_Dump_HandleSig);
signal(SIGTERM, VPSS_Chn_Dump_HandleSig);
MEM_DEV_OPEN();
SAMPLE_MISC_VpssDump(VpssGrp, VpssChn);
MEM_DEV_CLOSE();
return HI_SUCCESS;
}