From patchwork Fri Nov 12 10:22:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 31377 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp1631978iob; Fri, 12 Nov 2021 02:22:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkID/4DIVcchf/RVlUtkx5ObdIy58y1qR03zrNUp27IvGzZkpN0Epigg/NKYZMQw6S9mhL X-Received: by 2002:a17:906:a1da:: with SMTP id bx26mr18110616ejb.558.1636712554831; Fri, 12 Nov 2021 02:22:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636712554; cv=none; d=google.com; s=arc-20160816; b=iFiuieWnWnf4FnBuKVHBsGB3bYPEl/sx+Z2wfXMt+cE2s2J9pZuJqoH7cZVxIAJzRX oO+iryfNfGZrrryHtqe+pROEP4w5U1LgbxzRpvAAkLkhwRWrF3nboQ5gHpwQ/yCXceDC IDEulbrNKaV9kJLW/SK8GuTPWqnvcOfxYNk5CtHpVywLQVHzLtJgjtVxoZ6m2cYHpi4j aMzFuH0FYh5V4seE47MsyEdeExbjJpvXGHlS+hEJg8Wjs9lEBmjHLn9JCairzz7KiE6B 7ECOqYhIrOtKtQM0nxEVoBaF772V3AtyW+uZZyqCW1zE3m5KPo4aJfHUOgkqOZNUc8dn nCLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to; bh=OjRaatL8iSANAG23avs2WleQLtwH0PiwYykC+Svy5pA=; b=lFlTqX2oLTetyqZcxVSKJuvE+gjzNb0HjBFMCKdx0wFGYwyIkYrJlAlJIT8BGkMtGi QS15We4Vsi97FAQr66WYl1oqm/cfEWsqRPF3mS0J7QSbpbEdwgy12q3udC9IMiKs2yzz Ppbq+Gc6VYrDJbRGcqbT6hpSenOuXpNUjPxO6FxkGO0JcPWIAqFkIJ6bLG8BrS/kUwIE Z2MvOLh+59edBLn8fgpDhJodinHhR3KWTjS2+HUXIFzRXJst92p2seDNnEr2xSMEOmsE ILmB75B6ht5uJINZI7LtjW1r7l1q909CTReK8MEx6NUqSHwaHUpKG39soTyAB3cpHpTb 7eCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=nl3iApn7; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hr38si15938370ejc.65.2021.11.12.02.22.34; Fri, 12 Nov 2021 02:22:34 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=nl3iApn7; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A0BE068ADF8; Fri, 12 Nov 2021 12:22:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 88A7E68A8C7 for ; Fri, 12 Nov 2021 12:22:22 +0200 (EET) Received: by mail-pf1-f170.google.com with SMTP id y5so8134544pfb.4 for ; Fri, 12 Nov 2021 02:22:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=gvWxmj2FBHbeq+JNo4HD41FSEewofpPqMHNKWceGMIA=; b=nl3iApn7D/nkUDV+hFF3dLLDJ6gYDYRAUKL4rrxTVNkroCvN2oDzvpXf0WW5jjpro7 BCU/cShE0KhNENKgmNccz7R0/UByiwHKVFpbg8hmVbgE0tYQialMuCzsv4mNd/pWgmaN N2jhltQhfcaLhwNZ39M21gSstPES2pR6P8UVsSn+JJ1cQ3Tyh3KkjdJN9CR5o8f+xcfX V/j8caeAbm2aKNV3iHWovDnoqgUKIUAJ3Df6QMlfNjjvpyJ5xQL+lKIANUop4f8TQJup 37OLTFpwXb0mNbNuHzUeThHU7jo5JlRehWCYLVaJdonLD59t9BH+y1VKmsuoP55fxdJv VOeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=gvWxmj2FBHbeq+JNo4HD41FSEewofpPqMHNKWceGMIA=; b=kk1/6lJfI/+v2r7xL/YkVQQy/Ekbjo3cvSvKFPCPfBxb4hUGvemWu4wZp2hOgpO6qO DujC8MyA76zajeHQmnkOV3Lpa2RpBIxQFtdOU+q9aEGd3MGxRO3HV8MO/aIdkunl1nap RClMEE9Uir33ndBFhnWP4mhrQ17veXHTlx/1dAjVN9Ql3Fo3t9XlfuUsiSz3CU4rjuGh s+qCTkjQAkcN0Xy7/o3gna4jJktekj23gvttiNFqwXJgIsAN/opt6uw2Y5byi2BEGhdw RfyJBOMkUW/D4jPNsk2NSC3MEW6dsBlzGcMuJ65CcUNsKpdCIf6HcERTM+2wRmoNYn4z XbrA== X-Gm-Message-State: AOAM532vd8l8DQJ4KzkepBqQb+kdy0I17mOnkVEgqm98BeEYTK+vR4lV g7z6EGn4rrks8VRVd4sKD36mR14yTYM= X-Received: by 2002:a05:6a00:1514:b0:49f:b5ef:affb with SMTP id q20-20020a056a00151400b0049fb5efaffbmr12708525pfu.7.1636712540569; Fri, 12 Nov 2021 02:22:20 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f19sm6030563pfc.122.2021.11.12.02.22.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Nov 2021 02:22:20 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Nov 2021 18:22:06 +0800 Message-Id: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH 01/11] avformat/rtpdec_rfc4175: use rawvideo for uyvy422 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Lssb/NhGxcM6 From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index f50cad7..f13736b 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -55,9 +55,11 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) if (data->depth == 8) { data->pgroup = 4; pixfmt = AV_PIX_FMT_UYVY422; + stream->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; } else if (data->depth == 10) { data->pgroup = 5; pixfmt = AV_PIX_FMT_YUV422P10; + stream->codecpar->codec_id = AV_CODEC_ID_BITPACKED; } else { return AVERROR_INVALIDDATA; } @@ -268,7 +270,7 @@ static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext *data, const RTPDynamicProtocolHandler ff_rfc4175_rtp_handler = { .enc_name = "raw", .codec_type = AVMEDIA_TYPE_VIDEO, - .codec_id = AV_CODEC_ID_BITPACKED, + .codec_id = AV_CODEC_ID_NONE, .priv_data_size = sizeof(PayloadContext), .parse_sdp_a_line = rfc4175_parse_sdp_line, .parse_packet = rfc4175_handle_packet, From patchwork Fri Nov 12 10:22:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 31379 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp1632216iob; Fri, 12 Nov 2021 02:22:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxoxh0NDQDAs8Wzi7E3ykjPc/eXd878EI4hglL50fTTxPqrlGGlow+yAtK8wbMkapQrAyT7 X-Received: by 2002:a05:6402:35d2:: with SMTP id z18mr19810801edc.9.1636712566836; Fri, 12 Nov 2021 02:22:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636712566; cv=none; d=google.com; s=arc-20160816; b=b21RFGeSts1ob9b8EmZNBHtBFcQ4rJLv40hXERPpRTt/w7I6o6PchZE/1trjpL9fq4 3pVSdF/pxbq8AZ+uza7pAO4wRsH7HTUVvuyobmzqjfd5J+SX6I80+UkZ/t6RWL+YZU2Z NSpKw5ilUbHSmA+7oYoPMnRZSm7+rcSfJHslKGzINboe3i1i9Nain/qWZsba7W9iq0cH xjW2RYLeEKhojQIJYeL0BWp3qW21fSaCLzCzE/pbz9g0/dH4opn4tSHkRXLuHEHqBegv e/135SXUocxqDSK+b+ZnHpXYuDcdCX/RvG2R/+lGXv5/bwnjH02In7DUe0cIOhvBtc91 uoQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=TBT60bTu8C7x17pLKB6DdXQPhvu43gIQaXHLCXC1/5o=; b=lX2QQRJz2ZWKZLyCUhnHE/hA0cqFZTOGXQwyanzxcP+AtStkVXI5utuCXfHgiCRGmJ VXdOIQzytbbrmUtJbaUCP0JmhUem3gFjBAWISspibea1yRbfH/LdNIkekgOCCa/WTE5m aPlds/Vw6if227s4fi+vqFEZIYXvRt7Yoj/aa82VX92EF77P7pwH5SNddKUIBHtArfi3 KjmsQNq8/8vCPfi9wlTLB651S/kVNq53MoTKxvBWdRztj1+mEolFtN+wAAoRiE5NcFVU ai2UQMh6QSZWAvYs0KwKYst3SgqCo5MlZXb/AhFE0hBwe7v5nrHzXsCpE6wGIc0gwK/V oaVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=RkPurxxx; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a25si12077819edn.511.2021.11.12.02.22.46; Fri, 12 Nov 2021 02:22:46 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=RkPurxxx; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B14E368AE13; Fri, 12 Nov 2021 12:22:30 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C936068A9A8 for ; Fri, 12 Nov 2021 12:22:23 +0200 (EET) Received: by mail-pf1-f173.google.com with SMTP id n26so3499017pff.3 for ; Fri, 12 Nov 2021 02:22:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kEemAtywrvfgGuOEz8eq3t6YZD5hUluWtPTDydV+rvw=; b=RkPurxxxnZwaeViy87k9BiTITP5TQwjuoU81vdlOd5RVLjlOdSkG4mcWGzkROydjXs IE4jiJFfFyYioG+xkE5Xn9PEQ14l5KYxybXZln/K4RNx1X/tCO8IUu3YxevHuOT3Cr7E 4B1y/G6aEBqSUUXhvjGwLxfBWx9SlQoBdITOeyQKeV+Lv2EJMXBZXokljDPfYxNpaXdt g9ipoqdeo+vV2xl6AV4KuYY6lN0AKhonRZMz9juNcBioFpysWQrncSI7/4hLXh+tlKem QguYCGR4R2JrUuHOeKBlnQkWgRxDsRLNdzEE0EEONmMNeEgwQZwjbDZ7cNAwcc6QsudJ GqoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kEemAtywrvfgGuOEz8eq3t6YZD5hUluWtPTDydV+rvw=; b=8GbNfmuruPLo4XdVnEKB2BFRE3ycwYIXZNSOsZgmiogRu5nigqoT+ak/O+3otUSfYu sR7fnI4O6Ek8qRJxnq1iOowPRyYFp++h4iyfEgpvhQXTttJLI4d+HNXRdGjyAIk4I2Nf jti04NVuVrHdenqh5mqEdirs3Rt1V3P8LTVmnau2bEkYTT0D2krQ5Idk7KToy65VeW2g AKpSAyz+3eE8em2HVYCfZm1R2JiTGQIUoPPlInGSEcZxP7mzcKMB/kwwH8JFB9Z5ZAYV 2b0xS+iqBgsbp93MUdIlSfq3N0LVOITWoiq1nhnB00ySdFwie5edYiecsGGktp+bmbn7 1dlQ== X-Gm-Message-State: AOAM530aPNCYE+V19E+fLfaOc8W8qMxwmrTYbHsgGJ1Ws4PK1drUFoF1 Vy6CHP1pp4+R++oDbMeI++PuLKMDSmo= X-Received: by 2002:a62:7802:0:b0:49f:d21e:1dc9 with SMTP id t2-20020a627802000000b0049fd21e1dc9mr12845996pfc.18.1636712541737; Fri, 12 Nov 2021 02:22:21 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f19sm6030563pfc.122.2021.11.12.02.22.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Nov 2021 02:22:21 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Nov 2021 18:22:07 +0800 Message-Id: <1636712536-13114-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> References: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 02/11] avcodec/bitpacked: remove unneeded 8bit support X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: TVKRl9akTZ9m From: Limin Wang Signed-off-by: Limin Wang --- 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, }; From patchwork Fri Nov 12 10:22:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 31384 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp1632391iob; Fri, 12 Nov 2021 02:22:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJy5Q1Ga9aB940SZ2aY+3UaFEBpNBR+fV3+PnQy/I2OB5OGc+SE2+179QmrFjycuib7OaXuX X-Received: by 2002:aa7:c783:: with SMTP id n3mr19465874eds.121.1636712576628; Fri, 12 Nov 2021 02:22:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636712576; cv=none; d=google.com; s=arc-20160816; b=Gx7XEx0LhmHFEzae6dI47FY2O3zCXz9ZKB6Ff95i1BKgoKHBpqcXw7V5JbJFm13i2t MoRYXndCWOux72N3dvTerDOZCA1AptWoOh5sS7TO30dwuJHS9GwdD6S+Kfc3RCeXS9Sh s1fGfIcM/DtOZaTgdSKh/sCH9DhZ0LX9l+Zyf2zU3pLMASv5GqvY+Mx0i8nCAs4PTE9p 3rYHbrsGssT5fNmaNTR0WUMNgk4cdngyeL01EN16u5+Xsd6hstN1LQjdpbJ82wtC7Twy 5bMz6Wx2GYU/e9B6/cgYbayLTAfRfciMja3lhdK/FxO4+vivQw7rBSi6maPf6R0U5nOE P5Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=pq2orvQ+0LSrgYTSwiG4vAUlGzAuHTcMP1E5qolk6CQ=; b=e+SaS90bvEBdiZsQtoOjx7mhQ+XFjo6Gd6prd0BjX9FuJnUpZdHidFv5ChYAvsEsf7 gdHxGD/jz3MWzSX/3CX9SlxjaX829dW7xoymCQRlI2pEBVTpaXpWH8JZRMX/rbFoH13W q2+lkytfiH1wD0cd+fwy5xdF7wsHADH6ltTBssV7TEWAc994lNJTK0GvkeQbXXsf+SI3 5eOUkQvfc/E4HeCEFAzyzNFfzrtCtgycH/t0rb6HUt5PVAv8lxY+iU91ny4u5q7mFh9O jSARPIqJzGsrgIGxVSfxVd4btkh0rKgk7v6xYzLEI8hJDRWqkpvtoCHo2QIfvs7BQ6y2 +roA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=KeaEYZbG; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dm4si10511669edb.311.2021.11.12.02.22.56; Fri, 12 Nov 2021 02:22:56 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=KeaEYZbG; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C3080688175; Fri, 12 Nov 2021 12:22:31 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C291668ABD1 for ; Fri, 12 Nov 2021 12:22:24 +0200 (EET) Received: by mail-pf1-f179.google.com with SMTP id n85so8097504pfd.10 for ; Fri, 12 Nov 2021 02:22:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2sV/TXp/d0t4K2Mg2R0yLfWmjTm8KnbRJ5LdLISlA5s=; b=KeaEYZbGgmSTgaGVkCeXk7cZ81oh3Xzwb7fhHprMRzDoDbSg2m0lEM5GvIIdo4OVOh aE/tkAJh+cmDOk8WKjre9aj5WQTx574XXiqIh9MiQ31nrJ8LQbZE6dm7CkOlHn1qPCa8 M8esFY7YD+h+gEEFn/LyFiMVrRlQRHa4vhIjt1PCc0YUT8eseChTMAcJoF3B9PtHRCNi MFQvcGtYBB964Kum1SuUgp3fdWqD2c3SR5s9hdE8FxZnF36j3SMyKEunt6W85thbCWWB APdDDB262Ltprlxv1x0vA7bwKFsg4wemLzLGQpfYXaX4MAnmJqFXAS/yADjj/s9iyMss Kg3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2sV/TXp/d0t4K2Mg2R0yLfWmjTm8KnbRJ5LdLISlA5s=; b=dN1nmTttA3Ai266woT8+IhbJE02uo9SFBfaZUmGgv9AmPt4A/s/PDNnlBG4MjbyG/v rRLV+mjNdD6NVHJqo4bISgB24y7TwJ7CChLf3/+79kVJ4XAYmwc69pKAvTvreH8WER9b s3MRa5vC9E/bxpcuxAVXPNRQSie3FH0lkH8qqaI82jNmsjgQFIJFN9DXeKcAJ/4qNzwL oXXWa0DTSw4Vr+TS58vSNchE5RoNKDXyICbLl7w04AUFC4cejXIDhTRSvD4XTKsCjymW MFH0I1PTNXA68xe7hTwRMJamewoTRZcd53KqhkIYW/HVCA5BelEWehOUbA1tyZfgxI1Q +Zow== X-Gm-Message-State: AOAM530eXy/eQO/aFSIw9ctK3Kp/EYatggq0i/rB7xWuv0ZaBrmCNnGd 5dx8n39AhralfRday9yLhSY/Y0an5Lg= X-Received: by 2002:aa7:83cd:0:b0:480:9e79:fae5 with SMTP id j13-20020aa783cd000000b004809e79fae5mr12928455pfn.42.1636712542924; Fri, 12 Nov 2021 02:22:22 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f19sm6030563pfc.122.2021.11.12.02.22.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Nov 2021 02:22:22 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Nov 2021 18:22:08 +0800 Message-Id: <1636712536-13114-3-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> References: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 03/11] avformat/rtpdec_rfc4175: remove the unused tag X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: sUaE/zE+tseI From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index f13736b..fe0754f 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -45,11 +45,9 @@ struct PayloadContext { static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) { enum AVPixelFormat pixfmt; - int tag; const AVPixFmtDescriptor *desc; if (!strncmp(data->sampling, "YCbCr-4:2:2", 11)) { - tag = MKTAG('U', 'Y', 'V', 'Y'); data->xinc = 2; if (data->depth == 8) { @@ -69,7 +67,6 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) desc = av_pix_fmt_desc_get(pixfmt); stream->codecpar->format = pixfmt; - stream->codecpar->codec_tag = tag; stream->codecpar->bits_per_coded_sample = av_get_bits_per_pixel(desc); data->frame_size = data->width * data->height * data->pgroup / data->xinc; From patchwork Fri Nov 12 10:22:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 31381 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp1632568iob; Fri, 12 Nov 2021 02:23:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJyx8VSdY5k7mUO0vnduMtfJQtsZyl/fhfUYyJ6iHWhAVj7pusaDpJ8IC1ZW4KwvApgKu4EY X-Received: by 2002:a17:907:a42c:: with SMTP id sg44mr17341400ejc.335.1636712587348; Fri, 12 Nov 2021 02:23:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636712587; cv=none; d=google.com; s=arc-20160816; b=iIt2z+qWmxGsTihK0oDYz67mzuFgsaEthnPt2Pjr17oo3NoGNlrnk7/9Uz+D1+g7S8 1n+EKw5y67SbNWX64lksBS+TONkn96KLGRjZB7gdgKn2AFT+szZSeKi9Onhs+j7/Xalf 1mkraMIWef25GzRIPJt2C7NuAc+JZ8Lr1if3a/d3t87ZX7R8Si6U/XBToNqJozFCUfre RBXvMWCy0S0LHm5IUT1yyxKlctcm56ntaLxL5XDPfSb9JTMdfrJh/EvrvCCFUIK5AxzB rMo9IN+phZTRBF22A4H+VqlYSkNaMbd6BTcLoPsmV9V6sJANw/82UigAHD9ROPg6T/My xO+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=z76bZpCZwrzh2eC7PVfOL0SVoqf8EjbOkpmaxQxh1ms=; b=qBRmFrJOh/ijShZ4b5yuY7my9LKI+6Oy3qpG6I2XeQWodasw6JDn23WtyvpFQS93SQ NXgdXaniZfkZgp2fRD2TjTDNNZiqypTaTyPQkMCX/IDdRa8sHjGlrAN6yjeN2sGggFqw lK/Bn1kEb8hnniGbbo0ccTuUsExJSyMUGZKZ5bX5lVkQLZXvc3OeYI2SI4+hTCXJZrVZ Gto3gulN+cSZ2nWDvLujlSJ7CzW3mI8ReOy4qxEjH8W3KbTYy9lA+lZ1eBvAatjTLctf I0ibyhOaWiABbebBNJBhf0su/aPqQn+KAxI7dZHB1IEBC3EM6aVpIsD3lYHVeTvVkH0H pT9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=LqX2bbVa; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b12si13436806edz.28.2021.11.12.02.23.07; Fri, 12 Nov 2021 02:23:07 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=LqX2bbVa; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DB50D68A618; Fri, 12 Nov 2021 12:22:34 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C0A9E68ADF2 for ; Fri, 12 Nov 2021 12:22:25 +0200 (EET) Received: by mail-pf1-f177.google.com with SMTP id y5so8134672pfb.4 for ; Fri, 12 Nov 2021 02:22:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pNd4i/+718PfQS8rg3GqOe1TKCu6HkHcrmpSd3KTiDc=; b=LqX2bbVa7nH1zoaACwBPMdp+Wk4Mk7IcwwFQsNVCGIJDC859Gs6WOUyzRUjgR1onaY lxyapaGtNQJxYEaIkudDqHp7H+ged/Xjl265i8ZiKSfRuYb1azx9dcBCbuZMdkaiJMYR OzJIkI2ItddECmyrUd2n3qUPV2j5GQUNkcltk+ZHQclUlWH1EMVqCtH6NTJbL62vbOIK eQe7P0s8lNxbo+d4st/2Bba7FOQQNUN/Dsj5cwOY792jcmGMYgDE5Vq12lWZzzyiXfi8 NTcuHl1KXrHLsUvO3VdRtgEXiFDXVE7CV4K0V97bNokqAqyda/LN6o/0vSlvq3Gl02EW 5VoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pNd4i/+718PfQS8rg3GqOe1TKCu6HkHcrmpSd3KTiDc=; b=p9eIjbniQEUq/l+Pc72e9Cu4hH2ebsMrGVezcmc7H3m8/9dFGrYbAKkghksQzQD0Z7 qKL9t5LFsAGLbYLn5UgWAYLbHrHYwyGdND6U5ypPOA/15MsZs+9fMCyxAvRFZa1s5imO s5rwpsABFNLmAOEgC6H50e+h8bDUmK945yAMmq5PikjACNkwH/km77o5hNSSWoe9FSI2 rnle0cp0HQgewhl65USReOQFN3YuBk47cjDw55tpMTCToD545QQ3OO9s8l/5n3zRfXe8 GXLutgxX0Tq/OZqmeNd6HUt/hRIfXUjRNlB6h6/nF32+oSXYEkFLs/NDTta4zcX71Ccr sx1A== X-Gm-Message-State: AOAM531nlFRPZgwNzq16F/Z1oWmCepa8+gNOnaHsKKpiCSWFUEK/WRUq 0zLJRI4IclZXzROdjCUokm1/7wgW3dw= X-Received: by 2002:a63:6e4d:: with SMTP id j74mr9158791pgc.257.1636712544115; Fri, 12 Nov 2021 02:22:24 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f19sm6030563pfc.122.2021.11.12.02.22.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Nov 2021 02:22:23 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Nov 2021 18:22:09 +0800 Message-Id: <1636712536-13114-4-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> References: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 04/11] avformat/rtpdec_rfc4175: support for yuv420p format X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: QHRyyxcyOZIe From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index fe0754f..81930ce 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -61,6 +61,17 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) } else { return AVERROR_INVALIDDATA; } + } else if (!strncmp(data->sampling, "YCbCr-4:2:0", 11)) { + data->xinc = 4; + + if (data->depth == 8) { + data->pgroup = 6; + pixfmt = AV_PIX_FMT_YUV420P; + stream->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; + } else { + return AVERROR_INVALIDDATA; + } + } else { return AVERROR_INVALIDDATA; } From patchwork Fri Nov 12 10:22:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 31374 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp1632757iob; Fri, 12 Nov 2021 02:23:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqvTKpCFXbm8BB3UyBArFQGFIaMuWhjAxrFhJsUk+w3H3wtcifXygAOZqR1npBgXQi4f0/ X-Received: by 2002:a05:6402:35cb:: with SMTP id z11mr19949167edc.188.1636712598505; Fri, 12 Nov 2021 02:23:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636712598; cv=none; d=google.com; s=arc-20160816; b=Zh1neD84EbPmYTCjtZbJq8yy6YUMscXSWgW+EMQ8l8mhFES1PtYJ1O8jHtb27AGOva nqttLBw85SuqEYoYSjRG0uPXzVuOITbKJ8prik+6DL8zHmbB9zaCjjbn6bEo+fYkymKP 3DvYKOi4RLeuBjtkWZeWnFOI+cuwh0VuXUnOmDcsFDmc8aIPTbKlsaJvEWjbsFrctOti YYVLivKrABKcx3w+cZ9B0jhFQRHPh/Kv/MmwyslJANWaJTEkLhVYO4WB2m5Cxeqfqalj Xud3os0G+FpjdWarlzs/zplZp7tloM84zQsqnlzd5GoovC9cMsA6BES/kB0ft9hbC9oI 0Pog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=g3ssVRNL9Eslh6E7lMGnAxkf/HPM8spDQ/DDkSzYKgc=; b=NidwmXUlj4nYpFIhI7sOBOPSW4hJmUYVNcnvSeSFbwZNIl2hrZ+TZsPe84qAv+R6zR kFnKuL3O1bUCUVhrO6KhenefnBIENmhlW7rRLxipY73+xKHAXFpf/Zd0/EgVAFZgCIlU 8vkc9AGp4s2z6eM2wExQb6XyjpBDampats75ItqrieFk8QiAwXgJdxUiYoXGCEbHBCkT uM1SrhmNKANxbIKAVI0EXY95PrcEfe72+0KX+9JbtEGZoVT5evzle0fWdKeDzhUhROiQ JqjHGY74+Evz4Q/q/BGutdn5Fbd0x2lduUbzHT+r2JDawt+3PSkYJS/9RrLYtGFC7gLX ft5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=Z+jm901l; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ne18si13013447ejc.424.2021.11.12.02.23.18; Fri, 12 Nov 2021 02:23:18 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=Z+jm901l; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EEEBD68AE5B; Fri, 12 Nov 2021 12:22:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1D4EE68A9A8 for ; Fri, 12 Nov 2021 12:22:27 +0200 (EET) Received: by mail-pg1-f181.google.com with SMTP id 136so3021111pgc.0 for ; Fri, 12 Nov 2021 02:22:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nykEJ2LyBS3Is6WzX8bQN7J7giBU4ibgNJa1D0hFF7Y=; b=Z+jm901lzXzlMas2PtMAZXJw4VGmo0x/wZTsoEeyjbRuDwABL3F3UQu5g3ay2G4N1b PvoLZ4YahSK2D1zx4xQykB5S70Qa6tw2RRbzGynqtXh/3Giyvvm/XVFt8s1TYUwEdI49 ElxPDuZWazCNyrOKvZi0AY5WCrPTA2YNjheK9PJtGuXc5wA0UYC2na1uk5vFNh5zsVeK +iFHtf53Svt83g5gKaIytcxPf4k1Bmxh30tQUPend6Cu8f30LEGs4zPKWC2lSyvIedep Io69+knQKvXF0Gy3OdK+8k/hR3pwnWmpYj7klFMnVajpYuCYEUZlB7Bj98C19moFpDcQ 00vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nykEJ2LyBS3Is6WzX8bQN7J7giBU4ibgNJa1D0hFF7Y=; b=fQbhmXi9WmUEO8JN53HQU1LiP6IMKGmoyF9n9m/V5DRYQ8Fr0cDHxxTKkCdK4mKuhf 1Pnp9tZuBi6i9ZNLu+9LH/0djfFtFxr90l/i2CVQcZDLKToP/nTsoSxE3fMWweTwVzYs 94nhXw+XtEUJaS/nwDkqmqv+beg/agi/JDc+mDEvnCSiAVABaPCMufurPZ2ymmvsATDY o9YRo5/mKQpPTySnZZnWvoc/izSn5Q0q4Nor8FvaHDPGMKFPC/RtNNRjLaygyC2ZyB5s 2O7bdGy3xVcNwItOuuw0Pp7W5PWnZljfUVCE3m+p/ISbTSxQck+Ynm57/8mi8bREMz4N EMQg== X-Gm-Message-State: AOAM533/p9OdIGealaMlCGSJSH/0RDCw1EQG4iwAl6ttzqPCLXt7wFfe 0t4WlxzbswriX+eUSAU/q6AzlJDoRtY= X-Received: by 2002:a63:a12:: with SMTP id 18mr9077410pgk.171.1636712545283; Fri, 12 Nov 2021 02:22:25 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f19sm6030563pfc.122.2021.11.12.02.22.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Nov 2021 02:22:25 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Nov 2021 18:22:10 +0800 Message-Id: <1636712536-13114-5-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> References: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 05/11] avformat/rtpenc: adds partial support for the RFC 4175 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: rxLmoRLvVE08 From: Limin Wang Signed-off-by: Limin Wang --- libavformat/Makefile | 1 + libavformat/rtpenc.c | 4 ++ libavformat/rtpenc.h | 1 + libavformat/rtpenc_rfc4175.c | 116 +++++++++++++++++++++++++++++++++++++++++++ libavformat/sdp.c | 25 ++++++++++ 5 files changed, 147 insertions(+) create mode 100644 libavformat/rtpenc_rfc4175.c diff --git a/libavformat/Makefile b/libavformat/Makefile index 3d6c8ef..a19d2e0 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -482,6 +482,7 @@ OBJS-$(CONFIG_RTP_MUXER) += rtp.o \ rtpenc_jpeg.o \ rtpenc_mpv.o \ rtpenc.o \ + rtpenc_rfc4175.o \ rtpenc_vc2hq.o \ rtpenc_vp8.o \ rtpenc_vp9.o \ diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index 2a1c176..4f115cc 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -84,6 +84,7 @@ static int is_supported(enum AVCodecID id) case AV_CODEC_ID_MJPEG: case AV_CODEC_ID_SPEEX: case AV_CODEC_ID_OPUS: + case AV_CODEC_ID_RAWVIDEO: return 1; default: return 0; @@ -619,6 +620,9 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) case AV_CODEC_ID_MJPEG: ff_rtp_send_jpeg(s1, pkt->data, size); break; + case AV_CODEC_ID_RAWVIDEO: + ff_rtp_send_raw_rfc4175 (s1, pkt->data, size); + break; case AV_CODEC_ID_OPUS: if (size > s->max_payload_size) { av_log(s1, AV_LOG_ERROR, diff --git a/libavformat/rtpenc.h b/libavformat/rtpenc.h index 62dc9ab..70ea85b 100644 --- a/libavformat/rtpenc.h +++ b/libavformat/rtpenc.h @@ -95,6 +95,7 @@ void ff_rtp_send_vc2hq(AVFormatContext *s1, const uint8_t *buf, int size, int in void ff_rtp_send_vp8(AVFormatContext *s1, const uint8_t *buff, int size); void ff_rtp_send_vp9(AVFormatContext *s1, const uint8_t *buff, int size); void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buff, int size); +void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size); const uint8_t *ff_h263_find_resync_marker_reverse(const uint8_t *av_restrict start, const uint8_t *av_restrict end); diff --git a/libavformat/rtpenc_rfc4175.c b/libavformat/rtpenc_rfc4175.c new file mode 100644 index 0000000..b6f833b --- /dev/null +++ b/libavformat/rtpenc_rfc4175.c @@ -0,0 +1,116 @@ +/* + * RTP Packetization of RAW video (RFC4175) + * 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 "avformat.h" +#include "rtpenc.h" + +void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size) +{ + RTPMuxContext *s = s1->priv_data; + int width = s1->streams[0]->codecpar->width; + int height = s1->streams[0]->codecpar->height; + int xinc, yinc, pgroup; + int field = 0; + int i = 0; + int offset = 0; + + s->timestamp = s->cur_timestamp; + switch (s1->streams[0]->codecpar->format) { + case AV_PIX_FMT_UYVY422: + xinc = yinc = 2; + pgroup = 4; + break; + case AV_PIX_FMT_YUV420P: + xinc = yinc = 4; + pgroup = 6; + break; + default: + return; + } + + while (i < height) { + int left = s->max_payload_size; + uint8_t *dest = s->buf; + uint8_t *headers; + const int head_size = 6; + int next_line; + int length, cont, pixels; + + /* Extended Sequence Number */ + *dest++ = 0; + *dest++ = 0; + left -= 2; + + headers = dest; + do { + pixels = width * xinc - offset; + length = (pixels * pgroup) / xinc; + + left -= head_size; + if (left >= length) { + next_line = 1; + } else { + pixels = (left / pgroup) * xinc; + length = (pixels * pgroup) / xinc; + next_line = 0; + } + left -= length; + + /* Length */ + *dest++ = (length >> 8) & 0xff; + *dest++ = length & 0xff; + + /* Line No */ + *dest++ = ((i >> 8) & 0x7f) | ((field << 7) & 0x80); + *dest++ = i & 0xff; + if (next_line) i += yinc; + + cont = (left > (head_size + pgroup) && i < height) ? 0x80 : 0x00; + /* Offset and Continuation marker */ + *dest++ = ((offset >> 8) & 0x7f) | cont; + *dest++ = offset & 0xff; + + if (next_line) + offset = 0; + else + offset += pixels; + } while (cont); + + do { + int l_line; + int l_off; + int copy_offset; + + length = (headers[0] << 8) | headers[1]; + l_line = ((headers[2] & 0x7f) << 8) | headers[3]; + l_off = ((headers[4] & 0x7f) << 8) | headers[5]; + cont = headers[4] & 0x80; + headers += head_size; + + copy_offset = (l_line * width + l_off) * pgroup / xinc; + if (copy_offset + length > size) + break; + memcpy (dest, buf + copy_offset, length); + dest += length; + } while (cont); + + ff_rtp_send_data (s1, s->buf, s->max_payload_size - left, i >= height); + } +} diff --git a/libavformat/sdp.c b/libavformat/sdp.c index 1200e55..cc04d70 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -660,6 +660,31 @@ static char *sdp_write_media_attributes(char *buff, int size, AVStream *st, int p->width, p->height, pix_fmt, config); break; } + case AV_CODEC_ID_RAWVIDEO: { + const char *pix_fmt; + int bit_depth = 8; + + switch (p->format) { + case AV_PIX_FMT_UYVY422: + pix_fmt = "YCbCr-4:2:2"; + break; + case AV_PIX_FMT_YUV420P: + pix_fmt = "YCbCr-4:2:0"; + break; + default: + av_log(fmt, AV_LOG_ERROR, "Unsupported pixel format.\n"); + return NULL; + } + + av_strlcatf(buff, size, "a=rtpmap:%d raw/90000\r\n" + "a=fmtp:%d sampling=%s; " + "width=%d; height=%d; " + "depth=%d\r\n", + payload_type, payload_type, + pix_fmt, p->width, p->height, bit_depth); + break; + } + case AV_CODEC_ID_VP8: av_strlcatf(buff, size, "a=rtpmap:%d VP8/90000\r\n", payload_type); From patchwork Fri Nov 12 10:22:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 31378 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp1632968iob; Fri, 12 Nov 2021 02:23:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOyNT8dB7G8yDRE2gObKpL+Y3q+2Nbyh8fEwH+FpsVV9+6go/OX538YH936zRqH8xSFamk X-Received: by 2002:a17:906:d1d1:: with SMTP id bs17mr17649833ejb.198.1636712608602; Fri, 12 Nov 2021 02:23:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636712608; cv=none; d=google.com; s=arc-20160816; b=ysVNaaCQqdIv2YL2haXs9D3aKa1ztx3LFqqwJUHVzEOQIbQ8lwEUi4CKROQDWFeq6k mya9iQikxs1EdE3CjenyWS8W/KYkIC8Zq1KBYUQ8BhUxK8iE1EKl/8A2wu1QSmQCu/CX GzHEaEWVhuupiNzDBL7fG+HQd47Z1FRreNI/WVpm3hev6pkB0xH3g057rlVVNMlpOp9N EM7nZZb0P+6xiB3Pj1dSZpWMD4Eb2mu1NWSmOaK1ABV7fFxjhZhN0RB4ARUoa50oyRUq vqSWyQrQ+RotgeZ1CDJ1D0GuLGADmsqgXCnxyDorJg9DxBVOJdsAweMm72V1C2ho/r+T ynIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=ObO+TxTAychqn/q3UlgA4YjpUd2AoDTK6M32HEuN7Zo=; b=q3h8vZ4iXTp8kNQc2sShfHsTmzI2zz1IfSdDWb0eM/zpvLXrrUlnhtioYlOW9D58Af +BTYr0zYjsRda/arg4C4XdcZdfliocUWMr2TBlnd9jqv6Rh7daA/GUM+vFi6GcnYy0ZB +oguJi+cAoQBBBtDbersoqC+H8COooANcW1AHSYj6/dlBKPuF43s+aAiXiw2W2O/eqA/ aWIkohNoRiX3wkx9RHMeT8PTczu8fBvXJZG+q9SsmlSGh5mVm8ST7dVsOSPRHzsJyH61 RqB+9Wi63xlY9HyeYrSQjuOr1q6VgKT1CurT7l/+JzGJdeyr+1zXLnbDAvat/U5Mh7Yu pc7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=qJwDF2Ho; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id jg5si14293860ejc.752.2021.11.12.02.23.28; Fri, 12 Nov 2021 02:23:28 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=qJwDF2Ho; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 045D268AE21; Fri, 12 Nov 2021 12:22:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 404F668AE36 for ; Fri, 12 Nov 2021 12:22:28 +0200 (EET) Received: by mail-pf1-f175.google.com with SMTP id g18so8116873pfk.5 for ; Fri, 12 Nov 2021 02:22:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=p/DLUicZGco6RN5xUbadD4dDZbSbLu/Ew6oEeaxI8a0=; b=qJwDF2HoHjyyDSa0ffAStXDYxvkIs03oXV3krM1cWUXZRECTOpma6/m714oQB0Go9A At4WcF8xWaND9EcGk425uOHEd2rKvBikFP9eImZCwy8G5ZiV/qBVw80Ley+urCbHZWTy emXNZSzeeJZ5kiZ2t06xiBt0mhpdbdZsFLSszTjcML5xn/5hvi83IlgyEQlCdkzR7iXX wY0Pz02fSPMJg2QDSujLlNCn7SX3ITHb9o1qoHX80vgK5K1efKT/7oYzimDghQnfzCMx kHkYs/yXfc8biCjPmAp93+7lP9k/v/UF1BccDwnqhKYgnY3vQsVDFBM+l6y2JjMJXcc9 Xx+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=p/DLUicZGco6RN5xUbadD4dDZbSbLu/Ew6oEeaxI8a0=; b=UiIJVFKDZGYvx2yYRUqhDEyoPRHT8FdjZRrSTyrg6fYM6crzOO74D3U+QNUvnhX18O Gcz1XlWU/tseZmRAzbr3toYEAzLf2opOn0A2tMguKjD1tCveOWgEaAXgjMwM91qZIsHP U3FzHunZEKYeS/L1udETk2YUQ8IvF9cNp/O5ltlOLK0DZjOzzJnTOhs7WmOwfFWfSes/ +1Llp0IsTWd+wuT1jAugxVsDB/MDcX9ZhQ60IicB4KqBYLzfeSPoA9vscGCr7TXFfHhi 9nHCgRevTLDd6YIZb1DMQf6ybr6JwEhLgzcbqDWr6BFuE7FTjDbXkJTzntmNyDyCqlSH i6fA== X-Gm-Message-State: AOAM531JQoas/5kCvpIhfKnZNOXSacY+6ZTgfm3xy3Nc5qlfYyLSTjEG 72TG3UQBbtyDSLw0a/6x1jzBWXVEQ7s= X-Received: by 2002:a05:6a00:16c6:b029:32d:e190:9dd0 with SMTP id l6-20020a056a0016c6b029032de1909dd0mr13062818pfc.70.1636712546490; Fri, 12 Nov 2021 02:22:26 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f19sm6030563pfc.122.2021.11.12.02.22.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Nov 2021 02:22:26 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Nov 2021 18:22:11 +0800 Message-Id: <1636712536-13114-6-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> References: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 06/11] avcodec: use s210 fourcc for 10-bit 4:2:2 packed X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: wbXVbU9m5cCZ From: Limin Wang s210 is used by AWS Elemental Live encoder so I prefer to use same to support 4:2:2 10-bit packed uncompressed video. Refer to: https://docs.aws.amazon.com/elemental-live/latest/ug/codec-vod-outputs.html I split the patch for better review, next patch will rename bitpacked.c to s210dec.c to reflect the change. Signed-off-by: Limin Wang --- libavcodec/Makefile | 2 +- libavcodec/allcodecs.c | 2 +- libavcodec/bitpacked.c | 33 +++++++++++++++++---------------- libavcodec/codec_desc.c | 6 +++--- libavcodec/codec_id.h | 2 +- libavformat/rtpdec_rfc4175.c | 2 +- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 14fbd2e..8ae28e8 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -243,7 +243,7 @@ OBJS-$(CONFIG_BINK_DECODER) += bink.o binkdsp.o 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.o +OBJS-$(CONFIG_S210_DECODER) += bitpacked.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..c461798 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -64,7 +64,7 @@ extern const AVCodec ff_ayuv_decoder; 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_s210_decoder; extern const AVCodec ff_bmp_encoder; extern const AVCodec ff_bmp_decoder; extern const AVCodec ff_bmv_video_decoder; diff --git a/libavcodec/bitpacked.c b/libavcodec/bitpacked.c index d239141..7bc5dbc 100644 --- a/libavcodec/bitpacked.c +++ b/libavcodec/bitpacked.c @@ -1,6 +1,7 @@ /* - * Unpack bit-packed streams to formats supported by FFmpeg + * S210 decoder * Copyright (c) 2017 Savoir-faire Linux, Inc + * Copyright (c) 2021 Limin Wang * * This file is part of FFmpeg. * @@ -23,7 +24,7 @@ /** * @file - * Bitpacked + * s210dec */ #include "avcodec.h" @@ -31,12 +32,12 @@ #include "get_bits.h" #include "libavutil/imgutils.h" -struct BitpackedContext { +struct S210Context { int (*decode)(AVCodecContext *avctx, AVFrame *frame, const AVPacket *pkt); }; -static int bitpacked_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame, +static int s210_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame, const AVPacket *avpkt) { uint64_t frame_size = (uint64_t)avctx->width * (uint64_t)avctx->height * 20; @@ -75,26 +76,26 @@ static int bitpacked_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame, return 0; } -static av_cold int bitpacked_init_decoder(AVCodecContext *avctx) +static av_cold int s210_init_decoder(AVCodecContext *avctx) { - struct BitpackedContext *bc = avctx->priv_data; + struct S210Context *bc = avctx->priv_data; if (!avctx->width || !avctx->height) return AVERROR_INVALIDDATA; if (avctx->bits_per_coded_sample == 20 && avctx->pix_fmt == AV_PIX_FMT_YUV422P10) - bc->decode = bitpacked_decode_yuv422p10; + bc->decode = s210_decode_yuv422p10; else return AVERROR_INVALIDDATA; return 0; } -static int bitpacked_decode(AVCodecContext *avctx, void *data, int *got_frame, +static int s210_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { - struct BitpackedContext *bc = avctx->priv_data; + struct S210Context *bc = avctx->priv_data; int buf_size = avpkt->size; AVFrame *frame = data; int res; @@ -111,14 +112,14 @@ static int bitpacked_decode(AVCodecContext *avctx, void *data, int *got_frame, } -const AVCodec ff_bitpacked_decoder = { - .name = "bitpacked", - .long_name = NULL_IF_CONFIG_SMALL("Bitpacked"), +const AVCodec ff_s210_decoder = { + .name = "s210", + .long_name = NULL_IF_CONFIG_SMALL("10-bit 4:2:2 packed"), .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_BITPACKED, - .priv_data_size = sizeof(struct BitpackedContext), - .init = bitpacked_init_decoder, - .decode = bitpacked_decode, + .id = AV_CODEC_ID_S210, + .priv_data_size = sizeof(struct S210Context), + .init = s210_init_decoder, + .decode = s210_decode, .capabilities = AV_CODEC_CAP_EXPERIMENTAL, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 0974ee0..d1cc4d0 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1645,10 +1645,10 @@ static const AVCodecDescriptor codec_descriptors[] = { .profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles), }, { - .id = AV_CODEC_ID_BITPACKED, + .id = AV_CODEC_ID_S210, .type = AVMEDIA_TYPE_VIDEO, - .name = "bitpacked", - .long_name = NULL_IF_CONFIG_SMALL("Bitpacked"), + .name = "s210", + .long_name = NULL_IF_CONFIG_SMALL("10-bit 4:2:2 packed"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h index ab265ec..721174f 100644 --- a/libavcodec/codec_id.h +++ b/libavcodec/codec_id.h @@ -277,7 +277,7 @@ enum AVCodecID { AV_CODEC_ID_CLEARVIDEO, AV_CODEC_ID_XPM, AV_CODEC_ID_AV1, - AV_CODEC_ID_BITPACKED, + AV_CODEC_ID_S210, AV_CODEC_ID_MSCC, AV_CODEC_ID_SRGC, AV_CODEC_ID_SVG, diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 81930ce..d39a3aa 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -57,7 +57,7 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) } else if (data->depth == 10) { data->pgroup = 5; pixfmt = AV_PIX_FMT_YUV422P10; - stream->codecpar->codec_id = AV_CODEC_ID_BITPACKED; + stream->codecpar->codec_id = AV_CODEC_ID_S210; } else { return AVERROR_INVALIDDATA; } From patchwork Fri Nov 12 10:22:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 31382 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp1633362iob; Fri, 12 Nov 2021 02:23:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJztVWg48brKntnqOWi0Tny0uvJZi+Kaxx0H6WNKnZlOZUeuXRqYhgMrQ05duQM9b8XzcRC0 X-Received: by 2002:a17:906:168e:: with SMTP id s14mr17968636ejd.340.1636712626963; Fri, 12 Nov 2021 02:23:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636712626; cv=none; d=google.com; s=arc-20160816; b=t72rZjby7XXuJa9YkEwbccF2Uh8tTN/Z+Zy9gplpaNkyikKZaD/1Cz8s0ssCY/ZEUH TlxeAVw7wXf0+VXCxkBvA1KkHstYd0FkUbW3BsOJC9/T2VftYUuMDGOP6KeS2NMv2paS 0pMnHB3l3UkiNtSl1gHmtgAyqTDhEen0SQUEzAKTwuUzEyFTRNTR1n+zSNGsYKuZbEty AxxFLNsO6hjNtLyV5ayxyIcRGRBEq3WCZ0yd6Ucuco4UpI+606HxFKm5fYdrUoUSD7O1 ZXIk/a8EKu1fX7l3ZuGsODixJtOzAjSStWg5301BR69zI2Sc2zwBN3O/x01O5zI7rd7X 2KGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=UJ0Bd3cmVNPT9oxRp2gNrOM8TBvqh0DMPyZl+I8iQp0=; b=vVa6ZtnqIfn+64zg6ID8whAufoRJMl7t65sLsjTi8CHItBd7n8iEjtA7tScj8CgWb0 vp2l4xLbGLvvam6fUZ89NC+kuy9cJvKmptEHcBLihtl8UiShBNl7WuGLOtOFohv2n5Jh N9mXzFDQZa/r4jKL6Rjn9qrJqn8ctbJQZdZhUrRqkk8WB9M1xXKdskuTFgoIbmV5It9+ Ugo2DmhMsv9WdTAbVff+jraDS5BFoe3XlCV0q8HXl9PePnXsBoTnuEnNLkoFk5qmkTBv c9QXqIqntKmp3gxztl/k//0Q0ABWvkQtW6ybtqn/W9VlvLuh9GoyfbGPlNKiGNhujM+O XUfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=Cn1rOElw; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t8si10389595edc.386.2021.11.12.02.23.46; Fri, 12 Nov 2021 02:23:46 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=Cn1rOElw; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2FFAF68AE4A; Fri, 12 Nov 2021 12:22:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 779A568AE14 for ; Fri, 12 Nov 2021 12:22:29 +0200 (EET) Received: by mail-pf1-f180.google.com with SMTP id g18so8116905pfk.5 for ; Fri, 12 Nov 2021 02:22:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oGJt57Lj/ouAjxp431T26hef7bcncELHSkqAIzaU3f0=; b=Cn1rOElwF7UneCCzoWdpWKysJMRWYv0mpl9U6CsD3NspuRMVxCl7XjghzpV0W1dT1Z FV87JBQyi4w8qrf2Iqzade8SWbqHCiJaPQkJjARny9EQCVKIXAZd0ZczD69y+/XuI9oN g+fF3gtyXIi1NQVT+7A87B0CYBrb8z7HRHkNdUDm+w++tdFUvYkkfaTs6UvJsNGAyICf QIDezE0hfb+8H9KZ5pdElTDaEo1dHxkgVI3mQ+ur0ryIFlSzmCpQ3AV6mqs8GyCWvHiL 1nOmJnpij4GyNTUbqfjWXSrEA5jVC5PtzinMhWEG7BC7JIHRUkdkKYuJy4heGmd8X6Rp xHWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oGJt57Lj/ouAjxp431T26hef7bcncELHSkqAIzaU3f0=; b=3+Jqu/tUuvtcyC6TQxs0HeCa7EAO/oTCKt3auQaq4H65EqGAf6nOSRaXw0aiNgrUF2 to0jOGfEl5AnRzaWm6lH2RKkr9HEnLO9GlMdOzGQb1+FiCDRSoP1MSSbHjxeHXgrgG/Q I5L/u7QJE2OF7sbCMUEyRcGUe0gBZkqg0qAuO+8qJA9mG0tNpFKQeSV92pstbHGFEY1L MVEpak+ogi/s7dibJrtb6Hy83PNtH0Zr+h5X6JDla6xX+0Kacbnpmb23b5lELKVTMUXu 2gSCut3bVMbH+jAqvEQ4g3AjM7zbBDNEAvPTc3pH9fnVV5KJuE1IvSiBQaTy3QJQ5lTr payg== X-Gm-Message-State: AOAM532wSmcNIFTdcjVN9y9zdmmc02rDG6MOnUZAVk3rKYToML9i4w4E TrgLzdx19YJ2ttwiPo3XZTauRgDa/g4= X-Received: by 2002:a05:6a00:cc4:b0:4a0:e97:fe97 with SMTP id b4-20020a056a000cc400b004a00e97fe97mr12975082pfv.74.1636712547690; Fri, 12 Nov 2021 02:22:27 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f19sm6030563pfc.122.2021.11.12.02.22.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Nov 2021 02:22:27 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Nov 2021 18:22:12 +0800 Message-Id: <1636712536-13114-7-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> References: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 07/11] avcodec: rename bitpacked.c to s210dec.c X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 4TfsAeIGLC5X From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/Makefile | 2 +- libavcodec/bitpacked.c | 125 ------------------------------------------------- libavcodec/s210dec.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+), 126 deletions(-) delete mode 100644 libavcodec/bitpacked.c create mode 100644 libavcodec/s210dec.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 8ae28e8..1d75cfe 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -243,7 +243,7 @@ OBJS-$(CONFIG_BINK_DECODER) += bink.o binkdsp.o 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_S210_DECODER) += bitpacked.o +OBJS-$(CONFIG_S210_DECODER) += s210dec.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/bitpacked.c b/libavcodec/bitpacked.c deleted file mode 100644 index 7bc5dbc..0000000 --- a/libavcodec/bitpacked.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * S210 decoder - * Copyright (c) 2017 Savoir-faire Linux, Inc - * 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 - */ - -/* Development sponsored by CBC/Radio-Canada */ - -/** - * @file - * s210dec - */ - -#include "avcodec.h" -#include "internal.h" -#include "get_bits.h" -#include "libavutil/imgutils.h" - -struct S210Context { - int (*decode)(AVCodecContext *avctx, AVFrame *frame, - const AVPacket *pkt); -}; - -static int s210_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame, - const AVPacket *avpkt) -{ - uint64_t frame_size = (uint64_t)avctx->width * (uint64_t)avctx->height * 20; - uint64_t packet_size = (uint64_t)avpkt->size * 8; - GetBitContext bc; - uint16_t *y, *u, *v; - int ret, i, j; - - ret = ff_get_buffer(avctx, frame, 0); - if (ret < 0) - return ret; - - if (frame_size > packet_size) - return AVERROR_INVALIDDATA; - - if (avctx->width % 2) - return AVERROR_PATCHWELCOME; - - ret = init_get_bits(&bc, avpkt->data, avctx->width * avctx->height * 20); - if (ret) - return ret; - - for (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 (j = 0; j < avctx->width; j += 2) { - *u++ = get_bits(&bc, 10); - *y++ = get_bits(&bc, 10); - *v++ = get_bits(&bc, 10); - *y++ = get_bits(&bc, 10); - } - } - - return 0; -} - -static av_cold int s210_init_decoder(AVCodecContext *avctx) -{ - struct S210Context *bc = avctx->priv_data; - - if (!avctx->width || !avctx->height) - return AVERROR_INVALIDDATA; - - if (avctx->bits_per_coded_sample == 20 && - avctx->pix_fmt == AV_PIX_FMT_YUV422P10) - bc->decode = s210_decode_yuv422p10; - else - return AVERROR_INVALIDDATA; - - return 0; -} - -static int s210_decode(AVCodecContext *avctx, void *data, int *got_frame, - AVPacket *avpkt) -{ - struct S210Context *bc = avctx->priv_data; - int buf_size = avpkt->size; - AVFrame *frame = data; - int res; - - frame->pict_type = AV_PICTURE_TYPE_I; - frame->key_frame = 1; - - res = bc->decode(avctx, frame, avpkt); - if (res) - return res; - - *got_frame = 1; - return buf_size; - -} - -const AVCodec ff_s210_decoder = { - .name = "s210", - .long_name = NULL_IF_CONFIG_SMALL("10-bit 4:2:2 packed"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_S210, - .priv_data_size = sizeof(struct S210Context), - .init = s210_init_decoder, - .decode = s210_decode, - .capabilities = AV_CODEC_CAP_EXPERIMENTAL, - .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, -}; diff --git a/libavcodec/s210dec.c b/libavcodec/s210dec.c new file mode 100644 index 0000000..7bc5dbc --- /dev/null +++ b/libavcodec/s210dec.c @@ -0,0 +1,125 @@ +/* + * S210 decoder + * Copyright (c) 2017 Savoir-faire Linux, Inc + * 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 + */ + +/* Development sponsored by CBC/Radio-Canada */ + +/** + * @file + * s210dec + */ + +#include "avcodec.h" +#include "internal.h" +#include "get_bits.h" +#include "libavutil/imgutils.h" + +struct S210Context { + int (*decode)(AVCodecContext *avctx, AVFrame *frame, + const AVPacket *pkt); +}; + +static int s210_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame, + const AVPacket *avpkt) +{ + uint64_t frame_size = (uint64_t)avctx->width * (uint64_t)avctx->height * 20; + uint64_t packet_size = (uint64_t)avpkt->size * 8; + GetBitContext bc; + uint16_t *y, *u, *v; + int ret, i, j; + + ret = ff_get_buffer(avctx, frame, 0); + if (ret < 0) + return ret; + + if (frame_size > packet_size) + return AVERROR_INVALIDDATA; + + if (avctx->width % 2) + return AVERROR_PATCHWELCOME; + + ret = init_get_bits(&bc, avpkt->data, avctx->width * avctx->height * 20); + if (ret) + return ret; + + for (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 (j = 0; j < avctx->width; j += 2) { + *u++ = get_bits(&bc, 10); + *y++ = get_bits(&bc, 10); + *v++ = get_bits(&bc, 10); + *y++ = get_bits(&bc, 10); + } + } + + return 0; +} + +static av_cold int s210_init_decoder(AVCodecContext *avctx) +{ + struct S210Context *bc = avctx->priv_data; + + if (!avctx->width || !avctx->height) + return AVERROR_INVALIDDATA; + + if (avctx->bits_per_coded_sample == 20 && + avctx->pix_fmt == AV_PIX_FMT_YUV422P10) + bc->decode = s210_decode_yuv422p10; + else + return AVERROR_INVALIDDATA; + + return 0; +} + +static int s210_decode(AVCodecContext *avctx, void *data, int *got_frame, + AVPacket *avpkt) +{ + struct S210Context *bc = avctx->priv_data; + int buf_size = avpkt->size; + AVFrame *frame = data; + int res; + + frame->pict_type = AV_PICTURE_TYPE_I; + frame->key_frame = 1; + + res = bc->decode(avctx, frame, avpkt); + if (res) + return res; + + *got_frame = 1; + return buf_size; + +} + +const AVCodec ff_s210_decoder = { + .name = "s210", + .long_name = NULL_IF_CONFIG_SMALL("10-bit 4:2:2 packed"), + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_S210, + .priv_data_size = sizeof(struct S210Context), + .init = s210_init_decoder, + .decode = s210_decode, + .capabilities = AV_CODEC_CAP_EXPERIMENTAL, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, +}; From patchwork Fri Nov 12 10:22:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 31383 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp1633606iob; Fri, 12 Nov 2021 02:23:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3wpyAsfftt8TuwVThWrzI8ePzFIBNdw+eyrZSeYsifKQpsqRWWiAkwvEWcIV2sF/JulQm X-Received: by 2002:a05:6402:42c7:: with SMTP id i7mr20283881edc.223.1636712637106; Fri, 12 Nov 2021 02:23:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636712637; cv=none; d=google.com; s=arc-20160816; b=qhseEHwZwoPFOvqRIg9wdwtJy8L+bjI91nNwszesi7ol3eWAGB9Qs9uGm24lcrX5qc pafStn9BXtEQey9oqilQWieDBliJJiO18iOWLtMl4iCtVsKdFMCQ8lWojViobwzcRIaV WThadfHOw9ObLyzNJG4EEFpdBrmIKj11kiE3VRmNTm5BQEUs9hgrG3TySWHFCOVfupJX OLxlne2sbgyuryRoDbhrsrFiwJtpZAlupXlbXI5fkIW9n8/NPjua90bGvUUFLHPzhThS /96g6zJ3HdkLHKEuRJrvEuprAvPPg0kErGK16/+msKwP+WUEbCNcSqG4p8PCX7kqg0A3 hUsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=djST3MOmBTQ4lcznq10yclHQJih/D9ZtjdBuBf7DPRA=; b=1CPggksvxx9x/qDW1ePDVoTnnSxFvakKhljQQsfzY41oSyinp9Hw9SMgC3pPsogsNo JaZ/Ur6l5QY1TOuVt+4R5GzGVxqE+/NTV+6Uzxst5uYVbqiChhC/1kdEhNae7VJJIgky EOZaFDRcPN6xOg4DaXpbXiWllSJGNnLcUIHWYRdm5H9Fax/CZMhfYXlnUP0j6Es2GdH8 NRN+LKQ7FdpRLhA85vqJAX0JrbCxls4SsG8aNzFeQDZkgt0PpWrddRwfEcbeAySeWARw QkDI4GbwjxDrCEhliiV0aAYuleGR+keNHHmL0s0yzRkcWkrt1mtnxli4WkOvOm/gpjo8 CqEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=gettnUg7; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e4si1259953edr.608.2021.11.12.02.23.56; Fri, 12 Nov 2021 02:23:57 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=gettnUg7; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2E1DC68AE76; Fri, 12 Nov 2021 12:22:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A98E468AE5B for ; Fri, 12 Nov 2021 12:22:30 +0200 (EET) Received: by mail-pf1-f172.google.com with SMTP id x131so8095047pfc.12 for ; Fri, 12 Nov 2021 02:22:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GMA50OBp8AHVw+RWXRb12nQzt583rGbiYYCWL61e93o=; b=gettnUg7lnYFs8Zotl2ZwtCi80g57D8VIECgpCTEV1igfGGf80Wpwn+nbOEBtpBfYC ELJitVwSIN27TlDMOi7ktkwOvmGYzL+4T0r1subsjGuSMN383lJlswMddATBThGhI32W iqJIn3x07c7cQoEWZFEN08M74tdwm93yCwvB0mMoR1XMHtsKEFFyuLmsv+bnV9HHjceF TYZGmbaDasg+6QIWfCNJJk9zYRzbyMWv2MRKhCe9EUYglfMfbipdnNg+tQVJnhLTbhEc ePFyRfdSVq+10HWcZMWBVnEl4iNGUsYI8Fh1CLAmWJHLxActxCVH4oiEV6PEuLAyJogg km2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GMA50OBp8AHVw+RWXRb12nQzt583rGbiYYCWL61e93o=; b=iUDmc3chH/3LC7VV5MfO1z0Oeutga/dgVYZgNMx49+wWbP1jDeVEL2W+3S5swKJWoE 3JhPwFUbEKazgqJuke7RhCvkI5Sy8FHDs+xbbQ98RYJkUeP62dSR8QRqigS43XmYPPI1 P9RvwujpAxsQ0vTKuzgRosW3ZuS/zNldeojR+Iqw9QYW09JyLw1/j+SsfGaEHWmgCXhE M4pV1gPaeAczDFDFgLxoYxq/AWgszvQzgnsXAeqWnAXs+nOGVAuALhw8WoGnB/gaOjqw +cBbdjlgJY1H+Sp6hoFO2Y4NwR6oEHggTEhUG4LFv25AINPCds8Ak0Yi+IlZso9rJAgb hd2A== X-Gm-Message-State: AOAM533mMA3VIygg6y4ybkdQLqZa8gjM4eTMcpnY4wXd47LnG0wIcXzj 4ZfquG0Gx4ojU3lrFfYgh0MIyB64rGQ= X-Received: by 2002:a05:6a00:cd0:b0:49f:b198:97a5 with SMTP id b16-20020a056a000cd000b0049fb19897a5mr12770887pfv.80.1636712548885; Fri, 12 Nov 2021 02:22:28 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f19sm6030563pfc.122.2021.11.12.02.22.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Nov 2021 02:22:28 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Nov 2021 18:22:13 +0800 Message-Id: <1636712536-13114-8-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> References: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 08/11] avcodec: suppport for s210 encode X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 4zdZUoUJOpNy From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/s210enc.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 libavcodec/s210enc.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 1d75cfe..69734ca 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_S210_DECODER) += s210dec.o +OBJS-$(CONFIG_S210_ENCODER) += s210enc.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 c461798..77f5ed4 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_s210_decoder; +extern const AVCodec ff_s210_encoder; extern const AVCodec ff_bmp_encoder; extern const AVCodec ff_bmp_decoder; extern const AVCodec ff_bmv_video_decoder; diff --git a/libavcodec/s210enc.c b/libavcodec/s210enc.c new file mode 100644 index 0000000..c24f466 --- /dev/null +++ b/libavcodec/s210enc.c @@ -0,0 +1,90 @@ +/* + * S210 decoder + * + * 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" + +static av_cold int encode_init(AVCodecContext *avctx) +{ + if (avctx->width & 1) { + av_log(avctx, AV_LOG_ERROR, "s210 needs even width\n"); + return AVERROR(EINVAL); + } + + avctx->bits_per_coded_sample = 20; + avctx->bit_rate = ff_guess_coded_bitrate(avctx); + + return 0; +} + +static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, + const AVFrame *frame, int *got_packet) +{ + const int buf_size = avctx->height * avctx->width * 20 / 8; + int ret; + uint8_t *dst; + const uint16_t *y; + const uint16_t *u; + const uint16_t *v; + PutBitContext pb; + + 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, 10, av_clip_uintp2(*u++, 10)); + put_bits(&pb, 10, av_clip_uintp2(*y++, 10)); + put_bits(&pb, 10, av_clip_uintp2(*v++, 10)); + put_bits(&pb, 10, av_clip_uintp2(*y++, 10)); + } + } + flush_put_bits(&pb); + + *got_packet = 1; + return 0; +} + +const AVCodec ff_s210_encoder = { + .name = "s210", + .long_name = NULL_IF_CONFIG_SMALL("10-bit 4:2:2 packed"), + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_S210, + .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, +}; From patchwork Fri Nov 12 10:22:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 31376 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp1633823iob; Fri, 12 Nov 2021 02:24:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdoII0wsHuJIe7K/eLuOt8djYkjF/UkdiyAihsJF9rTPv/nT8IjzwC8jaLouKlNZv8ghDy X-Received: by 2002:a17:906:11ce:: with SMTP id o14mr18708831eja.457.1636712647975; Fri, 12 Nov 2021 02:24:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636712647; cv=none; d=google.com; s=arc-20160816; b=q4f5UVswKLqF0cOcS18KOf5etB/xrvbxUF7/druN6BW+/66U7NMJwfAgjJXCjrV4kR YQ5ix2B2MGHPzSXkYUVEZnYCmv6UvoxJtPABumTGsqCDZVUnWRPTqmxn2CJw79t64z+O CRSIn/aLA+XJaIV5EULINLakGy2HBtEmUxlqM9jx/Hvl24DtGG1pH7ULr/U9qdzd3C5C dBPO/vhfzzXjvmMOw58IUEmof3ipt51EgV8ysbhgNiCxX5mnnUWsEs4+yniNjAmaiZFV 3Ct3FnByeZyy7Q2mou5ocx7uvLLju30ppOPGtWrxV2GXuQe8qa/cQvOXnKA1xNdQLUH7 BBrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=FewngQMfbRY9sNK/mfZ9ABXflYkCDClKpuhnGQWegwI=; b=IT3DXWlePb1/QBDxAlddgZT3XEz0YluiWlePrOSKHGOQPnZM+VqZ4aiVuCDql/TjIm Y7P0KcH6k0+5HUz0aMGKeJYxDfBAgoXSTixCKTZBMKUrD96EqQzYmpcoC/VcxhAHAB0q EB85EC7r2wJsCwc6nFuY45AA/cRG3Pi0bfTKGiWtWLHzuVfenwiTrpyVpXDn5FAbRN67 DSuKaIYLvqDYTpmpVJDSsHsc5+HXZZt3Q/Pgcw1W6KnCnqueH9LdivEDu8axAtTMAlxH oBP54dP05cGwC6VIrsvTvUaaSnm21Tnzi1cW2cqqiN99syzDCoF7iGySe1emzRmsEKQ0 hjSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=d+YyTj7F; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g26si6192345edu.322.2021.11.12.02.24.06; Fri, 12 Nov 2021 02:24:07 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=d+YyTj7F; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 31FA668AE86; Fri, 12 Nov 2021 12:22:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DAD2D68AE21 for ; Fri, 12 Nov 2021 12:22:31 +0200 (EET) Received: by mail-pj1-f44.google.com with SMTP id gb13-20020a17090b060d00b001a674e2c4a8so7210533pjb.4 for ; Fri, 12 Nov 2021 02:22:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TpKVtWiZef5A9xnhg8bTuYcfTOX9Vj5ABLfJpvU7fSU=; b=d+YyTj7Fj7Eq6G6PACiizUI9ABmv3ExdYyaUBn/JiVJyaOlpfmskQXuhJy6/Dgcj3W VHWqp7/0yGPnwoaXaJswivm4weeDYm5b8ReYKoMyBA7SWn2qiIM8q/6P9I5EyOfCu/jQ m5sTZlIz1q35c2j3I0p0RTjG0KdCptfxohzvKNfNE6tQYQz6q6Rw09lFeXPVXo70tHBA 5qulLXz87+4iqJBakWg5KYXoPcu2adHVVIakL40shgq3voSbuUbxQLOlfA+Jc7J7HSah p0kZesiLei5/ZPBuZO86NRE5Qmw4+yfcxGwTivaZ7YDD/Ic8+dT52W1Pp6o0mEN8gVSf d9Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TpKVtWiZef5A9xnhg8bTuYcfTOX9Vj5ABLfJpvU7fSU=; b=cALLwacNRP9TWe5NtGQObbTCQQYeNZSBQIRAvudjxoyBPHGaShfFsjCH91cQxsQXG4 syNX5rTzGXED1fXjrZtclQIJNf+RBw3uJfd1cgBdetV+yW2oTOcjhZIRSyR6lfRRoa4Z /q9IGaCMKb80AhZQLeeAE9A+UlEuTc4SH4cEfVSzQGrPaXUoLGJyVVDNnIo037bo5z0e 8dqEoRRjxlcuEMmxm3eNq/K5nn2NWvyQ2gTwu6kV79epH4gy1RJqDgLg8qcDOEQjmLtC deIKinL/+p9XVjhMJNIwuBobJUVofo06ZG93uj767tStzycMAsFYQSn4UQOVY1+j/hQE Ctvg== X-Gm-Message-State: AOAM532vmmrektVr5YaAXB3p8y+FGSrdfzrG3jsvEtljZQwtccx/INMu zjuqPkURdFQ3IKiVCAKpvgLSN/FnIeo= X-Received: by 2002:a17:90b:4aca:: with SMTP id mh10mr16641868pjb.234.1636712550088; Fri, 12 Nov 2021 02:22:30 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f19sm6030563pfc.122.2021.11.12.02.22.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Nov 2021 02:22:29 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Nov 2021 18:22:14 +0800 Message-Id: <1636712536-13114-9-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> References: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 09/11] avformat: suppport for 4:2:2 10-bit for rfc4175 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: DkTwfrSeaKEj From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpenc.c | 2 ++ libavformat/rtpenc_rfc4175.c | 4 ++++ libavformat/sdp.c | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index 4f115cc..a60e647 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -85,6 +85,7 @@ static int is_supported(enum AVCodecID id) case AV_CODEC_ID_SPEEX: case AV_CODEC_ID_OPUS: case AV_CODEC_ID_RAWVIDEO: + case AV_CODEC_ID_S210: return 1; default: return 0; @@ -620,6 +621,7 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) case AV_CODEC_ID_MJPEG: ff_rtp_send_jpeg(s1, pkt->data, size); break; + case AV_CODEC_ID_S210: case AV_CODEC_ID_RAWVIDEO: ff_rtp_send_raw_rfc4175 (s1, pkt->data, size); break; diff --git a/libavformat/rtpenc_rfc4175.c b/libavformat/rtpenc_rfc4175.c index b6f833b..38f9611 100644 --- a/libavformat/rtpenc_rfc4175.c +++ b/libavformat/rtpenc_rfc4175.c @@ -37,6 +37,10 @@ void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size) xinc = yinc = 2; pgroup = 4; break; + case AV_PIX_FMT_YUV422P10: + xinc = yinc = 2; + pgroup = 5; + break; case AV_PIX_FMT_YUV420P: xinc = yinc = 4; pgroup = 6; diff --git a/libavformat/sdp.c b/libavformat/sdp.c index cc04d70..fdce4f5 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -660,6 +660,7 @@ static char *sdp_write_media_attributes(char *buff, int size, AVStream *st, int p->width, p->height, pix_fmt, config); break; } + case AV_CODEC_ID_S210: case AV_CODEC_ID_RAWVIDEO: { const char *pix_fmt; int bit_depth = 8; @@ -668,6 +669,10 @@ static char *sdp_write_media_attributes(char *buff, int size, AVStream *st, int case AV_PIX_FMT_UYVY422: pix_fmt = "YCbCr-4:2:2"; break; + case AV_PIX_FMT_YUV422P10: + pix_fmt = "YCbCr-4:2:2"; + bit_depth = 10; + break; case AV_PIX_FMT_YUV420P: pix_fmt = "YCbCr-4:2:0"; break; From patchwork Fri Nov 12 10:22:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 31380 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp1634023iob; Fri, 12 Nov 2021 02:24:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCNKyqLaEmY5b4+Np6fSyqr6tTGEfR3b6QtcGc0F58CoABbyhq+xSrf7Rtydm6Zb+uigEo X-Received: by 2002:aa7:c501:: with SMTP id o1mr19386397edq.99.1636712657431; Fri, 12 Nov 2021 02:24:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636712657; cv=none; d=google.com; s=arc-20160816; b=LWiEH7KN0SyCRrneZAFgAfW1WuWPMUY7COqxEnhJKcNWdBdWKzUf5tbuL64gMvdtmM oDdWvqU5Dj3axurEhgQfepCLCuSXlFLj/Q8ZyOmj/RnBU4M91VfybTUrZ/JsCcnuRu50 wYnm8b66Pa7g1JU9cSolakkRs//cZMMiCjSiAbBZAFVVDb684+4Olz2PlFK2QZsfHj9X 25iLpbKDvg74mUqQYX1Hgq2r9vKECWSwHelRV8I3kMN9V4Ricj9duY4cU+KVSPXFveum v4dOzI0VvXyz5wdoFlmdpIixZy64H0wEIyCXRWH+JWwAWavxBWdGZg0KlzFeqEoYNPGL /iPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=g1d4PT2ogXVHgwt63nejFXOsxhT3UqhvRzy1AyBNPTE=; b=b1BNifRnhMbYPM0FIXF8UgO/fRBPLY6+9Egtoc4MBYsSpxDlO73GFODXdC9ZEeD6ug MxhM88zk8ghBYGtIac1f1pEwXl4uM100oqx7mABBhwAC+CyKvl+uOqQHniGoyAOgXZDQ 98rLY49uMAXzkhap+hav8mzPzOmvmYxDbyIi7kKbzGrO43BMyylkW6cTfYqNj++vpE5l PzWw6/Rlym8yKfhaajdqJ+wxmlxwT0K+m8tNIQ/ZidgE2pE/WrU4vqCI4Swj6EkjUWWy uRAMDjEWlW9FQK8l1/B6/P3fsjp33kP6wCrxkSNiaDJfns7bIIAkmp5kiNCLXOYaxnWB jKwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=B+wy7pli; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id cw2si18348963ejc.730.2021.11.12.02.24.17; Fri, 12 Nov 2021 02:24:17 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=B+wy7pli; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 485A568AE8D; Fri, 12 Nov 2021 12:22:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1B1D868AE70 for ; Fri, 12 Nov 2021 12:22:33 +0200 (EET) Received: by mail-pg1-f170.google.com with SMTP id g28so7661874pgg.3 for ; Fri, 12 Nov 2021 02:22:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SYJ1WN8KgQm6PGiqFrFYr4d/GRSTvZ9HtK2nJiB9MHM=; b=B+wy7plijszCN1IcCoPOg6HGds2jtQYD1tRzxgSXsVJ7wCHadWiNOUz/d/zccLx78m TmS5rhdHzvZ/Oq13wIGVrSZauEHKIYFQHRsrqo1XcMEBh+XcCnbs3oSuYbtNPpnqLswp a42tGgw0KbBoIDhaYO+7tbN66rkWZjlFRIyfWMv8oGS+tamyjozohNR/FW32AgfyqYCH ma8GNCd2XenXpdRMnG6b2YpaJLuuaSSPgad97JJdf3L0Si8C1BclIaz6iv5tABSxcjOr jADLuu3PALTqCEE9K83MJyyVRSG8Xt1UcVBkDSg6GrvWUMJo1qa/lG1YguTQ6XNhE+Sv fx6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SYJ1WN8KgQm6PGiqFrFYr4d/GRSTvZ9HtK2nJiB9MHM=; b=PDqqwStipaZev13JJ3ZTNa0y1BFRyWIMpklQVqbn3HOKATLCmPAcSN5HFALh0+JN31 F8CJVo3tEpdT7q7ruKqaTP2cNEm0z/HSasvsa2bH1E5hbCptiDB1YmjiNBPTB6PxHk75 7LptWvwWi+gv1t7187rkZ4tfCFzcxxYJ83Y6g+n4laGOuyMST8eMJ78EIpw6WKbjWkP+ eMQ8A2e2ygcB2zMR08MI3Kzhop0OFOYYDp8Cpbg29xxCz7DR+7TuVSSBnQGWS8d8tpXP 5aEVmtA3OQVXM1W6wJN6F0qyE/elLXcql5mv5nC49VsitOme0jJLwZBJXOW3xRY8Qh6A Wp2Q== X-Gm-Message-State: AOAM5311/8t/MUFRMhC9LpRJ8fxmfpJNinRy5dTLEy9pi7LgyoZB5aYc PZ04Y5TwcUtG6ZpVJQAxQyxIS2EHi5s= X-Received: by 2002:a63:182:: with SMTP id 124mr9212303pgb.172.1636712551307; Fri, 12 Nov 2021 02:22:31 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f19sm6030563pfc.122.2021.11.12.02.22.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Nov 2021 02:22:31 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Nov 2021 18:22:15 +0800 Message-Id: <1636712536-13114-10-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> References: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 10/11] avcodec/s210dec: support 4:2:2 10bit only and remove the EXPERIMENTAL capability X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: VF80ws7uGocp From: Limin Wang Don't need set the pix_fmt to YUV422P10 anymore. Signed-off-by: Limin Wang --- libavcodec/s210dec.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavcodec/s210dec.c b/libavcodec/s210dec.c index 7bc5dbc..a89546f 100644 --- a/libavcodec/s210dec.c +++ b/libavcodec/s210dec.c @@ -83,11 +83,9 @@ static av_cold int s210_init_decoder(AVCodecContext *avctx) if (!avctx->width || !avctx->height) return AVERROR_INVALIDDATA; - if (avctx->bits_per_coded_sample == 20 && - avctx->pix_fmt == AV_PIX_FMT_YUV422P10) - bc->decode = s210_decode_yuv422p10; - else - return AVERROR_INVALIDDATA; + avctx->pix_fmt = AV_PIX_FMT_YUV422P10; + avctx->bits_per_raw_sample = 20; + bc->decode = s210_decode_yuv422p10; return 0; } @@ -120,6 +118,5 @@ const AVCodec ff_s210_decoder = { .priv_data_size = sizeof(struct S210Context), .init = s210_init_decoder, .decode = s210_decode, - .capabilities = AV_CODEC_CAP_EXPERIMENTAL, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; From patchwork Fri Nov 12 10:22:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 31375 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp1633181iob; Fri, 12 Nov 2021 02:23:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCRqiOHX5qKX9CQka+Ztml9k3d9oxjF1ByRuwWpPwb6ayVgNRXJvdfOIUl2GLOvGM+rcNG X-Received: by 2002:a17:907:869e:: with SMTP id qa30mr17475317ejc.356.1636712617385; Fri, 12 Nov 2021 02:23:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636712617; cv=none; d=google.com; s=arc-20160816; b=n+SBo79Nts4Ol0kWMIFNCPsNswgjf6Rh1Cla9Zhhn5hBOsQRUfsvyMvmwC0fMDr/ds MSFvpSh9ApFGPHq4moChKZhWLS8g4O8oPOhh+wZN9laM7H+PRESK0NT12B/fnqkEh6w9 7f2O4x6ybuCK5lGORsdPLuCfmpx5uxBb71tX7ZmydqARziL1W2i+0lEB9dvs5/Cdrvx1 SZ+UxZqK0biiSusTjZY1ppTVbmbdyDJ8ZAXhqa/12+vqjqWl+0QoJ7KIBPO6QM8cf268 VHGx/ISXrHtmKm/oP6tklzcWwqAl1klymvO9F8YFlEUywR+x4ybpJu2ky9FO3ofpQD3Q 6azQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=iSEV7yhWCk0DhYp6sqA50oESvaCV4HCVwU+/Zfefi/4=; b=mrHkni2h7FxlTLgDE30Ii4B5DBJwer+4uG+idfuAtdjpmOc14zMwlOGfFHatK4cSiE uUGQCbRuaAX2jsQBMVPPzPVdVjAAZZ+S4ZJH3xrEa9qVzGFZ7ZQy7L4HzFN4mOLbX8Ie ABya8FYIq9muIhx0TYS8Uq3gWiwB/EQ0E29InpyOq5l3jLSmjQm0H15oFPURBNGbhy2K JHDJc+GAo1vVJMMjOxUCRT5yFfdLBvqALeDO6OhwHwOlzGB1ovFbCQYtebzroCFrYevD JqpDGJyEqtV3Ri8kZEdyRbQrQJmtDZzc3bdBDZrey5xOSPYeFu3yqKayh+mT1ZxtHHl0 Wg7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ZN2DCG3s; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a42si7732881edf.337.2021.11.12.02.23.37; Fri, 12 Nov 2021 02:23:37 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ZN2DCG3s; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 11C1268AE5D; Fri, 12 Nov 2021 12:22:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4EBE568AE14 for ; Fri, 12 Nov 2021 12:22:34 +0200 (EET) Received: by mail-pf1-f180.google.com with SMTP id x131so8095219pfc.12 for ; Fri, 12 Nov 2021 02:22:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=X/uCGAC0HBigtSmqZZSH0jCWoYD1Crz2aGxQTwHhUSI=; b=ZN2DCG3sSCDTer2VGSo65SA5d+RFFAxR+7ooHeS+gf77Csl1UpG3MI8vzUDv9HffaZ JYfPUfXbtnwSGqFGsmfHkhCEk9mentGXfO58KmVr2j9kNoOhfj1f0/sLAXFN6kR45XOe gSIxykvrHwieWVlOzwfEr3pAnIZgZ9yXVPo6wJfGuMaAWlB0jTJZtu6UDEGK66FrfCnM htoIGJzStVWmXdk9nq3IlDzJnay9zYNjvuLG4870I46wR37DN7lPqEaauuzYOQnR5hrg 6Mg3Fg50uQTfvLdVvOYsRQAc5kecx2tCe8tX/NczbR082XH82U3HhtEYKnlDb6024TFN q41Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=X/uCGAC0HBigtSmqZZSH0jCWoYD1Crz2aGxQTwHhUSI=; b=ROjt94bApERGNyfAwpfHZQnKbfrDBuMNStAQPBabtLZj9nJPJu1Z7Nq7BFu2suTeEz HgRws/6ILPEheZRXPb1sb24SeVlDDMOfCYyjBLfQ/qBwLAp4fuXLTstVzQ67lE+PcPI+ Gs8+pAHSqYiB/UgfV9/3fzt+1V2czjq5HL2hpmg41QYZ2xP/q1QWfpDdH+aSBaHtaRNJ YPrUvKcPDI7BlCNYA840FNRlIcbTgCc/2i9AlaaHab75DlBFQmkdsmcmNUUU4acz9FOH rynrxHl/V6pSY3GZKeEFuHrX7d7MXykIywnnt7Cf9diwJ1mXiZX9qfoe22kkdzhZYxi7 S9qA== X-Gm-Message-State: AOAM530+dFUrTOw/4s/8n5sfnqB5XLSIWepxel9Gh0/GrABkDlm3xnad xp5sHMAHswIEaNys9FZgDzk/WhbYKY8= X-Received: by 2002:a63:6b08:: with SMTP id g8mr3361833pgc.253.1636712552591; Fri, 12 Nov 2021 02:22:32 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f19sm6030563pfc.122.2021.11.12.02.22.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Nov 2021 02:22:32 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Nov 2021 18:22:16 +0800 Message-Id: <1636712536-13114-11-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> References: <1636712536-13114-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 11/11] avformat/movenc: add s210 4:2:2 10-bit packed X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: oYjjTTEemCwc From: Limin Wang S210 is not regiestered by official registration authority yet, so the patch is just to help testing s210 encoder/decode locally. Signed-off-by: Limin Wang --- libavformat/isom_tags.c | 1 + libavformat/movenc.c | 1 + 2 files changed, 2 insertions(+) diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c index 62e6047..fccf140 100644 --- a/libavformat/isom_tags.c +++ b/libavformat/isom_tags.c @@ -58,6 +58,7 @@ const AVCodecTag ff_codec_movvideo_tags[] = { { AV_CODEC_ID_AVUI, MKTAG('A', 'V', 'U', 'I') }, /* AVID Uncompressed deinterleaved UYVY422 */ { AV_CODEC_ID_AVRP, MKTAG('A', 'V', 'r', 'p') }, /* Avid 1:1 10-bit RGB Packer */ { AV_CODEC_ID_AVRP, MKTAG('S', 'U', 'D', 'S') }, /* Avid DS Uncompressed */ + { AV_CODEC_ID_S210, MKTAG('S', '2', '1', '0') }, /* 10-bit 4:2:2 packed */ { AV_CODEC_ID_V210, MKTAG('v', '2', '1', '0') }, /* uncompressed 10-bit 4:2:2 */ { AV_CODEC_ID_V210, MKTAG('b', 'x', 'y', '2') }, /* BOXX 10-bit 4:2:2 */ { AV_CODEC_ID_V308, MKTAG('v', '3', '0', '8') }, /* uncompressed 8-bit 4:4:4 */ diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 37d4403..e0c46cb 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2125,6 +2125,7 @@ static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex int uncompressed_ycbcr = ((track->par->codec_id == AV_CODEC_ID_RAWVIDEO && track->par->format == AV_PIX_FMT_UYVY422) || (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && track->par->format == AV_PIX_FMT_YUYV422) + || track->par->codec_id == AV_CODEC_ID_S210 || track->par->codec_id == AV_CODEC_ID_V308 || track->par->codec_id == AV_CODEC_ID_V408 || track->par->codec_id == AV_CODEC_ID_V410