I'm arriving very late to the party for OMAP3530 low level software integration for the H.264 Encoder ... I have the basic H.264 encoder working but have been stalled trying to get the "callback" function to work for breaking the encoded H.264 output in NAL packet format (with SPS/PPS as well). I only see two unresolved TI threads on this that have been quiet over a year.
I was surprised to Google the entire planet Earth and not find a single reference to "pfNalUnitCallBack", but it is documented in a PDF file packaged with the codecs:
H.264 Baseline Profile Encoder on
OMAP3530
User’s Guide
Literature Number: SPRUET9
July 2009
in Appendix B. The Appendix gives conflicting examples on the prototype of the function (the code example omits the "*pContext" argument which isn't well explained).
We would be extremely grateful if anyone at TI (or anywhere else) could shed light on how the callback function is supposed to be configured and work.
My code works fine with the callback set to NULL. Below is a debug trace (with all debugging I could turn on which shows a call in VIDENC1_process() and the DSP dying instead of doing the next thing, like CN - NODE ...
First debug trace is from callback function pfNalUnitCallBack = NULL:
call VIDENC1_process()...
@2,678,765us: [+0 T:0x403c6000] ti.sdo.ce.video1.VIDENC1 -
VIDENC1_process> Enter (handle=0x54960, inBufs=0x5263c,
outBufs=0x5270c, inArgs=0x52720,
outArgs=0x5272c)
@2,679,070us: [+4 T:0x403c6000] CV - VISA_getMaxMsgSize(0x54960):
returning
0x1000
@2,679,222us: [+5 T:0x403c6000] CV - VISA_allocMsg> Allocating
message for
messageId=0x000288eb
@2,679,405us: [+0 T:0x403c6000] CV - VISA_call(visa=0x54960,
msg=0x413d4880): messageId=0x000288eb,
command=0x0
[DSP] @5,049,736tk: [+5 T:0x87f1242c] CN - NODE>
0x87f11e30(h264enc#0) call(algHandle=0x87f11ef8, msg=0x87305880);
messageId=0x000288eb
[DSP] @5,049,820tk: [+0 T:0x87f1242c] OM - Memory_cacheInv>
Enter(addr=0x86350000,
sizeInBytes=101376)
[DSP] @5,049,987tk: [+0 T:0x87f1242c] OM - Memory_cacheInv>
return
[DSP] @5,050,020tk: [+0 T:0x87f1242c] OM - Memory_cacheInv>
Enter(addr=0x86368c00,
sizeInBytes=25344)
[DSP] @5,050,099tk: [+0 T:0x87f1242c] OM - Memory_cacheInv>
return
[DSP] @5,050,131tk: [+0 T:0x87f1242c] OM - Memory_cacheInv>
Enter(addr=0x8636ef00,
sizeInBytes=25344)
[DSP] @5,050,210tk: [+0 T:0x87f1242c] OM - Memory_cacheInv>
return
[DSP] @5,050,244tk: [+0 T:0x87f1242c] OM - Memory_cacheInv>
Enter(addr=0x86300000,
sizeInBytes=327680)
[DSP] @5,050,650tk: [+0 T:0x87f1242c] OM - Memory_cacheInv>
return
[DSP] @5,050,689tk: [+0 T:0x87f1242c] ti.sdo.ce.video1.VIDENC1 -
VIDENC1_process> Enter (handle=0x87f11ef8, inBufs=0x87f1764c,
outBufs=0x87f1771c, inArgs=0x87305a04,
outArgs=0x87305a10)
[DSP] @5,050,787tk: [+5 T:0x87f1242c] CV -
VISA_enter(visa=0x87f11ef8): algHandle =
0x87f11f30
[DSP] @5,050,836tk: [+0 T:0x87f1242c] ti.sdo.ce.alg.Algorithm -
Algorithm_activate>
Enter(alg=0x87f11f30)
[DSP] @5,050,886tk: [+0 T:0x87f1242c] ti.sdo.ce.alg.Algorithm -
Algorithm_activate>
Exit
[DSP] @5,064,528tk: [+5 T:0x87f1242c] CV -
VISA_exit(visa=0x87f11ef8): algHandle =
0x87f11f30
[DSP] @5,064,605tk: [+0 T:0x87f1242c] ti.sdo.ce.alg.Algorithm -
Algorithm_deactivate>
Enter(alg=0x87f11f30)
[DSP] @5,064,664tk: [+0 T:0x87f1242c] ti.sdo.ce.alg.Algorithm -
Algorithm_deactivate>
Exit
[DSP] @5,064,710tk: [+0 T:0x87f1242c] ti.sdo.ce.video1.VIDENC1 -
VIDENC1_process> Exit (handle=0x87f11ef8,
retVal=0x0)
[DSP] @5,064,771tk: [+0 T:0x87f1242c] OM - Memory_cacheWb>
Enter(addr=0x86300000,
sizeInBytes=327680)
[DSP] @5,065,202tk: [+0 T:0x87f1242c] OM - Memory_cacheWb>
return
[DSP] @5,065,237tk: [+5 T:0x87f1242c] CN - NODE> returned from
call(algHandle=0x87f11ef8, msg=0x87305880);
messageId=0x000288eb
@2,692,986us: [+0 T:0x403c6000] CE - Engine_fwriteTrace>
returning count
[1998]
@2,693,108us: [+0 T:0x403c6000] CV - VISA_call Completed:
messageId=0x000288eb, command=0x0,
return(status=0)
@2,693,260us: [+5 T:0x403c6000] CV - VISA_freeMsg(0x54960,
0x413d4880): Freeing message with
messageId=0x000288eb
@2,693,382us: [+0 T:0x403c6000] ti.sdo.ce.video1.VIDENC1 -
VIDENC1_process> Exit (handle=0x54960,
retVal=0x0)
...
return
DSP encoding output: frameType 0x3, frameSkip 0x0, bytes
439
call VIDENC1_process()... @2,696,770us: [+0 T:0x403c6000]
ti.sdo.ce.video1.VIDENC1 - VIDENC1_process> Enter ...
(and so on, all 61 frames encoded)
This is the comparable trace with only change being assigning the callback function:
call VIDENC1_process()... @3,053,013us: [+0 T:0x403c6000] XU - XdmUtils_validateExtendedStruct> Enter (pStruct=0x52720, minSize=0xc, name=inArgs
@3,053,318us: [+0 T:0x403c6000] XU - XdmUtils_validateExtendedStruct> return (0x1)
@3,053,440us: [+0 T:0x403c6000] XU - XdmUtils_validateExtendedStruct> Enter (pStruct=0x5272c, minSize=0x78, name=outArgs
@3,053,562us: [+0 T:0x403c6000] XU - XdmUtils_validateExtendedStruct> return (0x1)
@3,053,715us:
[+0 T:0x403c6000] ti.sdo.ce.video1.VIDENC1 - VIDENC1_process> Enter
(handle=0x54960, inBufs=0x5263c, outBufs=0x5270c, inArgs=0x52720,
outArgs=0x5272c)
@3,053,837us: [+0 T:0x403c6000] XU - XdmUtils_validateSparseBufDesc> Enter (bufDesc=0x5270c, name=outBufs
@3,053,959us: [+0 T:0x403c6000] XU - XdmUtils_validateSparseBufDesc> return (0x1)
@3,054,081us: [+4 T:0x403c6000] CV - VISA_getMaxMsgSize(0x54960): returning 0x1000
@3,054,172us: [+5 T:0x403c6000] CV - VISA_allocMsg> Allocating message for messageId=0x00028944
@3,054,356us: [+0 T:0x403c6000] CV - VISA_call(visa=0x54960, msg=0x413d4880): messageId=0x00028944, command=0x0
(it just stops here)