[vlc-devel] [RFC 1/1] decoder: Let decoder modules set dpb size.

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


As many decoder modules do manage their dpb completely internal and do not
benefit from a picture buffer large enough to hold the dpb in VLC itself, let
the decoders decide about the required dpb size.
As of now the only decoder utilizing the dpb through the VLC picture_buffer is
libmpeg2, which is adapted to announce it's actual dpb size.

Signed-off-by: Julian Scheel <julian at jusst.de>
---
 include/vlc_codec.h      |  1 +
 modules/codec/libmpeg2.c |  1 +
 src/input/decoder.c      | 19 +------------------
 3 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index 1e7c8a6..75c7011 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -102,6 +102,7 @@ struct decoder_t
     void            (*pf_picture_link)   ( decoder_t *, picture_t * );
     void            (*pf_picture_unlink) ( decoder_t *, picture_t * );
 
+    int             i_dpb_picture_buffers;
     /**
      * Number of extra (ie in addition to the DPB) picture buffers
      * needed for decoding.
diff --git a/modules/codec/libmpeg2.c b/modules/codec/libmpeg2.c
index 928c8aa..64a4ce7 100644
--- a/modules/codec/libmpeg2.c
+++ b/modules/codec/libmpeg2.c
@@ -243,6 +243,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     p_dec->pf_decode_video = DecodeBlock;
     p_dec->fmt_out.i_cat = VIDEO_ES;
     p_dec->fmt_out.i_codec = 0;
+    p_dec->i_dpb_picture_buffers = DPB_COUNT;
 
     return VLC_SUCCESS;
 }
diff --git a/src/input/decoder.c b/src/input/decoder.c
index d2e6fb3..05eeca4 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -2363,26 +2363,9 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
         p_owner->p_vout = NULL;
         vlc_mutex_unlock( &p_owner->lock );
 
-        unsigned dpb_size;
-        switch( p_dec->fmt_in.i_codec )
-        {
-        case VLC_CODEC_H264:
-        case VLC_CODEC_DIRAC: /* FIXME valid ? */
-            dpb_size = 18;
-            break;
-        case VLC_CODEC_VP5:
-        case VLC_CODEC_VP6:
-        case VLC_CODEC_VP6F:
-        case VLC_CODEC_VP8:
-            dpb_size = 3;
-            break;
-        default:
-            dpb_size = 2;
-            break;
-        }
         p_vout = input_resource_RequestVout( p_owner->p_resource,
                                              p_vout, &fmt,
-                                             dpb_size +
+                                             p_dec->i_dpb_picture_buffers +
                                              p_dec->i_extra_picture_buffers +
                                              1 + DECODER_MAX_BUFFERING_COUNT,
                                              true );
-- 
1.8.3.4




More information about the vlc-devel mailing list