Hi,
i'm facing MJPEG encode issue.
mjpeg codec lib version:01.00.00.09
i try to encode 320x192 video and output 192x180 resolution, but the actual output resolution is only 320x176
can you give me some suggestion? thanks in advance.
my parameters setting:
dynamicParams.size = sizeof(IMGENC1_DynamicParams); dynamicParams.numAU = XDM_DEFAULT; dynamicParams.inputChromaFormat = XDM_YUV_420SP; dynamicParams.inputHeight = 180; dynamicParams.inputWidth = 320; dynamicParams.captureWidth = 0; dynamicParams.generateHeader = XDM_ENCODE_AU; dynamicParams.qValue = 60;
I believe this query is related to DM36x. Have you tried using captureWidth parmatere. Please set captureWidth = 320 and inputWidth = 192. This should work.
regards
Yashwant
i try to implement this solution based on your suggestion, but the output size is 192x176. i want to get 320x180 size
my setting:
captureWidth = 320
inputWidth = 192
inputHeight= 180
Hi William,
It's not clear if you want the output size to be 320x180 or 192x180. Can you please clarify?
Also, can you also let us know all your input parameters?
Thanks & Regards,
Akshay
Hi Akshay,
sorry bring you any confuse, I made a mistake in the first mail, now, i want to clarify my problem once again.
my input video data is 320x192, after MJPEG encode, i want to get 320x180(16:9) output, but my MJPEG encode engine always output 320x176 size.
however, similarly, when input video data is 640x368, 640x360(16:9) MJPEG encode data can be output correctly.
MJPEG codec lib is : 01.00.00.09
all paramenters listed as follows:
params.size = sizeof(IMGENC1_Params); params.maxWidth = 320; params.maxHeight = 192; params.maxScans = 1; params.dataEndianness = XDM_BYTE; params.forceChromaFormat = XDM_YUV_420P;
In addition, MJPEG encode process inbuf and outbuf setting as following:
offset = width * height;
inBufDesc.numBufs = 2; inBufDesc.descs[0].bufSize = width*height; inBufDesc.descs[0].buf = (XDAS_Int8*)inBuf; inBufDesc.descs[0].accessMask = 0;
inBufDesc.descs[1].bufSize = width * height / 2; inBufDesc.descs[1].buf = (XDAS_Int8*)(inBuf + offset); inBufDesc.descs[1].accessMask = 0;
outBufDesc.numBufs = 1; outBufDesc.descs[0].bufSize = 1280x720x3/2; outBufDesc.descs[0].buf = (XDAS_Int8*)outBuf; outBufDesc.descs[0].accessMask = 0;
inArgs.size = sizeof(IMGENC1_InArgs); outArgs.size = sizeof(IMGENC1_OutArgs);
/* perform the image (JPEG) encoding */ status = IMGENC1_process(hEncode, &inBufDesc, &outBufDesc, &inArgs,&outArgs);
do you any idea? it's urgent for us!!!!!!!!!
I checked the jpeg encoder with the params you have mentioned. I am able to get 320x180 output from a 320x192 420SP YUV.
The JPEG encoder does support cropping by width by means of the inputWidth and captureWidth parameters. However, there isn't inherent support for cropping height. But since you are using 420SP input, it can be done by manipulating the input buffer pointers accordingly.
In your case, the input chroma buffer would need to be offset by 320x192 from the input luma buffer, even though the inputHeight you are passing to the encoder is 180.
Let me know how it goes.
Regards,
Akshay,
i'm really appreaciate for your reply.
but i'm still confused, why my 640x368 input data can be MJPEG encoded and then output 640x360 correctly?
at the same time, i'll follow your suggestion and let you know anything. thanks once again.
in addition, can you provide your all MJPEG encode parameters?
i'll check what's different between my setting and yours.
I'm not really sure what width*height are referred to in the code snippet you posted. But if it's equal to what you're using as maxWidth*maxHeight, then I guess you've taken care of it already.
-Akshay
William,
I'm running this in the dvtb test environment. My test parameters are:
codec => jpegenc1
maxHeight => 192
maxWidth => 320
maxScans => 0
dataEndianness => 1
forceChromaFormat => 1
numAU => 0
inputChromaFormat => 9
inputHeight => 180
inputWidth => 320
captureWidth => 0
generateHeader => 0
qValue => 73
halfBufCB => 0
halfBufCBarg => 0
extDynParamsRstInterval => 4
extDynParamsDisableEOI => 0
extDynParamsRotation => 0
customQ => 0
maybe you are still not able to my problem. so I'll describle it again.
firstly, my problem mainly focus on MJPEG encode. mjpeg codec lib version:01.00.00.09
1: when input YUV data size is 320x192, after MJPEG encode, only 320x176 size MJPEG data can be output correctly view by VLC, but i want to get 320x180 size MJPEG encoded data. all paramenters as following:
offset = 320* 192;
inBufDesc.numBufs = 2; inBufDesc.descs[0].bufSize = 320* 192; inBufDesc.descs[0].buf = (XDAS_Int8*)inBuf; inBufDesc.descs[0].accessMask = 0;
inBufDesc.descs[1].bufSize = 320* 192 / 2; inBufDesc.descs[1].buf = (XDAS_Int8*)(inBuf + offset); inBufDesc.descs[1].accessMask = 0;
2: However, when input YUV data size is 640x368, after MJPEG encode, 640x360 size MJPEG data can be output correctly view by VLC. all paramenters as following:
params.size = sizeof(IMGENC1_Params); params.maxWidth = 640; params.maxHeight = 368; params.maxScans = 1; params.dataEndianness = XDM_BYTE; params.forceChromaFormat = XDM_YUV_420P;
dynamicParams.size = sizeof(IMGENC1_DynamicParams); dynamicParams.numAU = XDM_DEFAULT; dynamicParams.inputChromaFormat = XDM_YUV_420SP; dynamicParams.inputHeight = 360; dynamicParams.inputWidth = 640; dynamicParams.captureWidth = 0; dynamicParams.generateHeader = XDM_ENCODE_AU; dynamicParams.qValue = 60;
offset = 640* 368;
inBufDesc.numBufs = 2; inBufDesc.descs[0].bufSize = 640* 368; inBufDesc.descs[0].buf = (XDAS_Int8*)inBuf; inBufDesc.descs[0].accessMask = 0;
inBufDesc.descs[1].bufSize = 640* 368 / 2; inBufDesc.descs[1].buf = (XDAS_Int8*)(inBuf + offset); inBufDesc.descs[1].accessMask = 0;
MJPEG is just a series of JPEG frames, so it makes no difference, as such.
Can you attach the 320x176 output you are getting here, so that I can have a look?
If it works with 640x360 then it really should work for 320x180 too....
that's my confused points. i don't know why 640x360 is ok, but 320x180 is not ok.
i have set all parameters the same with yours, but i still only get 320x176,
i have encosed my 320x176 output data for your reference.
thanks for you help.
as you mentioned, you are running this in the dvtb test environment, my test results is based on DVSDK_3,
my app interface as follows:IMGENC1_create;
IMGENC1_control;
IMGENC1_process
i don't if it's related with my unexpected output?