How to determine which encode handler encoding finished

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

How to determine which encode handler encoding finished

Jump to solution
1,443 Views
chunfengzhang
Contributor I

Dear All:

We are going to use VPU on imx6s to Encode two way video streams concurrently.

Currently I'm reading the VPU_API_RM_L3.0.35_1.1.0.pdf. And I have a question. There seems to be a API named vpu_IsBusy(). It seems I can use this API to determine whether one frame has been encoded finished. But I don't know how to determine  the frame in which stream has been encoded finished.

Labels (3)
Tags (1)
0 Kudos
Reply
1 Solution
1,029 Views
juangutierrez
NXP Employee
NXP Employee

Hi


Here is the feedback provided by the vpu experrts


  • (1) About vpu_EncStartOneFrame()

There is one lock in vpu driver,  and it will be only occupied by one instance, this API will be blocked until the lock free(or released by other instance).

The lock release operation is located in vpu_EncGetOutputInfo().

  • (2) In general, we recommend customer to use vpu_WaitForInt (blocked API) instead of vpu_IsBusy(polling API)

Sample code like below whose timeout threshold is set with 500*4=2000 ms.

Vpu_EncStartOneFrame();

while(0!=vpu_WaitForInt(500)) {

busy_cnt++;

if(busy_cnt>= 4){

VPU_ENC_ERROR("while: wait busy : time out : count: %d \r\n",(UINT32)busy_cnt);

vpu_SWReset(handle,0);

vpu_EncClose();

Return -1; //time out for some corrupt clips

}

}

Vpu_EncGetOutputInfo();

View solution in original post

0 Kudos
Reply
3 Replies
1,029 Views
juangutierrez
NXP Employee
NXP Employee

Usually the encoder flow is

vpu_EncStartOneFrame(handle, ...)

vpu_IsBusy()

vpu_EncGetOutputInfo( handle, ...)

Returning from vpu_EncStartOneFrame means that encoding of one frame successfully has initiated.

So, my guess is that even when calling vpu_EncStartOneFrame from different process this will return only until the encoding of the frame of that particular handle has been started. Not sure, if when two process call it at the same time one will return success and the other an error, so you need to retry, or in both process they return success at the proper serialized time.

I will check the latter with one of the vpu experts, and let you know.

0 Kudos
Reply
1,030 Views
juangutierrez
NXP Employee
NXP Employee

Hi


Here is the feedback provided by the vpu experrts


  • (1) About vpu_EncStartOneFrame()

There is one lock in vpu driver,  and it will be only occupied by one instance, this API will be blocked until the lock free(or released by other instance).

The lock release operation is located in vpu_EncGetOutputInfo().

  • (2) In general, we recommend customer to use vpu_WaitForInt (blocked API) instead of vpu_IsBusy(polling API)

Sample code like below whose timeout threshold is set with 500*4=2000 ms.

Vpu_EncStartOneFrame();

while(0!=vpu_WaitForInt(500)) {

busy_cnt++;

if(busy_cnt>= 4){

VPU_ENC_ERROR("while: wait busy : time out : count: %d \r\n",(UINT32)busy_cnt);

vpu_SWReset(handle,0);

vpu_EncClose();

Return -1; //time out for some corrupt clips

}

}

Vpu_EncGetOutputInfo();

0 Kudos
Reply
1,029 Views
chunfengzhang
Contributor I

Thanks . I got it.

0 Kudos
Reply