[Libva] Directly encoding a surface after decoding

Timo Rothenpieler timo at rothenpieler.org
Thu Jan 24 17:55:24 PST 2013


> Will you please describe more clearly how you combine them together? It
> will be better that you can attach your test case.

> It seems that the surface for encoding can't be accessed. Will you
> please describe how you use the decoding/encoding in the combined
> transcoder?

Adding a test case is not that simple, as i'm building VLC modules.
You can take a look at the code on Github:
https://github.com/BtbN/vlc/blob/vaapi/modules/codec/avcodec/vaapi.c
Relevant parts starting at line 610

https://github.com/BtbN/vlc/blob/vaapi/modules/codec/avcodec/vaapienc.c
The EncodeVideo Function at line 1057


Basicaly what i'm doing is:
In the decoder part:
In the place where I'd normaly call vaDeriveImage and vaMapBuffer to 
access the decoded yuv data(what works fine), I instead just store the 
VASurfaceID and pass it to the encoder.
There's logic in place that prevents this SurfaceID from beeing reused 
before the encoder is finished.

In the encoding part:
Where i'd normaly call vaDeriveImage and vaMapBuffer to write the yuv 
data into the Surface, i just use the VASurfaceID i got from the decoder 
instead of my own surface.
All i do with this VASurfaceID is passing it to vaBeginPicture(I later 
also pass it to vaSyncSurface, but the assertion happens before this 
code is run), so the encoder uses it as input surface.
Once this code reaches vaEndPicture, the assertion happens, cause of 
obj_surface->bo beeing NULL.


More information about the Libva mailing list