[vlc-devel] [PATCH 1/2] First release of blt module

Francesco, Cuzzocrea francesco at bltitalia.com
Tue Aug 8 11:33:13 CEST 2017


after Denis-Courmont suggested me to propose separate patches and 
separate modules, I started

modify my code in order to have a demux first, and then (if necessary 
and approved) a codec (of

course without hijacking existing jpeg2000 one).  I haven't figured out 
how t send correctly the block

containing jpeg2000 codestream.  I setup  the video track as ( I 
inserted constant values) :

    es_format_t fmtv;
     vlc_fourcc_t chroma = VLC_CODEC_JPEG2000;

     p_tkv->b_eof = false;
     p_tkv->b_activated = true;
     p_tkv->i_rate =  25;
     p_tkv->i_scale = 1;
     p_tkv->i_samplesize = -1;
     p_tkv->cframe = -1;

     p_tkv->i_cat = VIDEO_ES;
     es_format_Init(&fmtv, VIDEO_ES, chroma);

     fmtv.video.i_width = 720;
     fmtv.video.i_height = 576;
     fmtv.video.i_visible_width = 720;
     fmtv.video.i_visible_height = 576;
     fmtv.video.i_bits_per_pixel = 16;
     fmtv.video.i_frame_rate = 25.0;
     fmtv.video.i_frame_rate_base = p_tkv->i_scale;
     fmtv.b_packetized = false;

     fmtv.video.i_sar_num = 1;
     fmtv.video.i_sar_den = 1;
     fmtv.video.space = COLOR_SPACE_BT709;
     fmtv.video.transfer = TRANSFER_FUNC_BT709;
     fmtv.video.primaries = COLOR_PRIMARIES_BT709;
      p_tkv->i_dv_audio_rate = 0;
     p_tkv->p_es = es_out_Add(dm->out, &fmtv);
     TAB_APPEND(sys->i_track, sys->pp_track, p_tkv);

Then in the Blt_demux_seekable routine, I read the codestream, then 
evaluate the size (variable blsize) and

allocate a block, fill the p_start buffer with read codestream

    block_t *p_frame = NULL;

                 p_frame = block_Alloc(blsize); // blsize is evaluated 
from stream

&p_sys->p_rd_buff[bl_offs],luma0_sz ); // Copy codestream

                p_frame->i_flags = BLOCK_FLAG_SINGLE_FIELD;

                 p_frame->i_pts = p_sys->i_time;
                 p_frame->i_dts = p_sys->i_time + 1;
                p_frame->i_length = 40000;
                es_out_Send(p_demux->out, p_ctk->p_es, p_frame);

I checked that size is correct and that memcpy really insert start of 
codestream ( FF 4F FF 51 00 2F)

in p_frame->p_start.  But when I attempt to play result is a black 
screen with messages

[jpeg2000@ <address>] Invalid len  <number> left = <number>


[jpeg2000@ <address>] Unsupported marker

Like if at some points codestream is corrupted.  The same code works if 
I decode with my codec

the same block using libavcodec.  Any suggestion ?

On 04/08/2017 20.45, Rémi Denis-Courmont wrote:
> Le perjantaina 4. elokuuta 2017, 18.20.32 EEST Francesco, Cuzzocrea a écrit :
>> Sorry but I'm new to submitting a patch (this is the first I done...).
>> Please can you explain what did you mean with "separate demux and codec" ?
>> I made two separate files. Did you mean to make two different patches (one
>> for introducing demux and one for introducing codec) ?
> I mean separate patches and separate modules.
>> I wrote the codec (that use the libavcodec too ) because one of our most
>> used blt format foresee two separate  codestreams,  one for luma and one for
>> the two components of chroma, so not always we have merged components.
> If it´s not normal JPEG 2000, then you can´t hijack the existing JPEG 2000
> codec identifier for the purpose. That would conflict with existing uses.
>> Regarding chroma conversion, sorry, but I haven't figured out how to use
>> the filters for doing it.
> Just output the I422, YUYV or UYVY, whichever is simplest, without conversion.
> Core will automatically insert conversion filters if necessary.

*    Ing. Francesco  Cuzzocrea
*    company:    BLT Italia srl        web:  http://www.blt.it
*    address:    via Rosselli, 91     city:  Lido di CAMAIORE
*    country:    ITALY                 zip:  55043-i
*      Tel. :    +39 0584 904788       Fax:  +39 0584 904789
*     e-mail:   francesco at bltitalia.com
-- BLT will be at IBC (15~19 September 2017) - Hall 8, Stand 8.A69 --

More information about the vlc-devel mailing list