[FFmpeg-devel] [PATCH] libavformat/dnxhddec added support for raw 444 and dnxhr formats

Christophe Gisquet christophe.gisquet at gmail.com
Mon Feb 8 08:15:05 CET 2016


Hi,

2016-02-08 2:31 GMT+01:00 Mark Reid <mindmark at gmail.com>:

> +static int dnxhd_is_prefix(uint64_t prefix)
> +{
> +  if (prefix == DNXHD_HEADER_PREFIX    ||
> +      prefix == DNXHD_HEADER_PREFIX444 ||
> +      prefix == DNXHD_HEADER_PREFIXHR1 ||
> +      prefix == DNXHD_HEADER_PREFIXHR2)
> +      return 1;
> +  return 0;
> +}
> +
>  static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
>                                  const uint8_t *buf, int buf_size)
>  {
> @@ -47,7 +60,7 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
>      if (!pic_found) {
>          for (i = 0; i < buf_size; i++) {
>              state = (state << 8) | buf[i];
> -            if ((state & 0xffffffffff00LL) == DNXHD_HEADER_PREFIX) {
> +            if (dnxhd_is_prefix(state & 0xffffffffff00LL)) {

OK.

>  static int dnxhd_probe(AVProbeData *p)
>  {
> -    static const uint8_t header[] = {0x00,0x00,0x02,0x80,0x01};
> +    static const uint8_t header_prefix[]    = { 0x00, 0x00, 0x02, 0x80, 0x01 };
> +    static const uint8_t header_prefix444[] = { 0x00, 0x00, 0x02, 0x80, 0x02 };
> +    static const uint8_t header_prefixhr1[] = { 0x00, 0x00, 0x02, 0x80, 0x03 };
> +    static const uint8_t header_prefixhr2[] = { 0x00, 0x00, 0x03, 0x8C, 0x03 };
> +
>      int w, h, compression_id;
>      if (p->buf_size < 0x2c)
>          return 0;
> -    if (memcmp(p->buf, header, 5))
> +    if (memcmp(p->buf, header_prefix,    5) &&
> +        memcmp(p->buf, header_prefix444, 5) &&
> +        memcmp(p->buf, header_prefixhr1, 5) &&
> +        memcmp(p->buf, header_prefixhr2, 5))

At this point, I'd say the encoder would better use that prefix.
That's what the attached patch does (rebased but not tested). You may
consider building on top of it for that purpose.

Best regards,
-- 
Christophe


More information about the ffmpeg-devel mailing list