mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-23 11:19:55 +00:00
h264dec: do not export the chroma sample location immediately on parsing the SPS
This SPS is not necessarily the one that will be used. Export the chroma location along with all the other SPS properties.
This commit is contained in:
parent
bdd31feec9
commit
6eae7e5644
@ -181,9 +181,10 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx
|
|||||||
/* chroma_location_info_present_flag */
|
/* chroma_location_info_present_flag */
|
||||||
if (get_bits1(gb)) {
|
if (get_bits1(gb)) {
|
||||||
/* chroma_sample_location_type_top_field */
|
/* chroma_sample_location_type_top_field */
|
||||||
avctx->chroma_sample_location = get_ue_golomb(gb) + 1;
|
sps->chroma_location = get_ue_golomb(gb) + 1;
|
||||||
get_ue_golomb(gb); /* chroma_sample_location_type_bottom_field */
|
get_ue_golomb(gb); /* chroma_sample_location_type_bottom_field */
|
||||||
}
|
} else
|
||||||
|
sps->chroma_location = AVCHROMA_LOC_LEFT;
|
||||||
|
|
||||||
if (show_bits1(gb) && get_bits_left(gb) < 10) {
|
if (show_bits1(gb) && get_bits_left(gb) < 10) {
|
||||||
av_log(avctx, AV_LOG_WARNING, "Truncated VUI (%d)\n", get_bits_left(gb));
|
av_log(avctx, AV_LOG_WARNING, "Truncated VUI (%d)\n", get_bits_left(gb));
|
||||||
|
@ -77,6 +77,8 @@ typedef struct SPS {
|
|||||||
enum AVColorPrimaries color_primaries;
|
enum AVColorPrimaries color_primaries;
|
||||||
enum AVColorTransferCharacteristic color_trc;
|
enum AVColorTransferCharacteristic color_trc;
|
||||||
enum AVColorSpace colorspace;
|
enum AVColorSpace colorspace;
|
||||||
|
enum AVChromaLocation chroma_location;
|
||||||
|
|
||||||
int timing_info_present_flag;
|
int timing_info_present_flag;
|
||||||
uint32_t num_units_in_tick;
|
uint32_t num_units_in_tick;
|
||||||
uint32_t time_scale;
|
uint32_t time_scale;
|
||||||
|
@ -1086,6 +1086,7 @@ static int h264_init_ps(H264Context *h, const H264SliceContext *sl, int first_sl
|
|||||||
h->avctx->color_trc = h->sei.alternative_transfer.preferred_transfer_characteristics;
|
h->avctx->color_trc = h->sei.alternative_transfer.preferred_transfer_characteristics;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
h->avctx->chroma_sample_location = sps->chroma_location;
|
||||||
|
|
||||||
if (!h->context_initialized || must_reinit || needs_reinit) {
|
if (!h->context_initialized || must_reinit || needs_reinit) {
|
||||||
int flush_changes = h->context_initialized;
|
int flush_changes = h->context_initialized;
|
||||||
|
@ -325,8 +325,6 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h)
|
|||||||
|
|
||||||
ff_h264_sei_uninit(&h->sei);
|
ff_h264_sei_uninit(&h->sei);
|
||||||
|
|
||||||
avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
|
|
||||||
|
|
||||||
h->nb_slice_ctx = (avctx->active_thread_type & FF_THREAD_SLICE) ? avctx->thread_count : 1;
|
h->nb_slice_ctx = (avctx->active_thread_type & FF_THREAD_SLICE) ? avctx->thread_count : 1;
|
||||||
h->slice_ctx = av_mallocz_array(h->nb_slice_ctx, sizeof(*h->slice_ctx));
|
h->slice_ctx = av_mallocz_array(h->nb_slice_ctx, sizeof(*h->slice_ctx));
|
||||||
if (!h->slice_ctx) {
|
if (!h->slice_ctx) {
|
||||||
|
Loading…
Reference in New Issue
Block a user