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

Michael Niedermayer michaelni
Sat Mar 3 20:26:21 CET 2007


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 ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070303/63070add/attachment.pgp>



More information about the ffmpeg-devel mailing list