[vlc-devel] [RFC 0/1] Let decoders decide over DPB size.

Julian Scheel julian at jusst.de
Fri Aug 23 17:38:45 CEST 2013


while working at the direct rendering code in the omxil module I stumbled into
the following problem: For direct rendering the video output core required a
given amount of frames in the picture pool, which is calculated as:

private_picture = 4;
decoder_picture = 1 + sys->dpb_size;
kept_picture = 1;
reserved_picture = DISPLAY_PICTURE_COUNT + private_picture + kept_picture;
toal_size = reserved_picture + decoder_picture;

This is taken from src/video_output/vout_wrapper.c and modified slightly for
readability. Now this seems to make a lot of sense, when the decoder running
is actually utilizing the picture pool to store it's dpb. In fact this seems
to be the case for one decoder only, which is libmpeg2, as of now. All other
decoders care about a required dpb internally and hidden from VLC. So in the
end the pictures for dpb will be allocated in the pool and a second time in
the decoder itself. While this is probably not much of a problem on high end
systems it is a problem on embedded systems.
Taking into account that the dpb_size for H264 video is set to 18 in
src/input/decoder.c you will have to provide a picture pool with at least 24
frames to allow direct rendering. Doing this on a embedded system with few
memory being available this is likely to fail for high resolution videos.
While working with the omx modules I ran into this problem on Tegra 2 as well
as Raspberry Pi platforms, because both did not have enough memory to store 24
or more full 1080p frames in the GPU memory. But as they do not require the
dpb to be stored in the picture pool, but deal with it internally it is in
fact possible to remove the dpb_size form the picture pool and run with a much
smaller picture pool without any issues.

So to address this issue I propose the attached patch which shifts the
resposibility for announcing the required dpb_size to the decoder modules. I
have not yet tested all decoders with this patch applied, but all I tested
(libmpeg2, avcoded for mpeg2 and h264, omxil) seemed fine.

Does anyone else see issues with this approach?


Julian Scheel (1):
  decoder: Let decoder modules set dpb size.

 include/vlc_codec.h      |  1 +
 modules/codec/libmpeg2.c |  1 +
 src/input/decoder.c      | 19 +------------------
 3 files changed, 3 insertions(+), 18 deletions(-)


More information about the vlc-devel mailing list