[Ffmpeg-devel] [RFC] D10 IMX patch encoding

Baptiste Coudurier baptiste.coudurier
Sat Mar 3 20:44:36 CET 2007


Hi

Michael Niedermayer wrote:
> Hi
> 
> On Sat, Mar 03, 2007 at 02:48:48PM +0100, Baptiste Coudurier wrote:
>> Hi
>>
>> Michael Niedermayer wrote:
>>> Hi
>>>
>>> On Wed, Jan 24, 2007 at 05:42:50PM +0100, Baptiste Coudurier wrote:
>>>> Hi
>>>>
>>>> This patch add features to be able to encode D10 streams (SMPTE 356M,
>>>> also known as IMX)
>>>>
>>>> Current rc code cannot support non linear quant, therefore, I workaround
>>>> mpeg2 quantizer to be able to put 1 as q_scale_type in bitstream,
>>>> meaning that qmax > 4 is not supported (yes, that's stupid but
>>>> q_scale_type 0 is forbidden in D10, and bitrate is either 30/40/50 Mb/s)
>>> i dont like the qmax > 4 limit, and the qscale encoding has nothing to do
>>> with the RC code, snow uses a logarithmic qscale and that works too
>> I followed your instructions, qmax > 12 now, and use a inv table.
>>
>>>> Add support for one mb per slice.
>>> setting the rtp packet size (or whatever the field in AVCodecContext was 
>>> called) to 1 should have that effect too with no other code changes 
>> Indeed.
>>
>>>> Add IMX bitstream filter to mux D10 stream into mov, and workaround to
>>>> set acceptable width/height by Final Cut, only PAL was tested. (coded
>>>> height is 608, while display height must be 576)
>> I split patch in 3, see attached.
> 
> [non linear q patch]
> 
> ok
> 
> 
> [R/WB24 patch]
> 
> ok
> 
> [...]
>>  /* memory */
>> Index: libavcodec/mpeg12.c
>> ===================================================================
>> --- libavcodec/mpeg12.c	(revision 8202)
>> +++ libavcodec/mpeg12.c	(working copy)
>> @@ -3512,6 +3522,40 @@
>>  };
>>  #endif /* !CONFIG_MPEGVIDEO_PARSER */
>>  
>> +
>> +static int imx_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
>> +                           uint8_t **poutbuf, int *poutbuf_size,
>> +                           const uint8_t *buf, int buf_size, int keyframe)
>> +{
>> +    /* MXF essence element key */
>> +    uint8_t imx_header[16] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x05,0x01,0x01,0x00 };
> 
> static const
> 
> 
> [...]
> 
>> +    *poutbuf_size = 0;
> 
> useless
> 
> 
>> +    *poutbuf = av_malloc(buf_size + 20 + FF_INPUT_BUFFER_PADDING_SIZE);
>> +    poutbufp = *poutbuf;
>> +    memcpy(poutbufp, imx_header, 16);
>> +    poutbufp += 16;
>> +    *poutbufp++ = 0x83; /* KLV BER long form */
>> +    AV_WB24(poutbufp, buf_size);
>> +    poutbufp += 3;
>> +    memcpy(poutbufp, buf, buf_size);
>> +    poutbufp += buf_size;
>> +    *poutbuf_size = poutbufp - *poutbuf;
> 
> these could be done cleaner with the bytestream stuff but iam fine
> with the above too ...
> 

Hummmmmmm, last time:
"id prefer if you use the bitstream stuff for the 3 lines"

I was using bytestream stuff, sometimes I feel like a stupid sheep.
I'll then reuse the code I posted last time, which is cleaner, ok ?

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312




More information about the ffmpeg-devel mailing list