diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-08-14 01:06:16 +0300 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-08-18 17:57:47 +0300 |
commit | e50684318390b5cffc68da131f7630f11814b808 (patch) | |
tree | 1735291efc2192426f9d2b434c9d9916addbce39 | |
parent | f0ea5094afa3b056cf9c2f71cacadb4fbb7a6a95 (diff) |
avcodec/mpegpicture: Reset fields explicitly instead of memsetting them
Improves the grepability of the code.
(Furthermore, I hope that no compiler will really call memset
for 28 bytes.)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/mpegpicture.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 711ce35f9d..977bc65191 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -311,8 +311,6 @@ fail: */ void ff_mpeg_unref_picture(AVCodecContext *avctx, Picture *pic) { - int off = offsetof(Picture, hwaccel_priv_buf) + sizeof(pic->hwaccel_priv_buf); - pic->tf.f = pic->f; /* WM Image / Screen codecs allocate internal buffers with different * dimensions / colorspaces; ignore user-defined callbacks for these. */ @@ -328,7 +326,12 @@ void ff_mpeg_unref_picture(AVCodecContext *avctx, Picture *pic) if (pic->needs_realloc) free_picture_tables(pic); - memset((uint8_t*)pic + off, 0, sizeof(*pic) - off); + pic->hwaccel_picture_private = NULL; + pic->field_picture = 0; + pic->b_frame_score = 0; + pic->needs_realloc = 0; + pic->reference = 0; + pic->shared = 0; } int ff_update_picture_tables(Picture *dst, const Picture *src) |