diff mbox series

[FFmpeg-devel,v3,5/7] avcodec: suppport for bitpacked encode

Message ID 1637767665-6777-5-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,v3,1/7] avformat/rtpdec_rfc4175: use rawvideo for uyvy422 | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Lance Wang Nov. 24, 2021, 3:27 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 Changelog                  |   1 +
 libavcodec/Makefile        |   1 +
 libavcodec/allcodecs.c     |   1 +
 libavcodec/bitpacked_enc.c | 121 +++++++++++++++++++++++++++++++++++++++++++++
 libavcodec/version.h       |   2 +-
 5 files changed, 125 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/bitpacked_enc.c

Comments

Michael Niedermayer Nov. 24, 2021, 9:20 p.m. UTC | #1
On Wed, Nov 24, 2021 at 11:27:43PM +0800, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  Changelog                  |   1 +
>  libavcodec/Makefile        |   1 +
>  libavcodec/allcodecs.c     |   1 +
>  libavcodec/bitpacked_enc.c | 121 +++++++++++++++++++++++++++++++++++++++++++++
>  libavcodec/version.h       |   2 +-
>  5 files changed, 125 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/bitpacked_enc.c
> 
> diff --git a/Changelog b/Changelog
> index 2035c27..a66231b4 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -32,6 +32,7 @@ version <next>:
>  - huesaturation video filter
>  - colorspectrum source video filter
>  - RTP packetizer for uncompressed video (RFC 4175)
> +- bitpacked encoder
>  
>  
>  version 4.4:
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index fbb2b79..6be90cd 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -244,6 +244,7 @@ OBJS-$(CONFIG_BINKAUDIO_DCT_DECODER)   += binkaudio.o
>  OBJS-$(CONFIG_BINKAUDIO_RDFT_DECODER)  += binkaudio.o
>  OBJS-$(CONFIG_BINTEXT_DECODER)         += bintext.o cga_data.o
>  OBJS-$(CONFIG_BITPACKED_DECODER)       += bitpacked_dec.o
> +OBJS-$(CONFIG_BITPACKED_ENCODER)       += bitpacked_enc.o
>  OBJS-$(CONFIG_BMP_DECODER)             += bmp.o msrledec.o
>  OBJS-$(CONFIG_BMP_ENCODER)             += bmpenc.o
>  OBJS-$(CONFIG_BMV_AUDIO_DECODER)       += bmvaudio.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index 9ede09b..89d6526 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -65,6 +65,7 @@ extern const AVCodec ff_bethsoftvid_decoder;
>  extern const AVCodec ff_bfi_decoder;
>  extern const AVCodec ff_bink_decoder;
>  extern const AVCodec ff_bitpacked_decoder;
> +extern const AVCodec ff_bitpacked_encoder;
>  extern const AVCodec ff_bmp_encoder;
>  extern const AVCodec ff_bmp_decoder;
>  extern const AVCodec ff_bmv_video_decoder;
> diff --git a/libavcodec/bitpacked_enc.c b/libavcodec/bitpacked_enc.c
> new file mode 100644
> index 0000000..a8cad64
> --- /dev/null
> +++ b/libavcodec/bitpacked_enc.c
> @@ -0,0 +1,121 @@
> +/*
> + * bitpacked encoder
> + *
> + * Copyright (c) 2021 Limin Wang
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include "avcodec.h"
> +#include "encode.h"
> +#include "internal.h"
> +#include "put_bits.h"
> +#include "libavutil/pixdesc.h"
> +
> +struct BitpackedContext {
> +    int (*encode)(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame);
> +};
> +
> +static int encode_yuv422p10(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame)
> +{
> +    const int buf_size = avctx->height * avctx->width * avctx->bits_per_coded_sample / 8;
> +    int ret;
> +    uint8_t *dst;
> +    const uint16_t *y;
> +    const uint16_t *u;
> +    const uint16_t *v;
> +    PutBitContext pb;
> +    const int depth = avctx->bits_per_raw_sample;
> +
> +    ret = ff_get_encode_buffer(avctx, pkt,  buf_size, 0);
> +    if (ret < 0) {
> +        av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
> +        return ret;
> +    }
> +    dst = pkt->data;
> +
> +    init_put_bits(&pb, dst, buf_size);
> +
> +    for (int i = 0; i < avctx->height; i++) {
> +        y = (uint16_t*)(frame->data[0] + i * frame->linesize[0]);
> +        u = (uint16_t*)(frame->data[1] + i * frame->linesize[1]);
> +        v = (uint16_t*)(frame->data[2] + i * frame->linesize[2]);
> +
> +        for (int j = 0; j < avctx->width; j += 2) {
> +            /* u, y0, v, y1 */
> +            put_bits(&pb, depth, av_clip_uintp2(*u++, depth));
> +            put_bits(&pb, depth, av_clip_uintp2(*y++, depth));
> +            put_bits(&pb, depth, av_clip_uintp2(*v++, depth));
> +            put_bits(&pb, depth, av_clip_uintp2(*y++, depth));

breaks build on ARM, depth needs to be constant during build for the arm code

In file included from src/libavutil/intmath.h:30:0,
                 from src/libavutil/common.h:89,
                 from src/libavutil/avutil.h:296,
                 from src/libavutil/samplefmt.h:24,
                 from src/libavcodec/avcodec.h:30,
                 from src/libavcodec/bitpacked_enc.c:23:
src/libavutil/arm/intmath.h: In function ‘encode_yuv422p10’:
src/libavutil/arm/intmath.h:77:5: warning: asm operand 2 probably doesn’t match constraints
     __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
     ^~~~~~~
src/libavutil/arm/intmath.h:77:5: warning: asm operand 2 probably doesn’t match constraints
     __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
     ^~~~~~~
src/libavutil/arm/intmath.h:77:5: warning: asm operand 2 probably doesn’t match constraints
     __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
     ^~~~~~~
src/libavutil/arm/intmath.h:77:5: warning: asm operand 2 probably doesn’t match constraints
     __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
     ^~~~~~~
src/libavutil/arm/intmath.h:77:5: error: impossible constraint in ‘asm’
     __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
     ^~~~~~~
src/libavutil/arm/intmath.h:77:5: error: impossible constraint in ‘asm’
     __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
     ^~~~~~~
src/libavutil/arm/intmath.h:77:5: error: impossible constraint in ‘asm’
     __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
     ^~~~~~~
src/libavutil/arm/intmath.h:77:5: error: impossible constraint in ‘asm’
     __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
     ^~~~~~~
[...]
Lance Wang Nov. 25, 2021, 1:20 a.m. UTC | #2
On Wed, Nov 24, 2021 at 10:20:34PM +0100, Michael Niedermayer wrote:
> On Wed, Nov 24, 2021 at 11:27:43PM +0800, lance.lmwang@gmail.com wrote:
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> >  Changelog                  |   1 +
> >  libavcodec/Makefile        |   1 +
> >  libavcodec/allcodecs.c     |   1 +
> >  libavcodec/bitpacked_enc.c | 121 +++++++++++++++++++++++++++++++++++++++++++++
> >  libavcodec/version.h       |   2 +-
> >  5 files changed, 125 insertions(+), 1 deletion(-)
> >  create mode 100644 libavcodec/bitpacked_enc.c
> > 
> > diff --git a/Changelog b/Changelog
> > index 2035c27..a66231b4 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -32,6 +32,7 @@ version <next>:
> >  - huesaturation video filter
> >  - colorspectrum source video filter
> >  - RTP packetizer for uncompressed video (RFC 4175)
> > +- bitpacked encoder
> >  
> >  
> >  version 4.4:
> > diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> > index fbb2b79..6be90cd 100644
> > --- a/libavcodec/Makefile
> > +++ b/libavcodec/Makefile
> > @@ -244,6 +244,7 @@ OBJS-$(CONFIG_BINKAUDIO_DCT_DECODER)   += binkaudio.o
> >  OBJS-$(CONFIG_BINKAUDIO_RDFT_DECODER)  += binkaudio.o
> >  OBJS-$(CONFIG_BINTEXT_DECODER)         += bintext.o cga_data.o
> >  OBJS-$(CONFIG_BITPACKED_DECODER)       += bitpacked_dec.o
> > +OBJS-$(CONFIG_BITPACKED_ENCODER)       += bitpacked_enc.o
> >  OBJS-$(CONFIG_BMP_DECODER)             += bmp.o msrledec.o
> >  OBJS-$(CONFIG_BMP_ENCODER)             += bmpenc.o
> >  OBJS-$(CONFIG_BMV_AUDIO_DECODER)       += bmvaudio.o
> > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> > index 9ede09b..89d6526 100644
> > --- a/libavcodec/allcodecs.c
> > +++ b/libavcodec/allcodecs.c
> > @@ -65,6 +65,7 @@ extern const AVCodec ff_bethsoftvid_decoder;
> >  extern const AVCodec ff_bfi_decoder;
> >  extern const AVCodec ff_bink_decoder;
> >  extern const AVCodec ff_bitpacked_decoder;
> > +extern const AVCodec ff_bitpacked_encoder;
> >  extern const AVCodec ff_bmp_encoder;
> >  extern const AVCodec ff_bmp_decoder;
> >  extern const AVCodec ff_bmv_video_decoder;
> > diff --git a/libavcodec/bitpacked_enc.c b/libavcodec/bitpacked_enc.c
> > new file mode 100644
> > index 0000000..a8cad64
> > --- /dev/null
> > +++ b/libavcodec/bitpacked_enc.c
> > @@ -0,0 +1,121 @@
> > +/*
> > + * bitpacked encoder
> > + *
> > + * Copyright (c) 2021 Limin Wang
> > + *
> > + * This file is part of FFmpeg.
> > + *
> > + * FFmpeg is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU Lesser General Public
> > + * License as published by the Free Software Foundation; either
> > + * version 2.1 of the License, or (at your option) any later version.
> > + *
> > + * FFmpeg is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > + * Lesser General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU Lesser General Public
> > + * License along with FFmpeg; if not, write to the Free Software
> > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> > + */
> > +
> > +#include "avcodec.h"
> > +#include "encode.h"
> > +#include "internal.h"
> > +#include "put_bits.h"
> > +#include "libavutil/pixdesc.h"
> > +
> > +struct BitpackedContext {
> > +    int (*encode)(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame);
> > +};
> > +
> > +static int encode_yuv422p10(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame)
> > +{
> > +    const int buf_size = avctx->height * avctx->width * avctx->bits_per_coded_sample / 8;
> > +    int ret;
> > +    uint8_t *dst;
> > +    const uint16_t *y;
> > +    const uint16_t *u;
> > +    const uint16_t *v;
> > +    PutBitContext pb;
> > +    const int depth = avctx->bits_per_raw_sample;
> > +
> > +    ret = ff_get_encode_buffer(avctx, pkt,  buf_size, 0);
> > +    if (ret < 0) {
> > +        av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
> > +        return ret;
> > +    }
> > +    dst = pkt->data;
> > +
> > +    init_put_bits(&pb, dst, buf_size);
> > +
> > +    for (int i = 0; i < avctx->height; i++) {
> > +        y = (uint16_t*)(frame->data[0] + i * frame->linesize[0]);
> > +        u = (uint16_t*)(frame->data[1] + i * frame->linesize[1]);
> > +        v = (uint16_t*)(frame->data[2] + i * frame->linesize[2]);
> > +
> > +        for (int j = 0; j < avctx->width; j += 2) {
> > +            /* u, y0, v, y1 */
> > +            put_bits(&pb, depth, av_clip_uintp2(*u++, depth));
> > +            put_bits(&pb, depth, av_clip_uintp2(*y++, depth));
> > +            put_bits(&pb, depth, av_clip_uintp2(*v++, depth));
> > +            put_bits(&pb, depth, av_clip_uintp2(*y++, depth));
> 
> breaks build on ARM, depth needs to be constant during build for the arm code

OK, now only yuv422p10 is supported, so I'll change depth to const 10 to avoid
the break.

> 
> In file included from src/libavutil/intmath.h:30:0,
>                  from src/libavutil/common.h:89,
>                  from src/libavutil/avutil.h:296,
>                  from src/libavutil/samplefmt.h:24,
>                  from src/libavcodec/avcodec.h:30,
>                  from src/libavcodec/bitpacked_enc.c:23:
> src/libavutil/arm/intmath.h: In function ‘encode_yuv422p10’:
> src/libavutil/arm/intmath.h:77:5: warning: asm operand 2 probably doesn’t match constraints
>      __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
>      ^~~~~~~
> src/libavutil/arm/intmath.h:77:5: warning: asm operand 2 probably doesn’t match constraints
>      __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
>      ^~~~~~~
> src/libavutil/arm/intmath.h:77:5: warning: asm operand 2 probably doesn’t match constraints
>      __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
>      ^~~~~~~
> src/libavutil/arm/intmath.h:77:5: warning: asm operand 2 probably doesn’t match constraints
>      __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
>      ^~~~~~~
> src/libavutil/arm/intmath.h:77:5: error: impossible constraint in ‘asm’
>      __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
>      ^~~~~~~
> src/libavutil/arm/intmath.h:77:5: error: impossible constraint in ‘asm’
>      __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
>      ^~~~~~~
> src/libavutil/arm/intmath.h:77:5: error: impossible constraint in ‘asm’
>      __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
>      ^~~~~~~
> src/libavutil/arm/intmath.h:77:5: error: impossible constraint in ‘asm’
>      __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
>      ^~~~~~~
> [...]
> 
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> The educated differ from the uneducated as much as the living from the
> dead. -- Aristotle 



> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/Changelog b/Changelog
index 2035c27..a66231b4 100644
--- a/Changelog
+++ b/Changelog
@@ -32,6 +32,7 @@  version <next>:
 - huesaturation video filter
 - colorspectrum source video filter
 - RTP packetizer for uncompressed video (RFC 4175)
+- bitpacked encoder
 
 
 version 4.4:
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index fbb2b79..6be90cd 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -244,6 +244,7 @@  OBJS-$(CONFIG_BINKAUDIO_DCT_DECODER)   += binkaudio.o
 OBJS-$(CONFIG_BINKAUDIO_RDFT_DECODER)  += binkaudio.o
 OBJS-$(CONFIG_BINTEXT_DECODER)         += bintext.o cga_data.o
 OBJS-$(CONFIG_BITPACKED_DECODER)       += bitpacked_dec.o
+OBJS-$(CONFIG_BITPACKED_ENCODER)       += bitpacked_enc.o
 OBJS-$(CONFIG_BMP_DECODER)             += bmp.o msrledec.o
 OBJS-$(CONFIG_BMP_ENCODER)             += bmpenc.o
 OBJS-$(CONFIG_BMV_AUDIO_DECODER)       += bmvaudio.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 9ede09b..89d6526 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -65,6 +65,7 @@  extern const AVCodec ff_bethsoftvid_decoder;
 extern const AVCodec ff_bfi_decoder;
 extern const AVCodec ff_bink_decoder;
 extern const AVCodec ff_bitpacked_decoder;
+extern const AVCodec ff_bitpacked_encoder;
 extern const AVCodec ff_bmp_encoder;
 extern const AVCodec ff_bmp_decoder;
 extern const AVCodec ff_bmv_video_decoder;
diff --git a/libavcodec/bitpacked_enc.c b/libavcodec/bitpacked_enc.c
new file mode 100644
index 0000000..a8cad64
--- /dev/null
+++ b/libavcodec/bitpacked_enc.c
@@ -0,0 +1,121 @@ 
+/*
+ * bitpacked encoder
+ *
+ * Copyright (c) 2021 Limin Wang
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avcodec.h"
+#include "encode.h"
+#include "internal.h"
+#include "put_bits.h"
+#include "libavutil/pixdesc.h"
+
+struct BitpackedContext {
+    int (*encode)(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame);
+};
+
+static int encode_yuv422p10(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame)
+{
+    const int buf_size = avctx->height * avctx->width * avctx->bits_per_coded_sample / 8;
+    int ret;
+    uint8_t *dst;
+    const uint16_t *y;
+    const uint16_t *u;
+    const uint16_t *v;
+    PutBitContext pb;
+    const int depth = avctx->bits_per_raw_sample;
+
+    ret = ff_get_encode_buffer(avctx, pkt,  buf_size, 0);
+    if (ret < 0) {
+        av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+        return ret;
+    }
+    dst = pkt->data;
+
+    init_put_bits(&pb, dst, buf_size);
+
+    for (int i = 0; i < avctx->height; i++) {
+        y = (uint16_t*)(frame->data[0] + i * frame->linesize[0]);
+        u = (uint16_t*)(frame->data[1] + i * frame->linesize[1]);
+        v = (uint16_t*)(frame->data[2] + i * frame->linesize[2]);
+
+        for (int j = 0; j < avctx->width; j += 2) {
+            /* u, y0, v, y1 */
+            put_bits(&pb, depth, av_clip_uintp2(*u++, depth));
+            put_bits(&pb, depth, av_clip_uintp2(*y++, depth));
+            put_bits(&pb, depth, av_clip_uintp2(*v++, depth));
+            put_bits(&pb, depth, av_clip_uintp2(*y++, depth));
+        }
+    }
+    flush_put_bits(&pb);
+
+    return 0;
+}
+
+
+static av_cold int encode_init(AVCodecContext *avctx)
+{
+    struct BitpackedContext *s = avctx->priv_data;
+    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+    const int depth = desc->comp[0].depth;
+
+    if (avctx->width & 1) {
+        av_log(avctx, AV_LOG_ERROR, "bitpacked needs even width\n");
+        return AVERROR(EINVAL);
+    }
+
+    avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc);
+    avctx->bits_per_raw_sample = depth;
+    avctx->bit_rate = ff_guess_coded_bitrate(avctx);
+
+    if (avctx->pix_fmt == AV_PIX_FMT_YUV422P10)
+        s->encode = encode_yuv422p10;
+    else
+        return AVERROR(EINVAL);
+
+    return 0;
+}
+
+static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+                        const AVFrame *frame, int *got_packet)
+{
+    struct BitpackedContext *s = avctx->priv_data;
+    int ret;
+
+    ret = s->encode(avctx, pkt, frame);
+    if (ret)
+        return ret;
+
+    *got_packet = 1;
+    return 0;
+}
+
+const AVCodec ff_bitpacked_encoder = {
+    .name           = "bitpacked",
+    .long_name      = NULL_IF_CONFIG_SMALL("Bitpacked"),
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = AV_CODEC_ID_BITPACKED,
+    .priv_data_size = sizeof(struct BitpackedContext),
+    .capabilities   = AV_CODEC_CAP_DR1,
+    .init           = encode_init,
+    .encode2        = encode_frame,
+    .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV422P10,
+                                                    AV_PIX_FMT_NONE },
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
+};
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 4d30003..58e3322 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@ 
 
 #define LIBAVCODEC_VERSION_MAJOR  59
 #define LIBAVCODEC_VERSION_MINOR  13
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \