diff mbox series

[FFmpeg-devel,30/34] avcodec/libvpxenc: Avoid copying packet data

Message ID HE1PR0301MB21546412F1D0E07372CE90088F439@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Superseded
Headers show
Series [FFmpeg-devel,01/34] avcodec/adpcmenc: Avoid copying packet data | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate fail Make fate failed
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate warning Make fate failed

Commit Message

Andreas Rheinhardt April 25, 2021, 10:34 p.m. UTC
Here the packet size is known before allocating the packet because
the encoder provides said information (and works with internal buffers
itself), so one can pass this information to ff_alloc_packet2() to
avoid the implicit use of another intermediate buffer for the packet data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
Will get rid of this unnecessary level of indirection in storeframe()
after the bump.

 libavcodec/libvpxenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Zern April 26, 2021, 5:42 p.m. UTC | #1
On Sun, Apr 25, 2021 at 3:39 PM Andreas Rheinhardt
<andreas.rheinhardt@outlook.com> wrote:
>
> Here the packet size is known before allocating the packet because
> the encoder provides said information (and works with internal buffers
> itself), so one can pass this information to ff_alloc_packet2() to
> avoid the implicit use of another intermediate buffer for the packet data.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> Will get rid of this unnecessary level of indirection in storeframe()
> after the bump.
>
>  libavcodec/libvpxenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

lgtm.
diff mbox series

Patch

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 3f36943c12..f852642ce8 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1185,7 +1185,7 @@  static inline void cx_pktcpy(struct FrameListData *dst,
 static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
                       AVPacket *pkt)
 {
-    int ret = ff_alloc_packet2(avctx, pkt, cx_frame->sz, 0);
+    int ret = ff_alloc_packet2(avctx, pkt, cx_frame->sz, cx_frame->sz);
     uint8_t *side_data;
     if (ret >= 0) {
         int pict_type;