You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-16 22:42:38 +02:00
avcodec/hevcdec: Use union for AVFrame* and ProgressFrame
It avoids having to sync ProgressFrame.f and the pointer typically used to access the AVFrame. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -34,7 +34,6 @@ void ff_hevc_unref_frame(HEVCFrame *frame, int flags)
|
|||||||
frame->flags &= ~flags;
|
frame->flags &= ~flags;
|
||||||
if (!frame->flags) {
|
if (!frame->flags) {
|
||||||
ff_progress_frame_unref(&frame->tf);
|
ff_progress_frame_unref(&frame->tf);
|
||||||
frame->frame = NULL;
|
|
||||||
av_frame_unref(frame->frame_grain);
|
av_frame_unref(frame->frame_grain);
|
||||||
frame->needs_fg = 0;
|
frame->needs_fg = 0;
|
||||||
|
|
||||||
@ -87,7 +86,6 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
|
|||||||
AV_GET_BUFFER_FLAG_REF);
|
AV_GET_BUFFER_FLAG_REF);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
frame->frame = frame->tf.f;
|
|
||||||
|
|
||||||
frame->rpl = ff_refstruct_allocz(s->pkt.nb_nals * sizeof(*frame->rpl));
|
frame->rpl = ff_refstruct_allocz(s->pkt.nb_nals * sizeof(*frame->rpl));
|
||||||
if (!frame->rpl)
|
if (!frame->rpl)
|
||||||
|
@ -3418,7 +3418,6 @@ static int hevc_ref_frame(HEVCFrame *dst, HEVCFrame *src)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ff_progress_frame_ref(&dst->tf, &src->tf);
|
ff_progress_frame_ref(&dst->tf, &src->tf);
|
||||||
dst->frame = dst->tf.f;
|
|
||||||
|
|
||||||
if (src->needs_fg) {
|
if (src->needs_fg) {
|
||||||
ret = av_frame_ref(dst->frame_grain, src->frame_grain);
|
ret = av_frame_ref(dst->frame_grain, src->frame_grain);
|
||||||
|
@ -352,9 +352,13 @@ typedef struct DBParams {
|
|||||||
#define HEVC_SEQUENCE_COUNTER_INVALID (HEVC_SEQUENCE_COUNTER_MASK + 1)
|
#define HEVC_SEQUENCE_COUNTER_INVALID (HEVC_SEQUENCE_COUNTER_MASK + 1)
|
||||||
|
|
||||||
typedef struct HEVCFrame {
|
typedef struct HEVCFrame {
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
AVFrame *frame;
|
AVFrame *frame;
|
||||||
AVFrame *frame_grain;
|
};
|
||||||
ProgressFrame tf;
|
ProgressFrame tf;
|
||||||
|
};
|
||||||
|
AVFrame *frame_grain;
|
||||||
int needs_fg; /* 1 if grain needs to be applied by the decoder */
|
int needs_fg; /* 1 if grain needs to be applied by the decoder */
|
||||||
MvField *tab_mvf; ///< RefStruct reference
|
MvField *tab_mvf; ///< RefStruct reference
|
||||||
RefPicList *refPicList;
|
RefPicList *refPicList;
|
||||||
|
Reference in New Issue
Block a user