I fixed the code by adding the following:
=======
inbufdesc.numBufs = 1;
inbufdesc.descs[0].buf = ptr;
inbufdesc.descs[0].bufSize = width*height*2;
outbufdesc.numBufs = 1;
outbufdesc.descs[0].buf = tmpbuf;
outbufdesc.descs[0].bufSize = width*height*2;
res = IMGENC1_process(ieh, &inbufdesc, &outbufdesc, &inargs, &outargs) ;
=====
Now, it appear to run without errors and returns IMGENC1_EOK.
However number of bytes generated is 6291456 bytes. (JPEG encoded: 6291456 bytes). The content of the buffer does not look like a JPEG file. Looks more like YUV data (I used that buffer to process the YUV data).
What's wrong now?