custom_video_enc_mpeg4.c
22.6 KB
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
/*****************************************************************************
* Filename:
* ---------
* custom_video_enc_mpeg4.c
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
* This file provides interfaces for accessing customized video parameters.
* It shall not normally be modified.
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#ifdef __VIDEO_ARCHI_V2__
/* __MPEG4_ENC_SUPPORT__ is a global option. */
#ifdef __MPEG4_ENC_SUPPORT__
#include <stddef.h>
#include "kal_release.h"
#include "custom_video_enc_setting.h"
#include "custom_video_enc_mpeg4.h"
#ifdef __MMI_EM_MISC_RECORDER_PARAM_AJUST__
#include "EngineerModeRecorderSetting.h"
#endif
// #include "drv_comm.h" // for drv_trace1(), drv_trace8()
/*****************************************************************************
* Static global variables
*****************************************************************************/
static CUSTOM_VENC_MPEG4_MGR_T _rCustomVencMpeg4Mgr;
/*****************************************************************************
* Clear the saved index of table selection. All "Set" functions need to
* call this function so that the frame rate table will be search again with
* the new set value.
*****************************************************************************/
static __inline _CustomVenc_MPEG4_ClearTableSelection(void)
{
_rCustomVencMpeg4Mgr.u2TableIndex = CUSTOM_VENC_MPEG4_UNKNOWN_TABLE_INDEX;
}
/*****************************************************************************
* Memory pointed by the input parameters is allocated by caller.
*****************************************************************************/
static CUSTOM_VENC_ERROR_T _CustomVenc_MPEG4_MakeTableSelection(kal_uint16 *pu2TableIndex)
{
CUSTOM_VENC_ERROR_T eError = CUSTOM_VENC_ERROR_NONE;
const kal_uint16 u2TableEntries = _rCustomVencMpeg4Mgr.u2TableEntries;
kal_uint16 u2TableIndex = _rCustomVencMpeg4Mgr.u2TableIndex;
if (!(u2TableEntries != CUSTOM_VENC_MPEG4_UNKNOWN_TABLE_ENTRIES)) { ASSERT(0); }
if (!(_rCustomVencMpeg4Mgr.u2Width != CUSTOM_VENC_MPEG4_UNKNOWN_WIDTH)) { ASSERT(0); }
if (!(_rCustomVencMpeg4Mgr.u2Height != CUSTOM_VENC_MPEG4_UNKNOWN_HEIGHT)) { ASSERT(0); }
if (!(_rCustomVencMpeg4Mgr.eQuality != CUSTOM_VENC_QUALITY_UNKNOWN)) { ASSERT(0); }
if (!(_rCustomVencMpeg4Mgr.eStorage != CUSTOM_VENC_STORAGE_UNKNOWN)) { ASSERT(0); }
if (!(_rCustomVencMpeg4Mgr.eCodec != CUSTOM_VENC_CODEC_UNKNOWN)) { ASSERT(0); }
// if (_rCustomVencMpeg4Mgr.eResolution == CUSTOM_VENC_RESOLUTION_UNKNOWN)
{
kal_uint16 u2Width, u2Height;
CUSTOM_VENC_RESOLUTION_T eResolution;
u2Width = _rCustomVencMpeg4Mgr.u2Width;
u2Height = _rCustomVencMpeg4Mgr.u2Height;
eError = CustomVenc_MapWidthAndHeightToResolution(u2Width, u2Height, &eResolution);
if (!(eError == CUSTOM_VENC_ERROR_NONE)) { ASSERT(0); }
if (!(eResolution != CUSTOM_VENC_RESOLUTION_UNKNOWN)) { ASSERT(0); }
_rCustomVencMpeg4Mgr.eResolution = eResolution;
}
if (u2TableIndex == CUSTOM_VENC_MPEG4_UNKNOWN_TABLE_INDEX)
{
for (u2TableIndex = 0; u2TableIndex < u2TableEntries; u2TableIndex++)
{
if (_rMpeg4FrameRateTable[u2TableIndex].rUpperTable.eResolution == _rCustomVencMpeg4Mgr.eResolution)
{
if ((_rMpeg4FrameRateTable[u2TableIndex].rUpperTable.eQuality == CUSTOM_VENC_QUALITY_ALL) ||
(_rMpeg4FrameRateTable[u2TableIndex].rUpperTable.eQuality == _rCustomVencMpeg4Mgr.eQuality))
{
if ((_rMpeg4FrameRateTable[u2TableIndex].rUpperTable.eStorage == CUSTOM_VENC_STORAGE_ALL) ||
(_rMpeg4FrameRateTable[u2TableIndex].rUpperTable.eStorage == _rCustomVencMpeg4Mgr.eStorage))
{
if ((_rMpeg4FrameRateTable[u2TableIndex].rUpperTable.eCodec == CUSTOM_VENC_CODEC_ALL) ||
(_rMpeg4FrameRateTable[u2TableIndex].rUpperTable.eCodec == _rCustomVencMpeg4Mgr.eCodec))
{
if ((_rMpeg4FrameRateTable[u2TableIndex].rUpperTable.eRotate == CUSTOM_VENC_ROTATE_ALL) ||
(_rMpeg4FrameRateTable[u2TableIndex].rUpperTable.eRotate == _rCustomVencMpeg4Mgr.eRotate))
{
_rCustomVencMpeg4Mgr.u2TableIndex = u2TableIndex;
eError = CUSTOM_VENC_ERROR_NONE;
break;
}
}
}
}
}
}
if (u2TableIndex == u2TableEntries)
{
eError = CUSTOM_VENC_ERROR_NO_MATCH;
}
}
else
{
eError = CUSTOM_VENC_ERROR_NONE;
}
*pu2TableIndex = u2TableIndex;
return eError;
}
/*****************************************************************************
*
*****************************************************************************/
static kal_uint16 _CustomVenc_MPEG4_ComputeNumOfEntries(void)
{
if (!(sizeof(_rMpeg4FrameRateTable) != 0)) { ASSERT(0); }
if (!(sizeof(_rMpeg4FrameRateTable[0]) != 0)) { ASSERT(0); }
if (!(sizeof(_rDefaultMpeg4FrameRateTable) != 0)) { ASSERT(0); }
if (!(sizeof(_rDefaultMpeg4FrameRateTable[0]) != 0)) { ASSERT(0); }
return (kal_uint16)(sizeof(_rMpeg4FrameRateTable) / sizeof(_rMpeg4FrameRateTable[0]));
}
/*****************************************************************************
*
*****************************************************************************/
static CUSTOM_VENC_ERROR_T _CustomVenc_MPEG4_SetUser(void *pvInput,
kal_uint32 u4InputSize, void *pvOutput, kal_uint32 u4OutputSize)
{
// Clear all internal variables.
_rCustomVencMpeg4Mgr.u2Width = CUSTOM_VENC_MPEG4_UNKNOWN_WIDTH;
_rCustomVencMpeg4Mgr.u2Height = CUSTOM_VENC_MPEG4_UNKNOWN_HEIGHT;
_rCustomVencMpeg4Mgr.u2TableEntries = _CustomVenc_MPEG4_ComputeNumOfEntries();
_rCustomVencMpeg4Mgr.u2TableIndex = CUSTOM_VENC_MPEG4_UNKNOWN_TABLE_INDEX;
_rCustomVencMpeg4Mgr.eResolution = CUSTOM_VENC_RESOLUTION_UNKNOWN;
_rCustomVencMpeg4Mgr.eQuality = CUSTOM_VENC_QUALITY_UNKNOWN;
_rCustomVencMpeg4Mgr.eStorage = CUSTOM_VENC_STORAGE_UNKNOWN;
_rCustomVencMpeg4Mgr.eCodec = CUSTOM_VENC_CODEC_UNKNOWN;
_rCustomVencMpeg4Mgr.eRotate = CUSTOM_VENC_ROTATE_UNKNOWN;
return CUSTOM_VENC_ERROR_NONE;
}
/*****************************************************************************
*
*****************************************************************************/
static CUSTOM_VENC_ERROR_T _CustomVenc_MPEG4_GetNumOfEntries(void *pvInput,
kal_uint32 u4InputSize, void *pvOutput, kal_uint32 u4OutputSize)
{
kal_uint32 *pu4Output;
if (!(pvOutput != NULL)) { ASSERT(0); }
if (!(sizeof(*pu4Output) == u4OutputSize)) { ASSERT(0); }
_rCustomVencMpeg4Mgr.u2TableEntries = _CustomVenc_MPEG4_ComputeNumOfEntries();
pu4Output = (kal_uint32*)pvOutput;
*pu4Output = _rCustomVencMpeg4Mgr.u2TableEntries;
return CUSTOM_VENC_ERROR_NONE;
}
/*****************************************************************************
*
*****************************************************************************/
static CUSTOM_VENC_ERROR_T _CustomVenc_MPEG4_GetOneEntry(void *pvInput,
kal_uint32 u4InputSize, void *pvOutput, kal_uint32 u4OutputSize)
{
kal_uint32 *pu4Index;
CUSTOM_VENC_UPPER_TABLE_T *prUpperTable;
CUSTOM_VENC_REC_MPEG4_UPPER_TABLE_T *prUpperTableNew;
if (!(pvInput != NULL)) { ASSERT(0); }
if (!(sizeof(*pu4Index) == u4InputSize)) { ASSERT(0); }
pu4Index = (kal_uint32*)pvInput;
if (!(_rCustomVencMpeg4Mgr.u2TableEntries != CUSTOM_VENC_MPEG4_UNKNOWN_TABLE_ENTRIES)) { ASSERT(0); }
if (!(*pu4Index < _rCustomVencMpeg4Mgr.u2TableEntries)) { ASSERT(0); }
if (!(pvOutput != NULL)) { ASSERT(0); }
if (!(sizeof(*prUpperTable) == u4OutputSize)) { ASSERT(0); }
prUpperTable = (CUSTOM_VENC_UPPER_TABLE_T*)pvOutput;
prUpperTableNew = (CUSTOM_VENC_REC_MPEG4_UPPER_TABLE_T *)&_rMpeg4FrameRateTable[*pu4Index].rUpperTable;
prUpperTable->eResolution = prUpperTableNew->eResolution;
prUpperTable->eQuality = prUpperTableNew->eQuality;
prUpperTable->eStorage = prUpperTableNew->eStorage;
prUpperTable->eCodec = prUpperTableNew->eCodec;
return CUSTOM_VENC_ERROR_NONE;
}
/*****************************************************************************
*
*****************************************************************************/
static CUSTOM_VENC_ERROR_T _CustomVenc_MPEG4_GetOneEntryRecMPEG4(void *pvInput,
kal_uint32 u4InputSize, void *pvOutput, kal_uint32 u4OutputSize)
{
kal_uint32 *pu4Index;
CUSTOM_VENC_REC_MPEG4_UPPER_TABLE_T *prUpperTable;
if (!(pvInput != NULL)) { ASSERT(0); }
if (!(sizeof(*pu4Index) == u4InputSize)) { ASSERT(0); }
pu4Index = (kal_uint32*)pvInput;
if (!(_rCustomVencMpeg4Mgr.u2TableEntries != CUSTOM_VENC_MPEG4_UNKNOWN_TABLE_ENTRIES)) { ASSERT(0); }
if (!(*pu4Index < _rCustomVencMpeg4Mgr.u2TableEntries)) { ASSERT(0); }
if (!(pvOutput != NULL)) { ASSERT(0); }
if (!(sizeof(*prUpperTable) == u4OutputSize)) { ASSERT(0); }
prUpperTable = (CUSTOM_VENC_REC_MPEG4_UPPER_TABLE_T *)pvOutput;
*prUpperTable = _rMpeg4FrameRateTable[*pu4Index].rUpperTable;
return CUSTOM_VENC_ERROR_NONE;
}
//----------------------------------------------------------------------------
static CUSTOM_VENC_ERROR_T _CustomVenc_MPEG4_SetField(void *pvInput, kal_uint32 u4InputSize, int field_offset, int size_of_field)
{
kal_uint32 *pInput = (kal_uint32 *) pvInput;
if (!(pvInput != NULL)) { ASSERT(0); }
if (!(sizeof(*pInput) == u4InputSize)) { ASSERT(0); }
switch (size_of_field)
{
case 1:
{
kal_uint8 *pField = (kal_uint8 *)((kal_uint8 *) &_rCustomVencMpeg4Mgr + field_offset);
*pField = (kal_uint8) *pInput;
break;
}
case 2:
{
kal_uint16 *pField = (kal_uint16 *)((kal_uint8 *) &_rCustomVencMpeg4Mgr + field_offset);
*pField = (kal_uint16) *pInput;
break;
}
case 4:
{
kal_uint32 *pField = (kal_uint32 *)((kal_uint8 *) &_rCustomVencMpeg4Mgr + field_offset);
*pField = (kal_uint32) *pInput;
break;
}
default:
{
ASSERT(0);
}
}
_CustomVenc_MPEG4_ClearTableSelection();
return CUSTOM_VENC_ERROR_NONE;
}
//----------------------------------------------------------------------------
static CUSTOM_VENC_ERROR_T _CustomVenc_MPEG4_GetField(void *pvOutput, int u4OutputSize, int field_offset, int size_of_field)
{
const kal_uint16 u2TableEntries = _rCustomVencMpeg4Mgr.u2TableEntries;
kal_uint16 u2TableIndex;
CUSTOM_VENC_ERROR_T eError;
void *pTableEntry = NULL;
kal_uint32 *pOutput = (kal_uint32 *) pvOutput;
if (!pvOutput) { ASSERT(0); }
if (sizeof(kal_uint32) != u4OutputSize) { ASSERT(0); }
eError = _CustomVenc_MPEG4_MakeTableSelection(&u2TableIndex);
if (eError == CUSTOM_VENC_ERROR_NONE)
{
if (!(u2TableEntries != CUSTOM_VENC_MPEG4_UNKNOWN_TABLE_ENTRIES)) { ASSERT(0); }
if (!(u2TableIndex != CUSTOM_VENC_MPEG4_UNKNOWN_TABLE_INDEX)) { ASSERT(0); }
if (!(u2TableIndex < u2TableEntries)) { ASSERT(0); }
pTableEntry = (void *) &_rMpeg4FrameRateTable[u2TableIndex];
}
else
{
pTableEntry = (void *) &_rDefaultMpeg4FrameRateTable[0];
eError = CUSTOM_VENC_ERROR_USE_DEFAULT;
}
if (pTableEntry == NULL) { ASSERT(0); }
switch (size_of_field)
{
case 1:
{
*pOutput = *((kal_uint8 *) ((kal_uint8 *) pTableEntry + field_offset));
break;
}
case 2:
{
*pOutput = *((kal_uint16 *) ((kal_uint8 *) pTableEntry + field_offset));
break;
}
case 4:
{
*pOutput = *((kal_uint32 *) ((kal_uint8 *) pTableEntry + field_offset));
break;
}
default:
{
ASSERT(0);
}
}
return eError;
}
/*****************************************************************************
*
*****************************************************************************/
static CUSTOM_VENC_ERROR_T _CustomVenc_MPEG4_Ctrl(CUSTOM_VENC_OP_T eOp,
void *pvInput, kal_uint32 u4InputSize, void *pvOutput, kal_uint32 u4OutputSize)
{
CUSTOM_VENC_ERROR_T eError;
#ifdef __MMI_EM_MISC_RECORDER_PARAM_AJUST__
if (g_mmi_em_recorder_setting.apply_em_setting == MMI_EM_RECORDER_SETTING_APPLY_YES)
{
kal_int32 *pRes = (kal_int32*) pvOutput;
eError = CUSTOM_VENC_ERROR_NOT_SUPPORTED;
switch (eOp)
{
case CUSTOM_VENC_OP_GET_INIT_Q:
*pRes = g_mmi_em_recorder_setting.init_qp;
eError = CUSTOM_VENC_ERROR_NONE;
break;
case CUSTOM_VENC_OP_GET_MIN_QP:
*pRes = g_mmi_em_recorder_setting.min_qp;
eError = CUSTOM_VENC_ERROR_NONE;
break;
case CUSTOM_VENC_OP_GET_MAX_QP:
*pRes = g_mmi_em_recorder_setting.max_qp;
eError = CUSTOM_VENC_ERROR_NONE;
break;
case CUSTOM_VENC_OP_GET_INTRA_VOP_RATE:
*pRes = g_mmi_em_recorder_setting.intra_vop_rate;
eError = CUSTOM_VENC_ERROR_NONE;
break;
case CUSTOM_VENC_OP_GET_ALGORITHM:
*pRes = g_mmi_em_recorder_setting.algorithm;
eError = CUSTOM_VENC_ERROR_NONE;
break;
case CUSTOM_VENC_OP_GET_BIT_RATE:
*pRes = g_mmi_em_recorder_setting.bit_rate * 1000;
eError = CUSTOM_VENC_ERROR_NONE;
break;
case CUSTOM_VENC_OP_GET_RATE_HARD_LIMIT:
*pRes = g_mmi_em_recorder_setting.rate_hard_limit;
eError = CUSTOM_VENC_ERROR_NONE;
break;
}
if (eError == CUSTOM_VENC_ERROR_NONE)
return eError;
}
#endif
switch (eOp)
{
case CUSTOM_VENC_OP_SET_USER:
eError = _CustomVenc_MPEG4_SetUser(pvInput, u4InputSize, pvOutput, u4OutputSize);
break;
case CUSTOM_VENC_OP_GET_NUM_OF_ENTRIES:
eError = _CustomVenc_MPEG4_GetNumOfEntries(pvInput, u4InputSize, pvOutput, u4OutputSize);
break;
case CUSTOM_VENC_OP_GET_ONE_ENTRY:
eError = _CustomVenc_MPEG4_GetOneEntry(pvInput, u4InputSize, pvOutput, u4OutputSize);
break;
case CUSTOM_VENC_OP_GET_ONE_ENTRY_REC_MPEG4:
eError = _CustomVenc_MPEG4_GetOneEntryRecMPEG4(pvInput, u4InputSize, pvOutput, u4OutputSize);
break;
case CUSTOM_VENC_OP_SET_WIDTH:
eError = _CustomVenc_MPEG4_SetField(pvInput, u4InputSize, offsetof(CUSTOM_VENC_MPEG4_MGR_T, u2Width), sizeof(kal_uint16));
break;
case CUSTOM_VENC_OP_SET_HEIGHT:
eError = _CustomVenc_MPEG4_SetField(pvInput, u4InputSize, offsetof(CUSTOM_VENC_MPEG4_MGR_T, u2Height), sizeof(kal_uint16));
break;
case CUSTOM_VENC_OP_SET_QUALITY:
eError = _CustomVenc_MPEG4_SetField(pvInput, u4InputSize, offsetof(CUSTOM_VENC_MPEG4_MGR_T, eQuality), sizeof(CUSTOM_VENC_QUALITY_T));
break;
case CUSTOM_VENC_OP_SET_STORAGE:
eError = _CustomVenc_MPEG4_SetField(pvInput, u4InputSize, offsetof(CUSTOM_VENC_MPEG4_MGR_T, eStorage), sizeof(CUSTOM_VENC_STORAGE_T));
break;
case CUSTOM_VENC_OP_SET_CODEC:
eError = _CustomVenc_MPEG4_SetField(pvInput, u4InputSize, offsetof(CUSTOM_VENC_MPEG4_MGR_T, eCodec), sizeof(CUSTOM_VENC_CODEC_T));
break;
case CUSTOM_VENC_OP_SET_ROTATE:
eError = _CustomVenc_MPEG4_SetField(pvInput, u4InputSize, offsetof(CUSTOM_VENC_MPEG4_MGR_T, eRotate), sizeof(CUSTOM_VENC_ROTATE_T));
break;
case CUSTOM_VENC_OP_GET_SENSOR_FRAME_RATE:
eError = _CustomVenc_MPEG4_GetField(pvOutput,
u4OutputSize,
offsetof(VIDEO_ENC_REC_MPEG4_FRAME_RATE_TABLE_V2_T, rLowerTable) +
offsetof(CUSTOM_VENC_REC_MPEG4_LOWER_TABLE_T, u2SensorFrameRate),
sizeof(kal_uint16));
break;
case CUSTOM_VENC_OP_GET_SENSOR_NIGHT_FRAME_RATE:
eError = _CustomVenc_MPEG4_GetField(pvOutput,
u4OutputSize,
offsetof(VIDEO_ENC_REC_MPEG4_FRAME_RATE_TABLE_V2_T, rLowerTable) +
offsetof(CUSTOM_VENC_REC_MPEG4_LOWER_TABLE_T, u2SensorNightFrameRate),
sizeof(kal_uint16));
break;
case CUSTOM_VENC_OP_GET_ENCODER_FRAME_RATE:
eError = _CustomVenc_MPEG4_GetField(pvOutput,
u4OutputSize,
offsetof(VIDEO_ENC_REC_MPEG4_FRAME_RATE_TABLE_V2_T, rLowerTable) +
offsetof(CUSTOM_VENC_REC_MPEG4_LOWER_TABLE_T, u2CodecFrameRate),
sizeof(kal_uint16));
break;
case CUSTOM_VENC_OP_GET_ENCODER_NIGHT_FRAME_RATE:
eError = _CustomVenc_MPEG4_GetField(pvOutput,
u4OutputSize,
offsetof(VIDEO_ENC_REC_MPEG4_FRAME_RATE_TABLE_V2_T, rLowerTable) +
offsetof(CUSTOM_VENC_REC_MPEG4_LOWER_TABLE_T, u2CodecNightFrameRate),
sizeof(kal_uint16));
break;
case CUSTOM_VENC_OP_GET_INIT_Q:
eError = _CustomVenc_MPEG4_GetField(pvOutput,
u4OutputSize,
offsetof(VIDEO_ENC_REC_MPEG4_FRAME_RATE_TABLE_V2_T, rLowerTable) +
offsetof(CUSTOM_VENC_REC_MPEG4_LOWER_TABLE_T, u1InitQ),
sizeof(kal_uint8));
break;
case CUSTOM_VENC_OP_GET_MIN_QP:
eError = _CustomVenc_MPEG4_GetField(pvOutput,
u4OutputSize,
offsetof(VIDEO_ENC_REC_MPEG4_FRAME_RATE_TABLE_V2_T, rLowerTable) +
offsetof(CUSTOM_VENC_REC_MPEG4_LOWER_TABLE_T, u1MinQp),
sizeof(kal_uint8));
break;
case CUSTOM_VENC_OP_GET_MAX_QP:
eError = _CustomVenc_MPEG4_GetField(pvOutput,
u4OutputSize,
offsetof(VIDEO_ENC_REC_MPEG4_FRAME_RATE_TABLE_V2_T, rLowerTable) +
offsetof(CUSTOM_VENC_REC_MPEG4_LOWER_TABLE_T, u1MaxQp),
sizeof(kal_uint8));
break;
case CUSTOM_VENC_OP_GET_INTRA_VOP_RATE:
eError = _CustomVenc_MPEG4_GetField(pvOutput,
u4OutputSize,
offsetof(VIDEO_ENC_REC_MPEG4_FRAME_RATE_TABLE_V2_T, rLowerTable) +
offsetof(CUSTOM_VENC_REC_MPEG4_LOWER_TABLE_T, u2IntraVopRate),
sizeof(kal_uint16));
break;
case CUSTOM_VENC_OP_GET_ALGORITHM:
eError = _CustomVenc_MPEG4_GetField(pvOutput,
u4OutputSize,
offsetof(VIDEO_ENC_REC_MPEG4_FRAME_RATE_TABLE_V2_T, rLowerTable) +
offsetof(CUSTOM_VENC_REC_MPEG4_LOWER_TABLE_T, u2Algorithm),
sizeof(kal_uint16));
break;
case CUSTOM_VENC_OP_GET_BIT_RATE:
eError = _CustomVenc_MPEG4_GetField(pvOutput,
u4OutputSize,
offsetof(VIDEO_ENC_REC_MPEG4_FRAME_RATE_TABLE_V2_T, rLowerTable) +
offsetof(CUSTOM_VENC_REC_MPEG4_LOWER_TABLE_T, u4BitRate),
sizeof(kal_uint32));
break;
case CUSTOM_VENC_OP_GET_RATE_HARD_LIMIT:
eError = _CustomVenc_MPEG4_GetField(pvOutput,
u4OutputSize,
offsetof(VIDEO_ENC_REC_MPEG4_FRAME_RATE_TABLE_V2_T, rLowerTable) +
offsetof(CUSTOM_VENC_REC_MPEG4_LOWER_TABLE_T, u4RateHardLimit),
sizeof(kal_uint32));
break;
case CUSTOM_VENC_OP_GET_RATE_BALANCE:
eError = _CustomVenc_MPEG4_GetField(pvOutput,
u4OutputSize,
offsetof(VIDEO_ENC_REC_MPEG4_FRAME_RATE_TABLE_V2_T, rLowerTable) +
offsetof(CUSTOM_VENC_REC_MPEG4_LOWER_TABLE_T, u4RateBalance),
sizeof(kal_uint32));
break;
default:
eError = CUSTOM_VENC_ERROR_NOT_SUPPORTED;
// When the error code CUSTOM_VENC_ERROR_NOT_SUPPORTED is received by
// codec, codec will try to use a default value for the requested property.
// For table extension in the future, do not assert here.
// ASSERT(0);
break;
}
return eError;
}
/*****************************************************************************
*
*****************************************************************************/
CUSTOM_VENC_ERROR_T CustomVenc_GetMpeg4CtrlFunction(PFN_CUSTOM_VENC_CTRL *ppfnCustomVencCtrl)
{
if (!(ppfnCustomVencCtrl != NULL)) { ASSERT(0); }
*ppfnCustomVencCtrl = _CustomVenc_MPEG4_Ctrl;
return CUSTOM_VENC_ERROR_NONE;
}
#endif // __MPEG4_ENC_SUPPORT__
#endif // __VIDEO_ARCHI_V2__