VPU for motion estimation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VPU for motion estimation

546 Views
baobui
Contributor I

Dear all,

I am using the VPU of i.mx6 Quad to calculate the motion estimation. From the i.MX 6Dual/6Quad VPU Application Programming Interface Linux Reference Manual

, there is API for the VPU encoder to encode H.264 from YUV input, and this API output the motion estimation vector.

The motion infor struct is:

typedef struct {

int enable;

int type;

int size;

Uint8 *addr;

} EncReportInfo;

i can get the data out of the API, however the data is all 0x17 at the beginning, and after some 0x17 value, the rest is zeros. I changed many inputs, and the result is the same.

My question is what is the format of the output buffer? (the start address is addr) The size of each motion vector is 16 bit or 8 bit?

Do you have any example that calculate the motion vector using the VPU? I used the encode example from FreeScale, it disabled the motion estimation. When I enable it, i get the result that I told you above

Thank you very much

0 Kudos
1 Reply

325 Views
joanxie
NXP TechSupport
NXP TechSupport

if you use unit test, pls use the patch as below:

Both VPU lib and unit test must be updated:

1) Unit test:

diff --git a/test/mxc_vpu_test/enc.c b/test/mxc_vpu_test/enc.c

index a8d4f9a..dc5e085 100644

--- a/test/mxc_vpu_test/enc.c

+++ b/test/mxc_vpu_test/enc.c

@@ -84,7 +84,7 @@ void SaveEncMvInfo(u8 *mvParaBuf, int size, int MbNumX, int EncNum)

fprintf(fpEncMvInfo, "MbAddr[%4d:For ]: Avail[0] Mv[%5d:%5d]\n", i, 0, 0);

} else {

mvX = (mvX & 0x7FFF) | ((mvX << 1) & 0x8000);

- fprintf(fpEncMvInfo, "MbAddr[%4d:For ]: Avail[1] Mv[%5d:%5d]\n", i, mvX, mvY);

+ fprintf(fpEncMvInfo, "MbAddr[%4d:For ]: Avail[1] Mv[%5d:%5d]\n", i, (short)mvX, (short)mvY);

}

mvParaBuf += 4;

        }

@@ -872,7 +872,7 @@ encoder_configure(struct encode *enc)

        }

enc->mbInfo.enable = 0;

-       enc->mvInfo.enable = 0;

+       enc->mvInfo.enable = 1;

enc->sliceInfo.enable = 0;

        if (enc->mbInfo.enable) {

2) Lib

diff --git a/vpu/vpu_lib.c b/vpu/vpu_lib.c

index 95af9ca..aed65da 100644

--- a/vpu/vpu_lib.c

+++ b/vpu/vpu_lib.c

@@ -2005,7 +2005,7 @@ RetCode vpu_EncGetOutputInfo(EncHandle handle, EncOutputInfo * info)

if (info->mvInfo.addr && info->mvInfo.size) {

size = (info->mvInfo.size + 7) / 8 * 8;

dst_addr = (Uint8 *)info->mvInfo.addr;

- src_addr = (Uint8 *)(virt_addr + ADDR_MB_BASE_OFFSET);

+ src_addr = (Uint8 *)(virt_addr + ADDR_MV_BASE_OFFSET);

CopyBufferData(dst_addr, src_addr, size);

}

        }

Only H.264 encoder works.

0 Kudos