<sect1> <title> Decoder configuration </title>
<para>
-The input thread spawns the appropriate decoders [the relation is
-currently hard-wired in <filename>src/input/input_programs.c</filename>].
-It then launches <function> *_CreateThread()</function>, with either
-an <type>adec_config_t</type> (audio) or an <type> vdec_config_t</type>
-(video) structure, described in <filename> include/input_ext-dec.h</filename>.
+The input thread spawns the appropriate decoder modules from <filename>
+src/input/input_dec.c</filename>. The <function>Dec_CreateThread</function>
+function selects the more accurate decoder module. Each decoder module
+looks at decoder_config.i_type and returns a score [ see the modules
+section ]. It then launches <function> module.pf_run()</function>,
+with a <type>decoder_config_t</type>, described in <filename>
+include/input_ext-dec.h</filename>.
</para>
<para>
-It contains some parameters relative to the output thread, which will
-be described in the following chapters, and a generic <type>
-decoder_config_t</type>, which gives the decoder the ES ID and type, and
-pointers to a <type> stream_control_t </type> structure (gives
-information on the play status), a <type> decoder_fifo_t </type>
-and <parameter> pf_init_bit_stream</parameter>, which will be
+The generic <type>decoder_config_t</type> structure, gives the decoder
+the ES ID and type, and pointers to a <type> stream_control_t </type>
+structure (gives information on the play status), a <type> decoder_fifo_t
+</type> and <parameter> pf_init_bit_stream</parameter>, which will be
described in the next two sections.
</para>
<mediaobject>
<imageobject>
- <imagedata fileref="ps.eps" format="EPS" scalefit="1" scale="95" />
+ <imagedata fileref="ps.png" format="PNG" scalefit="1" scale="95" />
</imageobject>
<imageobject>
<imagedata fileref="ps.gif" format="GIF" />
<mediaobject>
<imageobject>
- <imagedata fileref="ts.eps" format="EPS" scalefit="1" scale="95" />
+ <imagedata fileref="ts.png" format="PNG" scalefit="1" scale="95" />
</imageobject>
<imageobject>
<imagedata fileref="ts.gif" format="GIF" />
<para>
VLC already features an MPEG layer 1 and 2 audio decoder, an MPEG MP@ML
video decoder, an AC3 decoder (borrowed from LiViD), a DVD SPU decoder,
-and an LPCM decoder [not functional yet]. You can write your own
-decoder, just mimic the video parser.
+and an LPCM decoder. You can write your own decoder, just mimic the
+video parser.
</para>
<note> <title> Limitations in the current design </title>
<para>
-Currently, decoders are not "plug-ins", that is they are not dynamically
-loadable. The way the input chooses a decoder is also not final - it
-is hard-wired in <filename> src/input/input_programs.c</filename>.
+To add a new decoder, you'll still have to add the stream type as there's
+still a a hard-wired piece of code in <filename> src/input/input_programs.c
+</filename>.
</para> </note>
<para>
<sect1> <title> The MPEG video decoder </title>
<para>
-VideoLAN Client provides an MPEG-1, and an MPEG-2 Main Profile @
+VLC media player provides an MPEG-1, and an MPEG-2 Main Profile @
Main Level decoder. It has been natively written for VLC, and is quite
mature. Its status is a bit special, since it is splitted between two
-modules : video parser and video decoder [this is subject to change].
+logicial entities : video parser and video decoder.
The initial goal is to separate bit stream parsing functions from
highly parallelizable mathematical algorithms. In theory, there can be
one video parser thread (and only one, otherwise we would have race
-conditions reading the bit stream), along with several video decoder
+conditions reading the bit stream), along with a pool of video decoder
threads, which do IDCT and motion compensation on several blocks
-at once [practically,
-multi-threaded mode hasn't been tested for a while, still needs some
-work, and was actually slower than mono-threaded mode ; the
-multi-threaded mode won't be documented for the moment].
+at once.
</para>
<para>
<para>
Just like motion compensation, IDCT is platform-specific. So we moved it
-to <filename> plugins/idct</filename>. You need to define four methods :
+to <filename> plugins/idct</filename>. This module does the IDCT
+calculation, and copies the data to the final picture. You need to define
+seven methods :
</para>
<itemizedlist>
<listitem> <para> <function> vdec_IDCT </function> <parameter>
- ( vdec_thread_t * p_vdec, dctelem_t * p_block, int ) </parameter> :
+ ( decoder_config_t * p_config, dctelem_t * p_block, int )
+ </parameter> :
Does the complete 2-D IDCT. 64 coefficients are in <parameter>
p_block</parameter>.
</para> </listitem>
some IDCT (MMX) need to invert certain coefficients in the
MPEG scan matrices (see ISO/IEC 13818-2).
</para> </listitem>
+
+ <listitem> <para> <function> vdec_InitDecode </function>
+ <parameter> ( struct vdec_thread_s * p_vdec ) </parameter> :
+ Initializes the IDCT and optional crop tables.
+ </para> </listitem>
+
+ <listitem> <para> <function> vdec_DecodeMacroblockC </function>
+ <parameter> ( struct vdec_thread_s *p_vdec,
+ struct macroblock_s * p_mb ); </parameter> :
+ Decodes an entire macroblock and copies its data to the final
+ picture, including chromatic information.
+ </para> </listitem>
+
+ <listitem> <para> <function> vdec_DecodeMacroblockBW </function>
+ <parameter> ( struct vdec_thread_s *p_vdec,
+ struct macroblock_s * p_mb ); </parameter> :
+ Decodes an entire macroblock and copies its data to the final
+ picture, except chromatic information (used in grayscale mode).
+ </para> </listitem>
</itemizedlist>
<para>
(<filename>idctclassic.c</filename>).
</para>
+ </sect2>
+
+ <sect2> <title> Symmetrical Multiprocessing </title>
+
+ <para>
+The MPEG video decoder of VLC can take advantage of several processors if
+necessary. The idea is to launch a pool of decoders, which will do
+IDCT/motion compensation on several macroblocks at once.
+ </para>
+
<para>
-[In the future, the IDCT plug-in will include <function> vdec_AddBlock
-</function> and <function> vdec_CopyBlock </function>, which are
-often architecture-specific.]
+The functions managing the pool are in <filename>
+src/video_decoder/vpar_pool.c</filename>. Its use on non-SMP machines is
+not recommanded, since it is actually slower than the monothread version.
+Even on SMP machines sometimes...
</para>
</sect2>