mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-19 09:02:26 +02:00
lavc/hevc_ps: make PPS hold a reference to its SPS
PPS depends on, and is parsed for, specific SPS data. This will be useful in following commits.
This commit is contained in:
parent
e12fd62d1d
commit
c879165b39
@ -625,8 +625,8 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb)
|
|||||||
if (s->nal_unit_type == HEVC_NAL_CRA_NUT && s->last_eos == 1)
|
if (s->nal_unit_type == HEVC_NAL_CRA_NUT && s->last_eos == 1)
|
||||||
sh->no_output_of_prior_pics_flag = 1;
|
sh->no_output_of_prior_pics_flag = 1;
|
||||||
|
|
||||||
if (s->ps.sps != s->ps.sps_list[s->ps.pps->sps_id]) {
|
if (s->ps.sps != s->ps.pps->sps) {
|
||||||
const HEVCSPS *sps = s->ps.sps_list[s->ps.pps->sps_id];
|
const HEVCSPS *sps = s->ps.pps->sps;
|
||||||
enum AVPixelFormat pix_fmt;
|
enum AVPixelFormat pix_fmt;
|
||||||
|
|
||||||
ff_hevc_clear_refs(s);
|
ff_hevc_clear_refs(s);
|
||||||
|
@ -80,12 +80,8 @@ static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal,
|
|||||||
}
|
}
|
||||||
ps->pps = ps->pps_list[pps_id];
|
ps->pps = ps->pps_list[pps_id];
|
||||||
|
|
||||||
if (ps->pps->sps_id >= HEVC_MAX_SPS_COUNT || !ps->sps_list[ps->pps->sps_id]) {
|
if (ps->sps != ps->pps->sps) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", ps->pps->sps_id);
|
ps->sps = ps->pps->sps;
|
||||||
return AVERROR_INVALIDDATA;
|
|
||||||
}
|
|
||||||
if (ps->sps != ps->sps_list[ps->pps->sps_id]) {
|
|
||||||
ps->sps = ps->sps_list[ps->pps->sps_id];
|
|
||||||
ps->vps = ps->vps_list[ps->sps->vps_id];
|
ps->vps = ps->vps_list[ps->sps->vps_id];
|
||||||
}
|
}
|
||||||
ow = &ps->sps->output_window;
|
ow = &ps->sps->output_window;
|
||||||
|
@ -1363,6 +1363,8 @@ static void hevc_pps_free(FFRefStructOpaque unused, void *obj)
|
|||||||
{
|
{
|
||||||
HEVCPPS *pps = obj;
|
HEVCPPS *pps = obj;
|
||||||
|
|
||||||
|
ff_refstruct_unref(&pps->sps);
|
||||||
|
|
||||||
av_freep(&pps->column_width);
|
av_freep(&pps->column_width);
|
||||||
av_freep(&pps->row_height);
|
av_freep(&pps->row_height);
|
||||||
av_freep(&pps->col_bd);
|
av_freep(&pps->col_bd);
|
||||||
@ -1828,6 +1830,8 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
|
|||||||
sps = ps->sps_list[pps->sps_id];
|
sps = ps->sps_list[pps->sps_id];
|
||||||
vps = ps->vps_list[sps->vps_id];
|
vps = ps->vps_list[sps->vps_id];
|
||||||
|
|
||||||
|
pps->sps = ff_refstruct_ref_c(sps);
|
||||||
|
|
||||||
pps->dependent_slice_segments_enabled_flag = get_bits1(gb);
|
pps->dependent_slice_segments_enabled_flag = get_bits1(gb);
|
||||||
pps->output_flag_present_flag = get_bits1(gb);
|
pps->output_flag_present_flag = get_bits1(gb);
|
||||||
pps->num_extra_slice_header_bits = get_bits(gb, 3);
|
pps->num_extra_slice_header_bits = get_bits(gb, 3);
|
||||||
|
@ -437,6 +437,8 @@ typedef struct HEVCPPS {
|
|||||||
|
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
int data_size;
|
int data_size;
|
||||||
|
|
||||||
|
const HEVCSPS *sps; ///< RefStruct reference
|
||||||
} HEVCPPS;
|
} HEVCPPS;
|
||||||
|
|
||||||
typedef struct HEVCParamSets {
|
typedef struct HEVCParamSets {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user