[FFmpeg-devel] [PATCH v3] libavcodec/dnxhd_parser: add parser and probe support raw 444 and dnxhr formats

Michael Niedermayer michael at niedermayer.cc
Sun Feb 14 02:37:26 CET 2016


On Sat, Feb 13, 2016 at 04:35:24PM -0800, Mark Reid wrote:
> ---
>  libavcodec/dnxhd_parser.c |  7 +++----
>  libavcodec/dnxhddata.c    |  8 ++++++++
>  libavcodec/dnxhddata.h    | 18 +++++++++++++++++-
>  libavcodec/dnxhddec.c     | 12 ++++--------
>  libavformat/dnxhddec.c    |  7 ++++---
>  5 files changed, 36 insertions(+), 16 deletions(-)
> 
> diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
> index fffb98f..033b8ee 100644
> --- a/libavcodec/dnxhd_parser.c
> +++ b/libavcodec/dnxhd_parser.c
> @@ -25,8 +25,7 @@
>   */
>  
>  #include "parser.h"
> -
> -#define DNXHD_HEADER_PREFIX 0x000002800100
> +#include "dnxhddata.h"
>  
>  typedef struct {
>      ParseContext pc;
> @@ -47,7 +46,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 (ff_dnxhd_check_header_prefix(state & 0xffffffffff00LL) != 0) {
>                  i++;
>                  pic_found = 1;
>                  interlaced = (state&2)>>1; /* byte following the 5-byte header prefix */
> @@ -62,7 +61,7 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
>              return 0;
>          for (; i < buf_size; i++) {
>              state = (state << 8) | buf[i];
> -            if ((state & 0xffffffffff00LL) == DNXHD_HEADER_PREFIX) {
> +            if (ff_dnxhd_check_header_prefix(state & 0xffffffffff00LL) != 0) {
>                  if (!interlaced || dctx->cur_field) {
>                      pc->frame_start_found = 0;
>                      pc->state64 = -1;
> diff --git a/libavcodec/dnxhddata.c b/libavcodec/dnxhddata.c
> index 82fbfdf..6955fd0 100644
> --- a/libavcodec/dnxhddata.c
> +++ b/libavcodec/dnxhddata.c
> @@ -22,6 +22,7 @@
>  #include "avcodec.h"
>  #include "dnxhddata.h"
>  #include "libavutil/common.h"
> +#include "libavutil/intreadwrite.h"
>  
>  /* The quantization tables below are in zigzag order! */
>  
> @@ -1102,6 +1103,13 @@ int avpriv_dnxhd_get_interlaced(int cid)
>      return ff_dnxhd_cid_table[i].flags & DNXHD_INTERLACED ? 1 : 0;
>  }
>  
> +uint64_t avpriv_dnxhd_parse_header_prefix(const uint8_t *buf)
> +{
> +  uint64_t prefix = AV_RB32(buf);
> +  prefix = (prefix << 16) | buf[4] << 8;
> +  return ff_dnxhd_check_header_prefix(prefix);
> +}
> +

[...]

> +static av_always_inline uint64_t ff_dnxhd_check_header_prefix(uint64_t prefix)
> +{
> +  if (prefix == DNXHD_HEADER_INITIAL ||
> +      prefix == DNXHD_HEADER_444     ||
> +      prefix == DNXHD_HEADER_HR1     ||
> +      prefix == DNXHD_HEADER_HR2)
> +    return prefix;
> +  return 0;
> +}

the indention depth is inconsistent with the existing code

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

Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160214/5d4bd8c2/attachment.sig>


More information about the ffmpeg-devel mailing list