Skip to content

Commit

Permalink
h264_parser: remove the remaining dependencies on the h264 decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
elenril committed Apr 24, 2016
1 parent 98c9799 commit 72da8d9
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 96 deletions.
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,7 @@ nvenc_h264_encoder_deps="nvenc"
nvenc_hevc_encoder_deps="nvenc"

# parsers
h264_parser_select="h264_decoder"
h264_parser_select="golomb h264dsp"
hevc_parser_select="golomb"
mpegvideo_parser_select="mpegvideo"
mpeg4video_parser_select="error_resilience h263dsp mpegvideo qpeldsp"
Expand Down
3 changes: 2 additions & 1 deletion libavcodec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,8 @@ OBJS-$(CONFIG_FLAC_PARSER) += flac_parser.o flacdata.o flac.o
OBJS-$(CONFIG_GSM_PARSER) += gsm_parser.o
OBJS-$(CONFIG_H261_PARSER) += h261_parser.o
OBJS-$(CONFIG_H263_PARSER) += h263_parser.o
OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264_parse.o h2645_parse.o
OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264_parse.o h2645_parse.o \
h264_ps.o h264_sei.o h264data.o
OBJS-$(CONFIG_HEVC_PARSER) += hevc_parser.o h2645_parse.o hevc_ps.o hevc_data.o
OBJS-$(CONFIG_MJPEG_PARSER) += mjpeg_parser.o
OBJS-$(CONFIG_MLP_PARSER) += mlp_parser.o mlp.o
Expand Down
27 changes: 0 additions & 27 deletions libavcodec/h264.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,33 +753,6 @@ static void flush_dpb(AVCodecContext *avctx)
h->context_initialized = 0;
}

/**
* Compute profile from profile_idc and constraint_set?_flags.
*
* @param sps SPS
*
* @return profile as defined by FF_PROFILE_H264_*
*/
int ff_h264_get_profile(const SPS *sps)
{
int profile = sps->profile_idc;

switch (sps->profile_idc) {
case FF_PROFILE_H264_BASELINE:
// constraint_set1_flag set to 1
profile |= (sps->constraint_set_flags & 1 << 1) ? FF_PROFILE_H264_CONSTRAINED : 0;
break;
case FF_PROFILE_H264_HIGH_10:
case FF_PROFILE_H264_HIGH_422:
case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
// constraint_set3_flag set to 1
profile |= (sps->constraint_set_flags & 1 << 3) ? FF_PROFILE_H264_INTRA : 0;
break;
}

return profile;
}

static int get_last_needed_nal(H264Context *h)
{
int nals_needed = 0;
Expand Down
5 changes: 0 additions & 5 deletions libavcodec/h264.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,11 +663,6 @@ extern const uint16_t ff_h264_mb_sizes[4];
int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
H264ParamSets *ps);

/**
* compute profile from sps
*/
int ff_h264_get_profile(const SPS *sps);

/**
* Decode PPS
*/
Expand Down
27 changes: 27 additions & 0 deletions libavcodec/h264_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,3 +449,30 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps,
}
return 0;
}

/**
* Compute profile from profile_idc and constraint_set?_flags.
*
* @param sps SPS
*
* @return profile as defined by FF_PROFILE_H264_*
*/
int ff_h264_get_profile(const SPS *sps)
{
int profile = sps->profile_idc;

switch (sps->profile_idc) {
case FF_PROFILE_H264_BASELINE:
// constraint_set1_flag set to 1
profile |= (sps->constraint_set_flags & 1 << 1) ? FF_PROFILE_H264_CONSTRAINED : 0;
break;
case FF_PROFILE_H264_HIGH_10:
case FF_PROFILE_H264_HIGH_422:
case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
// constraint_set3_flag set to 1
profile |= (sps->constraint_set_flags & 1 << 3) ? FF_PROFILE_H264_INTRA : 0;
break;
}

return profile;
}
5 changes: 5 additions & 0 deletions libavcodec/h264_parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,9 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, struct H264ParamSets
int *is_avc, int *nal_length_size,
int err_recognition, void *logctx);

/**
* compute profile from sps
*/
int ff_h264_get_profile(const struct SPS *sps);

#endif /* AVCODEC_H264_PARSE_H */
Loading

0 comments on commit 72da8d9

Please sign in to comment.