diff mbox series

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

Message ID 1636712536-13114-2-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,01/11] 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

Limin Wang Nov. 12, 2021, 10:22 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

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

Patch

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,
 };