History

avcodec/hevc_ps: Use RefStruct API for parameter sets

Avoids allocations and error checks for these allocations; e.g. syncing buffers across threads can't fail any more and needn't be checked. It also gets rid of casts and indirections.

Andreas Rheinhardt committed 4 years ago

Commit 2db94a91 parent 787351a8 files · +72 −93Browse files

Unified · Split

8 files
  1. libavcodec/hevc_parser.c +4 −4
  2. libavcodec/hevc_ps.c +34 −46
  3. libavcodec/hevc_ps.h +5 −5
  4. libavcodec/hevc_sei.c +2 −3
  5. libavcodec/hevcdec.c +14 −22
  6. libavcodec/mediacodecdec.c +3 −3
  7. libavcodec/videotoolbox.c +2 −2
  8. libavcodec/vulkan_hevc.c +8 −8
libavcodec/hevc_parser.c+4−4
@@ -77,15 +77,15 @@ static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal, · 76 unmodified lines
7777 av_log(avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", pps_id);
7878 return AVERROR_INVALIDDATA;
7979 }
80− ps->pps = (HEVCPPS*)ps->pps_list[pps_id]->data;
80+ ps->pps = ps->pps_list[pps_id];
8181
8282 if (ps->pps->sps_id >= HEVC_MAX_SPS_COUNT || !ps->sps_list[ps->pps->sps_id]) {
8383 av_log(avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", ps->pps->sps_id);
8484 return AVERROR_INVALIDDATA;
8585 }
86− if (ps->sps != (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data) {
87− ps->sps = (HEVCSPS*)ps->sps_list[ps->pps->sps_id]->data;
88− ps->vps = (HEVCVPS*)ps->vps_list[ps->sps->vps_id]->data;
86+ if (ps->sps != ps->sps_list[ps->pps->sps_id]) {
87+ ps->sps = ps->sps_list[ps->pps->sps_id];
88+ ps->vps = ps->vps_list[ps->sps->vps_id];
8989 }
9090 ow = &ps->sps->output_window;
9191
libavcodec/hevc_ps.c+34−46
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include "h2645_vui.h"
2929 #include "hevc_data.h"
3030 #include "hevc_ps.h"
31+#include "refstruct.h"
3132
3233 static const uint8_t default_scaling_list_intra[] = {
3334 16, 16, 16, 16, 17, 18, 21, 24,
@@ -61,40 +62,40 @@ static const uint8_t hevc_sub_height_c[] = { · 27 unmodified lines
6162
6263 static void remove_pps(HEVCParamSets *s, int id)
6364 {
64− if (s->pps_list[id] && s->pps == (const HEVCPPS*)s->pps_list[id]->data)
65+ if (s->pps == s->pps_list[id])
6566 s->pps = NULL;
66− av_buffer_unref(&s->pps_list[id]);
67+ ff_refstruct_unref(&s->pps_list[id]);
6768 }
6869
6970 static void remove_sps(HEVCParamSets *s, int id)
7071 {
7172 int i;
7273 if (s->sps_list[id]) {
73− if (s->sps == (const HEVCSPS*)s->sps_list[id]->data)
74+ if (s->sps == s->sps_list[id])
7475 s->sps = NULL;
7576
7677 /* drop all PPS that depend on this SPS */
7778 for (i = 0; i < FF_ARRAY_ELEMS(s->pps_list); i++)
78− if (s->pps_list[i] && ((HEVCPPS*)s->pps_list[i]->data)->sps_id == id)
79+ if (s->pps_list[i] && s->pps_list[i]->sps_id == id)
7980 remove_pps(s, i);
8081
81− av_assert0(!(s->sps_list[id] && s->sps == (HEVCSPS*)s->sps_list[id]->data));
82+ av_assert0(!(s->sps_list[id] && s->sps == s->sps_list[id]));
83+ ff_refstruct_unref(&s->sps_list[id]);
8284 }
83− av_buffer_unref(&s->sps_list[id]);
8485 }
8586
8687 static void remove_vps(HEVCParamSets *s, int id)
8788 {
8889 int i;
8990 if (s->vps_list[id]) {
90− if (s->vps == (const HEVCVPS*)s->vps_list[id]->data)
91+ if (s->vps == s->vps_list[id])
9192 s->vps = NULL;
9293
9394 for (i = 0; i < FF_ARRAY_ELEMS(s->sps_list); i++)
94− if (s->sps_list[i] && ((HEVCSPS*)s->sps_list[i]->data)->vps_id == id)
95+ if (s->sps_list[i] && s->sps_list[i]->vps_id == id)
9596 remove_sps(s, i);
97+ ff_refstruct_unref(&s->vps_list[id]);
9698 }
97− av_buffer_unref(&s->vps_list[id]);
9899 }
99100
100101 int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx,
@@ -442,12 +443,10 @@ int ff_hevc_decode_nal_vps(GetBitContext *gb, AVCodecContext *avctx, · 341 unmodified lines
442443 int i,j;
443444 int vps_id = 0;
444445 ptrdiff_t nal_size;
445− HEVCVPS *vps;
446− AVBufferRef *vps_buf = av_buffer_allocz(sizeof(*vps));
446+ HEVCVPS *vps = ff_refstruct_allocz(sizeof(*vps));
447447
448− if (!vps_buf)
448+ if (!vps)
449449 return AVERROR(ENOMEM);
450− vps = (HEVCVPS*)vps_buf->data;
451450
452451 av_log(avctx, AV_LOG_DEBUG, "Decoding VPS\n");
453452
@@ -553,17 +552,17 @@ int ff_hevc_decode_nal_vps(GetBitContext *gb, AVCodecContext *avctx, · 99 unmodified lines
553552 }
554553
555554 if (ps->vps_list[vps_id] &&
556− !memcmp(ps->vps_list[vps_id]->data, vps_buf->data, vps_buf->size)) {
557− av_buffer_unref(&vps_buf);
555+ !memcmp(ps->vps_list[vps_id], vps, sizeof(*vps))) {
556+ ff_refstruct_unref(&vps);
558557 } else {
559558 remove_vps(ps, vps_id);
560− ps->vps_list[vps_id] = vps_buf;
559+ ps->vps_list[vps_id] = vps;
561560 }
562561
563562 return 0;
564563
565564 err:
566− av_buffer_unref(&vps_buf);
565+ ff_refstruct_unref(&vps);
567566 return AVERROR_INVALIDDATA;
568567 }
569568
@@ -851,7 +850,8 @@ static int map_pixel_format(AVCodecContext *avctx, HEVCSPS *sps) · 281 unmodified lines
851850 }
852851
853852 int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
854− int apply_defdispwin, AVBufferRef **vps_list, AVCodecContext *avctx)
853+ int apply_defdispwin, const HEVCVPS * const *vps_list,
854+ AVCodecContext *avctx)
855855 {
856856 HEVCWindow *ow;
857857 int ret = 0;
@@ -1269,15 +1269,13 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, · 411 unmodified lines
12691269 int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx,
12701270 HEVCParamSets *ps, int apply_defdispwin)
12711271 {
1272− HEVCSPS *sps;
1273− AVBufferRef *sps_buf = av_buffer_allocz(sizeof(*sps));
1272+ HEVCSPS *sps = ff_refstruct_allocz(sizeof(*sps));
12741273 unsigned int sps_id;
12751274 int ret;
12761275 ptrdiff_t nal_size;
12771276
1278− if (!sps_buf)
1277+ if (!sps)
12791278 return AVERROR(ENOMEM);
1280− sps = (HEVCSPS*)sps_buf->data;
12811279
12821280 av_log(avctx, AV_LOG_DEBUG, "Decoding SPS\n");
12831281
@@ -1296,7 +1294,7 @@ int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx, · 12 unmodified lines
12961294 apply_defdispwin,
12971295 ps->vps_list, avctx);
12981296 if (ret < 0) {
1299− av_buffer_unref(&sps_buf);
1297+ ff_refstruct_unref(&sps);
13001298 return ret;
13011299 }
13021300
@@ -1314,19 +1312,19 @@ int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx, · 11 unmodified lines
13141312 * original one.
13151313 * otherwise drop all PPSes that depend on it */
13161314 if (ps->sps_list[sps_id] &&
1317− !memcmp(ps->sps_list[sps_id]->data, sps_buf->data, sps_buf->size)) {
1318− av_buffer_unref(&sps_buf);
1315+ !memcmp(ps->sps_list[sps_id], sps, sizeof(*sps))) {
1316+ ff_refstruct_unref(&sps);
13191317 } else {
13201318 remove_sps(ps, sps_id);
1321− ps->sps_list[sps_id] = sps_buf;
1319+ ps->sps_list[sps_id] = sps;
13221320 }
13231321
13241322 return 0;
13251323 }
13261324
1327−static void hevc_pps_free(void *opaque, uint8_t *data)
1325+static void hevc_pps_free(FFRefStructOpaque unused, void *obj)
13281326 {
1329− HEVCPPS *pps = (HEVCPPS*)data;
1327+ HEVCPPS *pps = obj;
13301328
13311329 av_freep(&pps->column_width);
13321330 av_freep(&pps->row_height);
@@ -1338,8 +1336,6 @@ static void hevc_pps_free(void *opaque, uint8_t *data) · 5 unmodified lines
13381336 av_freep(&pps->tile_pos_rs);
13391337 av_freep(&pps->tile_id);
13401338 av_freep(&pps->min_tb_addr_zs_tab);
1341−
1342− av_freep(&pps);
13431339 }
13441340
13451341 static void colour_mapping_octants(GetBitContext *gb, HEVCPPS *pps, int inp_depth,
@@ -1742,19 +1738,11 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx, · 396 unmodified lines
17421738 ptrdiff_t nal_size;
17431739 unsigned log2_parallel_merge_level_minus2;
17441740
1745− AVBufferRef *pps_buf;
1746− HEVCPPS *pps = av_mallocz(sizeof(*pps));
1741+ HEVCPPS *pps = ff_refstruct_alloc_ext(sizeof(*pps), 0, NULL, hevc_pps_free);
17471742
17481743 if (!pps)
17491744 return AVERROR(ENOMEM);
17501745
1751− pps_buf = av_buffer_create((uint8_t *)pps, sizeof(*pps),
1752− hevc_pps_free, NULL, 0);
1753− if (!pps_buf) {
1754− av_freep(&pps);
1755− return AVERROR(ENOMEM);
1756− }
1757−
17581746 av_log(avctx, AV_LOG_DEBUG, "Decoding PPS\n");
17591747
17601748 nal_size = gb->buffer_end - gb->buffer;
@@ -1796,8 +1784,8 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx, · 35 unmodified lines
17961784 ret = AVERROR_INVALIDDATA;
17971785 goto err;
17981786 }
1799− sps = (HEVCSPS *)ps->sps_list[pps->sps_id]->data;
1800− vps = (HEVCVPS *)ps->vps_list[sps->vps_id]->data;
1787+ sps = ps->sps_list[pps->sps_id];
1788+ vps = ps->vps_list[sps->vps_id];
18011789
18021790 pps->dependent_slice_segments_enabled_flag = get_bits1(gb);
18031791 pps->output_flag_present_flag = get_bits1(gb);
@@ -1998,12 +1986,12 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx, · 194 unmodified lines
19981986 }
19991987
20001988 remove_pps(ps, pps_id);
2001− ps->pps_list[pps_id] = pps_buf;
1989+ ps->pps_list[pps_id] = pps;
20021990
20031991 return 0;
20041992
20051993 err:
2006− av_buffer_unref(&pps_buf);
1994+ ff_refstruct_unref(&pps);
20071995 return ret;
20081996 }
20091997
@@ -2012,11 +2000,11 @@ void ff_hevc_ps_uninit(HEVCParamSets *ps) · 2 unmodified lines
20122000 int i;
20132001
20142002 for (i = 0; i < FF_ARRAY_ELEMS(ps->vps_list); i++)
2015− av_buffer_unref(&ps->vps_list[i]);
2003+ ff_refstruct_unref(&ps->vps_list[i]);
20162004 for (i = 0; i < FF_ARRAY_ELEMS(ps->sps_list); i++)
2017− av_buffer_unref(&ps->sps_list[i]);
2005+ ff_refstruct_unref(&ps->sps_list[i]);
20182006 for (i = 0; i < FF_ARRAY_ELEMS(ps->pps_list); i++)
2019− av_buffer_unref(&ps->pps_list[i]);
2007+ ff_refstruct_unref(&ps->pps_list[i]);
20202008
20212009 ps->sps = NULL;
20222010 ps->pps = NULL;
libavcodec/hevc_ps.h+5−5
@@ -23,7 +23,6 @@ · 22 unmodified lines
2323
2424 #include <stdint.h>
2525
26−#include "libavutil/buffer.h"
2726 #include "libavutil/pixfmt.h"
2827 #include "libavutil/rational.h"
2928
@@ -437,9 +436,9 @@ typedef struct HEVCPPS { · 407 unmodified lines
437436 } HEVCPPS;
438437
439438 typedef struct HEVCParamSets {
440− AVBufferRef *vps_list[HEVC_MAX_VPS_COUNT];
441− AVBufferRef *sps_list[HEVC_MAX_SPS_COUNT];
442− AVBufferRef *pps_list[HEVC_MAX_PPS_COUNT];
439+ const HEVCVPS *vps_list[HEVC_MAX_VPS_COUNT]; ///< RefStruct references
440+ const HEVCSPS *sps_list[HEVC_MAX_SPS_COUNT]; ///< RefStruct references
441+ const HEVCPPS *pps_list[HEVC_MAX_PPS_COUNT]; ///< RefStruct references
443442
444443 /* currently active parameter sets */
445444 const HEVCVPS *vps;
@@ -457,7 +456,8 @@ typedef struct HEVCParamSets { · 11 unmodified lines
457456 * to an existing VPS
458457 */
459458 int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
460− int apply_defdispwin, AVBufferRef **vps_list, AVCodecContext *avctx);
459+ int apply_defdispwin, const HEVCVPS * const *vps_list,
460+ AVCodecContext *avctx);
461461
462462 int ff_hevc_decode_nal_vps(GetBitContext *gb, AVCodecContext *avctx,
463463 HEVCParamSets *ps);
libavcodec/hevc_sei.c+2−3
@@ -53,11 +53,10 @@ static int decode_nal_sei_pic_timing(HEVCSEI *s, GetBitContext *gb, · 52 unmodified lines
5353 const HEVCParamSets *ps, void *logctx)
5454 {
5555 HEVCSEIPictureTiming *h = &s->picture_timing;
56− HEVCSPS *sps;
56+ const HEVCSPS *sps = ps->sps_list[s->active_seq_parameter_set_id];
5757
58− if (!ps->sps_list[s->active_seq_parameter_set_id])
58+ if (!sps)
5959 return(AVERROR(ENOMEM));
60− sps = (HEVCSPS*)ps->sps_list[s->active_seq_parameter_set_id]->data;
6160
6261 if (sps->vui.frame_field_info_present_flag) {
6362 int pic_struct = get_bits(gb, 4);
libavcodec/hevcdec.c+14−22
@@ -50,6 +50,7 @@ · 49 unmodified lines
5050 #include "hwconfig.h"
5151 #include "internal.h"
5252 #include "profiles.h"
53+#include "refstruct.h"
5354 #include "thread.h"
5455 #include "threadframe.h"
5556
@@ -326,7 +327,7 @@ static void export_stream_params(HEVCContext *s, const HEVCSPS *sps) · 270 unmodified lines
326327 {
327328 AVCodecContext *avctx = s->avctx;
328329 const HEVCParamSets *ps = &s->ps;
329− const HEVCVPS *vps = (const HEVCVPS*)ps->vps_list[sps->vps_id]->data;
330+ const HEVCVPS *vps = ps->vps_list[sps->vps_id];
330331 const HEVCWindow *ow = &sps->output_window;
331332 unsigned int num = 0, den = 0;
332333
@@ -573,7 +574,7 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps, · 240 unmodified lines
573574 }
574575
575576 s->ps.sps = sps;
576− s->ps.vps = (HEVCVPS*) s->ps.vps_list[s->ps.sps->vps_id]->data;
577+ s->ps.vps = s->ps.vps_list[s->ps.sps->vps_id];
577578
578579 return 0;
579580
@@ -616,16 +617,16 @@ static int hls_slice_header(HEVCContext *s) · 36 unmodified lines
616617 return AVERROR_INVALIDDATA;
617618 }
618619 if (!sh->first_slice_in_pic_flag &&
619− s->ps.pps != (HEVCPPS*)s->ps.pps_list[sh->pps_id]->data) {
620+ s->ps.pps != s->ps.pps_list[sh->pps_id]) {
620621 av_log(s->avctx, AV_LOG_ERROR, "PPS changed between slices.\n");
621622 return AVERROR_INVALIDDATA;
622623 }
623− s->ps.pps = (HEVCPPS*)s->ps.pps_list[sh->pps_id]->data;
624+ s->ps.pps = s->ps.pps_list[sh->pps_id];
624625 if (s->nal_unit_type == HEVC_NAL_CRA_NUT && s->last_eos == 1)
625626 sh->no_output_of_prior_pics_flag = 1;
626627
627− if (s->ps.sps != (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data) {
628− const HEVCSPS *sps = (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data;
628+ if (s->ps.sps != s->ps.sps_list[s->ps.pps->sps_id]) {
629+ const HEVCSPS *sps = s->ps.sps_list[s->ps.pps->sps_id];
629630 enum AVPixelFormat pix_fmt;
630631
631632 ff_hevc_clear_refs(s);
@@ -3304,7 +3305,7 @@ static int hevc_decode_extradata(HEVCContext *s, uint8_t *buf, int length, int f · 2672 unmodified lines
33043305 /* export stream parameters from the first SPS */
33053306 for (i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++) {
33063307 if (first && s->ps.sps_list[i]) {
3307− const HEVCSPS *sps = (const HEVCSPS*)s->ps.sps_list[i]->data;
3308+ const HEVCSPS *sps = s->ps.sps_list[i];
33083309 export_stream_params(s, sps);
33093310 break;
33103311 }
@@ -3549,23 +3550,14 @@ static int hevc_update_thread_context(AVCodecContext *dst, · 238 unmodified lines
35493550
35503551 if (s->ps.sps != s0->ps.sps)
35513552 s->ps.sps = NULL;
3552− for (i = 0; i < FF_ARRAY_ELEMS(s->ps.vps_list); i++) {
3553− ret = av_buffer_replace(&s->ps.vps_list[i], s0->ps.vps_list[i]);
3554− if (ret < 0)
3555− return ret;
3556− }
3553+ for (int i = 0; i < FF_ARRAY_ELEMS(s->ps.vps_list); i++)
3554+ ff_refstruct_replace(&s->ps.vps_list[i], s0->ps.vps_list[i]);
35573555
3558− for (i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++) {
3559− ret = av_buffer_replace(&s->ps.sps_list[i], s0->ps.sps_list[i]);
3560− if (ret < 0)
3561− return ret;
3562− }
3556+ for (int i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++)
3557+ ff_refstruct_replace(&s->ps.sps_list[i], s0->ps.sps_list[i]);
35633558
3564− for (i = 0; i < FF_ARRAY_ELEMS(s->ps.pps_list); i++) {
3565− ret = av_buffer_replace(&s->ps.pps_list[i], s0->ps.pps_list[i]);
3566− if (ret < 0)
3567− return ret;
3568− }
3559+ for (int i = 0; i < FF_ARRAY_ELEMS(s->ps.pps_list); i++)
3560+ ff_refstruct_replace(&s->ps.pps_list[i], s0->ps.pps_list[i]);
35693561
35703562 if (s->ps.sps != s0->ps.sps)
35713563 if ((ret = set_sps(s, s0->ps.sps, src->pix_fmt)) < 0)
libavcodec/mediacodecdec.c+3−3
@@ -223,21 +223,21 @@ static int hevc_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) · 222 unmodified lines
223223
224224 for (i = 0; i < HEVC_MAX_VPS_COUNT; i++) {
225225 if (ps.vps_list[i]) {
226− vps = (const HEVCVPS*)ps.vps_list[i]->data;
226+ vps = ps.vps_list[i];
227227 break;
228228 }
229229 }
230230
231231 for (i = 0; i < HEVC_MAX_PPS_COUNT; i++) {
232232 if (ps.pps_list[i]) {
233− pps = (const HEVCPPS*)ps.pps_list[i]->data;
233+ pps = ps.pps_list[i];
234234 break;
235235 }
236236 }
237237
238238 if (pps) {
239239 if (ps.sps_list[pps->sps_id]) {
240− sps = (const HEVCSPS*)ps.sps_list[pps->sps_id]->data;
240+ sps = ps.sps_list[pps->sps_id];
241241 }
242242 }
243243
libavcodec/videotoolbox.c+2−2
@@ -246,7 +246,7 @@ CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx) · 245 unmodified lines
246246 #define COUNT_SIZE_PS(T, t) \
247247 for (i = 0; i < HEVC_MAX_##T##PS_COUNT; i++) { \
248248 if (h->ps.t##ps_list[i]) { \
249− const HEVC##T##PS *lps = (const HEVC##T##PS *)h->ps.t##ps_list[i]->data; \
249+ const HEVC##T##PS *lps = h->ps.t##ps_list[i]; \
250250 vt_extradata_size += 2 + escape_ps(NULL, lps->data, lps->data_size); \
251251 num_##t##ps++; \
252252 } \
@@ -369,7 +369,7 @@ CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx) · 116 unmodified lines
369369 p += 3; \
370370 for (i = 0; i < HEVC_MAX_##T##PS_COUNT; i++) { \
371371 if (h->ps.t##ps_list[i]) { \
372− const HEVC##T##PS *lps = (const HEVC##T##PS *)h->ps.t##ps_list[i]->data; \
372+ const HEVC##T##PS *lps = h->ps.t##ps_list[i]; \
373373 int size = escape_ps(p + 2, lps->data, lps->data_size); \
374374 /* unsigned int(16) nalUnitLength; */ \
375375 AV_WB16(p, size); \
libavcodec/vulkan_hevc.c+8−8
@@ -71,14 +71,14 @@ typedef struct HEVCHeaderSet { · 70 unmodified lines
7171 static int alloc_hevc_header_structs(FFVulkanDecodeContext *s,
7272 int nb_vps,
7373 const int vps_list_idx[HEVC_MAX_VPS_COUNT],
74− AVBufferRef * const vps_list[HEVC_MAX_VPS_COUNT])
74+ const HEVCVPS * const vps_list[HEVC_MAX_VPS_COUNT])
7575 {
7676 uint8_t *data_ptr;
7777 HEVCHeaderSet *hdr;
7878
7979 size_t buf_size = sizeof(HEVCHeaderSet) + nb_vps*sizeof(HEVCHeaderVPS);
8080 for (int i = 0; i < nb_vps; i++) {
81− const HEVCVPS *vps = (const HEVCVPS *)vps_list[vps_list_idx[i]]->data;
81+ const HEVCVPS *vps = vps_list[vps_list_idx[i]];
8282 buf_size += sizeof(HEVCHeaderVPSSet)*vps->vps_num_hrd_parameters;
8383 }
8484
@@ -97,7 +97,7 @@ static int alloc_hevc_header_structs(FFVulkanDecodeContext *s, · 12 unmodified lines
9797 hdr->hvps = (HEVCHeaderVPS *)(data_ptr + sizeof(HEVCHeaderSet));
9898 data_ptr += sizeof(HEVCHeaderSet) + nb_vps*sizeof(HEVCHeaderVPS);
9999 for (int i = 0; i < nb_vps; i++) {
100− const HEVCVPS *vps = (const HEVCVPS *)vps_list[vps_list_idx[i]]->data;
100+ const HEVCVPS *vps = vps_list[vps_list_idx[i]];
101101 hdr->hvps[i].sls = (HEVCHeaderVPSSet *)data_ptr;
102102 data_ptr += sizeof(HEVCHeaderVPSSet)*vps->vps_num_hrd_parameters;
103103 }
@@ -677,7 +677,7 @@ static int vk_hevc_create_params(AVCodecContext *avctx, AVBufferRef **buf) · 573 unmodified lines
677677 /* SPS list */
678678 for (int i = 0; i < HEVC_MAX_SPS_COUNT; i++) {
679679 if (h->ps.sps_list[i]) {
680− const HEVCSPS *sps_l = (const HEVCSPS *)h->ps.sps_list[i]->data;
680+ const HEVCSPS *sps_l = h->ps.sps_list[i];
681681 int idx = h265_params_info.stdSPSCount++;
682682 set_sps(sps_l, i, &hdr->hsps[idx].scaling, &hdr->hsps[idx].vui_header,
683683 &hdr->hsps[idx].vui, &hdr->sps[idx], hdr->hsps[idx].nal_hdr,
@@ -689,8 +689,8 @@ static int vk_hevc_create_params(AVCodecContext *avctx, AVBufferRef **buf) · 5 unmodified lines
689689 /* PPS list */
690690 for (int i = 0; i < HEVC_MAX_PPS_COUNT; i++) {
691691 if (h->ps.pps_list[i]) {
692− const HEVCPPS *pps_l = (const HEVCPPS *)h->ps.pps_list[i]->data;
693− const HEVCSPS *sps_l = (const HEVCSPS *)h->ps.sps_list[pps_l->sps_id]->data;
692+ const HEVCPPS *pps_l = h->ps.pps_list[i];
693+ const HEVCSPS *sps_l = h->ps.sps_list[pps_l->sps_id];
694694 int idx = h265_params_info.stdPPSCount++;
695695 set_pps(pps_l, sps_l, &hdr->hpps[idx].scaling,
696696 &hdr->pps[idx], &hdr->hpps[idx].pal);
@@ -699,7 +699,7 @@ static int vk_hevc_create_params(AVCodecContext *avctx, AVBufferRef **buf) · 2 unmodified lines
699699
700700 /* VPS list */
701701 for (int i = 0; i < nb_vps; i++) {
702− const HEVCVPS *vps_l = (const HEVCVPS *)h->ps.vps_list[vps_list_idx[i]]->data;
702+ const HEVCVPS *vps_l = h->ps.vps_list[vps_list_idx[i]];
703703 set_vps(vps_l, &hdr->vps[i], &hdr->hvps[i].ptl, &hdr->hvps[i].dpbm,
704704 hdr->hvps[i].hdr, hdr->hvps[i].sls);
705705 h265_params_info.stdVPSCount++;
@@ -879,7 +879,7 @@ static int vk_hevc_end_frame(AVCodecContext *avctx) · 173 unmodified lines
879879 if (!pps) {
880880 unsigned int pps_id = h->sh.pps_id;
881881 if (pps_id < HEVC_MAX_PPS_COUNT && h->ps.pps_list[pps_id] != NULL)
882− pps = (const HEVCPPS *)h->ps.pps_list[pps_id]->data;
882+ pps = h->ps.pps_list[pps_id];
883883 }
884884
885885 if (!pps) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t