Commit 95536898 authored by Kieran Kunhya's avatar Kieran Kunhya Committed by Rostislav Pehlivanov

diracdec: Move strides to bytes, and pointer types to uint8_t.

Start templating functions for move to support 10-bit
Parts of this patch were written by Rostislav Pehlivanov
parent bd3409f5
...@@ -118,7 +118,7 @@ static const enum AVPixelFormat dirac_pix_fmt[2][3] = { ...@@ -118,7 +118,7 @@ static const enum AVPixelFormat dirac_pix_fmt[2][3] = {
/* [DIRAC_STD] 10.3 Parse Source Parameters. /* [DIRAC_STD] 10.3 Parse Source Parameters.
* source_parameters(base_video_format) */ * source_parameters(base_video_format) */
static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb, static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb,
dirac_source_params *source) dirac_source_params *source, int *bit_depth)
{ {
AVRational frame_rate = { 0, 0 }; AVRational frame_rate = { 0, 0 };
unsigned luma_depth = 8, luma_offset = 16; unsigned luma_depth = 8, luma_offset = 16;
...@@ -239,6 +239,9 @@ static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb, ...@@ -239,6 +239,9 @@ static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb,
if (luma_depth > 8) if (luma_depth > 8)
av_log(avctx, AV_LOG_WARNING, "Bitdepth greater than 8\n"); av_log(avctx, AV_LOG_WARNING, "Bitdepth greater than 8\n");
*bit_depth = luma_depth;
avctx->pix_fmt = dirac_pix_fmt[!luma_offset][source->chroma_format]; avctx->pix_fmt = dirac_pix_fmt[!luma_offset][source->chroma_format];
avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_x_shift, &chroma_y_shift); avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_x_shift, &chroma_y_shift);
if ((source->width % (1<<chroma_x_shift)) || (source->height % (1<<chroma_y_shift))) { if ((source->width % (1<<chroma_x_shift)) || (source->height % (1<<chroma_y_shift))) {
...@@ -290,7 +293,8 @@ static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb, ...@@ -290,7 +293,8 @@ static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb,
/* [DIRAC_STD] 10. Sequence Header. sequence_header() */ /* [DIRAC_STD] 10. Sequence Header. sequence_header() */
int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb, int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
dirac_source_params *source) dirac_source_params *source,
int *bit_depth)
{ {
unsigned version_major; unsigned version_major;
unsigned video_format, picture_coding_mode; unsigned video_format, picture_coding_mode;
...@@ -318,7 +322,7 @@ int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb, ...@@ -318,7 +322,7 @@ int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
/* [DIRAC_STD] 10.3 Source Parameters /* [DIRAC_STD] 10.3 Source Parameters
* Override the defaults. */ * Override the defaults. */
if (ret = parse_source_parameters(avctx, gb, source)) if (ret = parse_source_parameters(avctx, gb, source, bit_depth))
return ret; return ret;
ret = ff_set_dimensions(avctx, source->width, source->height); ret = ff_set_dimensions(avctx, source->width, source->height);
......
...@@ -55,6 +55,7 @@ typedef struct dirac_source_params { ...@@ -55,6 +55,7 @@ typedef struct dirac_source_params {
} dirac_source_params; } dirac_source_params;
int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb, int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
dirac_source_params *source); dirac_source_params *source,
int *bit_depth);
#endif /* AVCODEC_DIRAC_H */ #endif /* AVCODEC_DIRAC_H */
This diff is collapsed.
...@@ -31,7 +31,7 @@ static int dirac_header(AVFormatContext *s, int idx) ...@@ -31,7 +31,7 @@ static int dirac_header(AVFormatContext *s, int idx)
AVStream *st = s->streams[idx]; AVStream *st = s->streams[idx];
dirac_source_params source; dirac_source_params source;
GetBitContext gb; GetBitContext gb;
int ret; int ret, bit_depth;
// already parsed the header // already parsed the header
if (st->codec->codec_id == AV_CODEC_ID_DIRAC) if (st->codec->codec_id == AV_CODEC_ID_DIRAC)
...@@ -41,7 +41,7 @@ static int dirac_header(AVFormatContext *s, int idx) ...@@ -41,7 +41,7 @@ static int dirac_header(AVFormatContext *s, int idx)
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = avpriv_dirac_parse_sequence_header(st->codec, &gb, &source); ret = avpriv_dirac_parse_sequence_header(st->codec, &gb, &source, &bit_depth);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment