[FFmpeg-devel] [PATCH 02/11] avcodec/bitpacked: remove unneeded 8bit support

lance.lmwang at gmail.com lance.lmwang at gmail.com
Fri Nov 12 12:22:07 EET 2021


From: Limin Wang <lance.lmwang at gmail.com>

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
---
 libavcodec/bitpacked.c | 44 +++++---------------------------------------
 1 file changed, 5 insertions(+), 39 deletions(-)

diff --git a/libavcodec/bitpacked.c b/libavcodec/bitpacked.c
index 0440df9..d239141 100644
--- a/libavcodec/bitpacked.c
+++ b/libavcodec/bitpacked.c
@@ -36,29 +36,6 @@ struct BitpackedContext {
                   const AVPacket *pkt);
 };
 
-/* For this format, it's a simple passthrough */
-static int bitpacked_decode_uyvy422(AVCodecContext *avctx, AVFrame *frame,
-                                    const AVPacket *avpkt)
-{
-    int ret;
-
-    /* there is no need to copy as the data already match
-     * a known pixel format */
-    frame->buf[0] = av_buffer_ref(avpkt->buf);
-    if (!frame->buf[0]) {
-        return AVERROR(ENOMEM);
-    }
-
-    ret = av_image_fill_arrays(frame->data, frame->linesize, avpkt->data,
-                               avctx->pix_fmt, avctx->width, avctx->height, 1);
-    if (ret < 0) {
-        av_buffer_unref(&frame->buf[0]);
-        return ret;
-    }
-
-    return 0;
-}
-
 static int bitpacked_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame,
                                       const AVPacket *avpkt)
 {
@@ -102,21 +79,14 @@ static av_cold int bitpacked_init_decoder(AVCodecContext *avctx)
 {
     struct BitpackedContext *bc = avctx->priv_data;
 
-    if (!avctx->codec_tag || !avctx->width || !avctx->height)
+    if (!avctx->width || !avctx->height)
         return AVERROR_INVALIDDATA;
 
-    if (avctx->codec_tag == MKTAG('U', 'Y', 'V', 'Y')) {
-        if (avctx->bits_per_coded_sample == 16 &&
-            avctx->pix_fmt == AV_PIX_FMT_UYVY422)
-            bc->decode = bitpacked_decode_uyvy422;
-        else if (avctx->bits_per_coded_sample == 20 &&
-                 avctx->pix_fmt == AV_PIX_FMT_YUV422P10)
-            bc->decode = bitpacked_decode_yuv422p10;
-        else
-            return AVERROR_INVALIDDATA;
-    } else {
+    if (avctx->bits_per_coded_sample == 20 &&
+        avctx->pix_fmt == AV_PIX_FMT_YUV422P10)
+        bc->decode = bitpacked_decode_yuv422p10;
+    else
         return AVERROR_INVALIDDATA;
-    }
 
     return 0;
 }
@@ -150,9 +120,5 @@ const AVCodec ff_bitpacked_decoder = {
     .init = bitpacked_init_decoder,
     .decode = bitpacked_decode,
     .capabilities = AV_CODEC_CAP_EXPERIMENTAL,
-    .codec_tags     = (const uint32_t []){
-        MKTAG('U', 'Y', 'V', 'Y'),
-        FF_CODEC_TAGS_END,
-    },
     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list