<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi,</p>
    <p>You recently fixed vout_DisableWindow to not release the decoder
      device on failure. Thanks to this patch, the NVDEC decoder can now
      correctly fallback to a non-opaque chroma (CPU buffer) if the
      video initialization using an opaque chroma fails.</p>
    <p><tt>    for (chroma_idx = 0; output_chromas[chroma_idx] != 0;
        chroma_idx++)</tt><tt><br>
      </tt><tt>    {</tt><tt><br>
      </tt><tt>        p_dec->fmt_out.i_codec =
        p_dec->fmt_out.video.i_chroma = output_chromas[chroma_idx];</tt><tt><br>
      </tt><tt>        result = decoder_UpdateVideoOutput(p_dec,
        p_sys->vctx_out);</tt><tt><br>
      </tt><tt>        if (result == VLC_SUCCESS)</tt><tt><br>
      </tt><tt>        {</tt><tt><br>
      </tt><tt>            msg_Dbg(p_dec, "using chroma %4.4s",
        (char*)&p_dec->fmt_out.video.i_chroma);</tt><tt><br>
      </tt><tt>            break;</tt><tt><br>
      </tt><tt>        }</tt><tt><br>
      </tt><tt>        msg_Warn(p_dec, "Failed to use output chroma
        %4.4s", (char*)&p_dec->fmt_out.video.i_chroma);</tt><tt><br>
      </tt><tt>    }</tt></p>
    <p>Previously, only the first chroma of the output_chromas array
      could succeed due to the vout_DisableWindow bug.</p>
    <p>It seems to me the GPU to CPU video filter (chroma.c file in the
      same directory as nvdec.c) is now useless: the decoder can already
      output either CPU or GPU buffers. Worse than than, its very
      existence degrades performance in the case where a CPU buffer is
      used as output.<br>
    </p>
    <p>Currently, even if the pipeline requires a CPU buffer as output,
      the decoder will output GPU buffers and the GPU-to-CPU video
      filter will be used: 1 GPU to GPU (decoder) + 1 GPU to CPU
      (filter) copies are made. <br>
    </p>
    <p>Disabling the video filter, the behavior becomes: the first call
      to decoder_UpdateVideoOutput fails, then the decoder retries with
      a non-opaque chroma and succeeds. In this configuration, only 1
      GPU to CPU copy is performed by the decoder. The pipeline
      performance is objectively better (1 less GPU-GPU copy), but a lot
      of error logs are printed out during the first attempt by the
      decoder to use opaque chromas.<br>
    </p>
    <ol>
      <li>Do you see any reason to keep the GPU-to-CPU video filter ?</li>
      <li>I think a --nvdec-prefer-opaque/--no-nvdec-prefer-opaque could
        be a good addition if one knows in advance which chroma type
        will be used. This would avoid the wall of error logs in certain
        circumstances. What do you think ?<br>
      </li>
    </ol>
    <p><br>
    </p>
  </body>
</html>