From patchwork Mon Sep 5 18:29:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Anthony Lemieux X-Patchwork-Id: 37678 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp2797195pzh; Mon, 5 Sep 2022 11:30:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR6cMMiVCeljU4EK1p+ju9gSC2vINdyr6Cs9pUcd4j2r5P7EJ5/nqABPmXLpxVWUpY6eioh0 X-Received: by 2002:a17:906:ee89:b0:73d:70c5:1a4e with SMTP id wt9-20020a170906ee8900b0073d70c51a4emr35040399ejb.683.1662402612859; Mon, 05 Sep 2022 11:30:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662402612; cv=none; d=google.com; s=arc-20160816; b=YWhs9fOW9xLLm6lZxo63jsIIGEblyFOpfgljGYNzabDtbX8cFDg62HUzBmyof4oEL+ aWDcH6roRMSkkRAqvImJ4KECsJyN7JPBOmaMQQak/HcDEmCf4stU3zBOAOBgmeMiQazm QdbVy6UcEn7VMHGCYkVzvlZtU+esNSapaU5MNeGxTwcFNrHr21qBcv2bmyCen1O+Emxu Uu/nW4JbYkVbUr97U6Zn9zRn6q4y0gJBokLBRUwi5OlPbhEa55+H+MBuwqak6/N/oczn cY1Y8nBegAn33hBugMEVohGF2Rhndy+LPD0SqpugUwnk/svc9ztqbTkpdM0GGdisTCeO W67A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=pFlRqXzX9ZqFveASLTm4duRb9ZDa77yS2GAYGt87l8I=; b=rgthGx5JYnKgYwcNccy8kcLz1TK54tXMzEZs54xIOsFatC1olg3bBQ+5qryBZ/q+Wk QQDnkUTevCOBhLKdzZNHmILJZhsqld7KhoBVODnGJfBvqKXnGoXbrR7gXSRGMGQ52W10 QpARrj6b2wnDL5NmQ8CqFOdq4Z5WhYl41th+dZkuz8U8NQ1r2zTkJvn5ysSS0ZqTs2RX /ufNkmfSVhqA6peWnvtlp+z8y5tq1/Vj99LONyAv5fWufirQlo6xXtnsISYesfJRd+ky jIil7YS5VglSFtWuxFZO93Gf/iDgl905XoLaUs/qtHD9tajMvB3GgbU7L2nYND4ZiVL/ QPwA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id gb5-20020a170907960500b00738553043e5si8418725ejc.573.2022.09.05.11.30.12; Mon, 05 Sep 2022 11:30:12 -0700 (PDT) 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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7B0E568B462; Mon, 5 Sep 2022 21:30:09 +0300 (EEST) 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 104DB68B462 for ; Mon, 5 Sep 2022 21:30:03 +0300 (EEST) Received: by mail-pg1-f170.google.com with SMTP id q63so8652016pga.9 for ; Mon, 05 Sep 2022 11:30:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=Lrw5R/hNXKERm8GnKiYZEcShdcR708bJGSMLoP3u28s=; b=Qc+NyE1R94BwkAaM7sMxlqZ40M0WNIZpjInOiXmVmbV8bhTBfIfhUa0rIhDG0m5LWy En2sATQhyKWh4zpjgTdh8+xiop0fADQvqWihd7K3D/DJ9F3X3cOZ2zhvy936DCn5/lKF Aa3k/nTAFSKU0bjnkl2l23HuMrcMJ9Y8AB+i/pwqIAFAZxVxFcmHBDS9k7TZMoW2D+Wm Qbt3pZPEt0Ojvdv/CzAILlM4gZ39J/S3c5eZTQ/JdmKgxX/Y6dkiI0il3o31TGVCYZHp PM9pN1QHrnN6Fi+9hMPZGYHdUlTcz0OhXZALIuCf1A1raPWxIA0nheYXJmivWARsFDSj b54Q== X-Gm-Message-State: ACgBeo1KbyS7+280+1/qY+maqIL7nx26ZZ0CzHM25qBmtvUvxQoYRXoe Usvts6aFRQf/HtVeZTJefSX8OnxdRPI= X-Received: by 2002:aa7:9019:0:b0:535:fb2e:4ae9 with SMTP id m25-20020aa79019000000b00535fb2e4ae9mr50750035pfo.72.1662402600660; Mon, 05 Sep 2022 11:30:00 -0700 (PDT) Received: from localhost (76-14-89-2.sf-cable.astound.net. [76.14.89.2]) by smtp.gmail.com with ESMTPSA id e23-20020a170902ed9700b00176c431e7e2sm919071plj.13.2022.09.05.11.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 11:30:00 -0700 (PDT) Received: by localhost (sSMTP sendmail emulation); Mon, 05 Sep 2022 11:29:37 -0700 From: pal@sandflow.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Sep 2022 11:29:31 -0700 Message-Id: <20220905182932.7134-1-pal@sandflow.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/2] avformat/mxf: set stream frame rates for ST 422 essence containers 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: Pierre-Anthony Lemieux Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: FswEOZmKi+KU From: Pierre-Anthony Lemieux The MXF demuxer does not currently set AVStream::avg_frame_rate and ::r_frame_rate when J2K essence is wrapped according to SMPTE ST 422. --- libavformat/mxfdec.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index feebff67aa..043e2e06ec 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2140,6 +2140,13 @@ finish_decoding_index: return ret; } +static int mxf_is_st_422(const UID *essence_container_ul) { + static const uint8_t st_422_essence_container_ul[] = { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0c }; + + return essence_container_ul && mxf_match_uid(*essence_container_ul, st_422_essence_container_ul, + sizeof(st_422_essence_container_ul)); +} + static int mxf_is_intra_only(MXFDescriptor *descriptor) { return mxf_get_codec_ul(mxf_intra_only_essence_container_uls, @@ -2892,6 +2899,24 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) av_log(mxf->fc, AV_LOG_INFO, "Unknown frame layout type: %d\n", descriptor->frame_layout); } + if (mxf_is_st_422(essence_container_ul)) { + switch ((*essence_container_ul)[14]) { + case 2: /* Cn: Clip- wrapped Picture Element */ + case 3: /* I1: Interlaced Frame, 1 field/KLV */ + case 4: /* I2: Interlaced Frame, 2 fields/KLV */ + case 6: /* P1: Frame- wrapped Picture Element */ + st->avg_frame_rate = source_track->edit_rate; + st->r_frame_rate = st->avg_frame_rate; + break; + case 5: /* F1: Field-wrapped Picture Element */ + st->avg_frame_rate = av_mul_q(av_make_q(2, 1), source_track->edit_rate); + st->r_frame_rate = st->avg_frame_rate; + break; + default: + break; + } + } + if (st->codecpar->codec_id == AV_CODEC_ID_PRORES) { switch (descriptor->essence_codec_ul[14]) { case 1: st->codecpar->codec_tag = MKTAG('a','p','c','o'); break; From patchwork Mon Sep 5 18:29:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Anthony Lemieux X-Patchwork-Id: 37679 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp2797496pzh; Mon, 5 Sep 2022 11:30:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR4J0N0nxvUVQhhIgSzw8AcVfP3/rHjxdOox0pfMGezO2V0EDq1QG4AdDT1MT0+1ALGNamRd X-Received: by 2002:a05:6402:90e:b0:443:ec4b:2b03 with SMTP id g14-20020a056402090e00b00443ec4b2b03mr43458636edz.71.1662402650986; Mon, 05 Sep 2022 11:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662402650; cv=none; d=google.com; s=arc-20160816; b=fzRNqCdBq0ybZHBbQUJMstbKo28m2lAiDL51ovA6TsHIpGiDK1l6abQ0DQ6MbCXwO8 lf4ytTb32DJsvJ+Vzws4I1Z7jp0BgfkySM2lptWcwHuTJV0ZUPaed5d0N9G7UVExSi/I nAO/m6vgJQyCg34ZAxDnZN3aBbzgwOsqgHt2IhJomLyIiDwe+P2BK3X1gsZ7IBlDk97g EnWYpBx0tJMJmcHMHP/PdtX9l30wjh3gl2BSdRlAkHUzA2ksRzMIxUUc5PbTzYfAchR5 2NRbQc9v7+BGEo4RLZIOfbUv8g3ZuzIZMWj3dJo0uuYXXQwfUWJoCRerVMNE4PVZixAd 5cew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=hxmDdcQCnwl2EOX6yJIS3MT58zIwS0G+EJsZythzVzg=; b=eQICQMWIZTN/fsls0jAw36CXVZxyMpLZHc/PNDRn/CCktmPH3zhkdbS3ax5djIr83W NZ5JX7kWP4eTsI/9k8ltZFtqf8qxTkL0oHoCfTR1MAOXEHf/YivfUMp+S81CE+YFF5/a VY+9oCg9nr3OBjVV/ZpaLMb2Kqv9qDkBWP809VrKyftvCQzWcpY6uae0w3zF0pvzY9R8 knIn/CzblEQKRpBBo71aAIy03ApwkJUFwv5leMH+wx2gf5dcnldwluIj/7LRPYUqV+5w YbwFEl4kCcCfE8NEPOwoyfbRzyMYqqf5MLx9TeRwQ4jxKFu7Ffgql7cd+64DopJguPS5 1mPw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r1-20020aa7da01000000b004466b489152si7062397eds.472.2022.09.05.11.30.50; Mon, 05 Sep 2022 11:30:50 -0700 (PDT) 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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A2B5268B972; Mon, 5 Sep 2022 21:30:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2034A68B64C for ; Mon, 5 Sep 2022 21:30:42 +0300 (EEST) Received: by mail-pl1-f178.google.com with SMTP id c2so9163912plo.3 for ; Mon, 05 Sep 2022 11:30:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=28HuUA54QODsEKYRsTzMCLy9ioIyA/6X16F9V03GOq4=; b=NprhcikS2Az8GlRJ/nc+MjpCri02Eb55ZrlZ/e1DIBqm+1zDaH6cOZcMfs+/A2P+4f CdC52YfSa0GwBwbXH5Qr1Hfxv6v6bR+0rAPqoqJDcT/OvTGHsX6YzUWpSpaAwmdq4qFH sm21MEgHJabdpvSH9N2I13IW7Nu2RdLnVQ2WRiaP7dsLTad0lGUp+GqsN4TR06m4/gim kky7y9Eg8eB+FuAIXcjShMJVDrHsC5ed5u6hnpYrUFQHGSnjimRuhjXXYd0pTMkCdkIB r/7QzHh0vNad3+2OsbnqEi0+9oa3BMXWIVMO6ct0qqaVR4/E9VmSHXdTLDYP9sth7PUL MV8g== X-Gm-Message-State: ACgBeo0PtiSkHyAkOzlIVuv3e6Fn39kG5AZ8U0gNznyw5RcBbqByaic/ r9fyLP15Fb+WqiZR3okbwNziRyn7lb0= X-Received: by 2002:a17:902:ce11:b0:172:6f2c:a910 with SMTP id k17-20020a170902ce1100b001726f2ca910mr51242684plg.156.1662402640003; Mon, 05 Sep 2022 11:30:40 -0700 (PDT) Received: from localhost (76-14-89-2.sf-cable.astound.net. [76.14.89.2]) by smtp.gmail.com with ESMTPSA id d62-20020a623641000000b0052d98fbf8f3sm8152905pfa.56.2022.09.05.11.30.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 11:30:39 -0700 (PDT) Received: by localhost (sSMTP sendmail emulation); Mon, 05 Sep 2022 11:30:17 -0700 From: pal@sandflow.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Sep 2022 11:29:32 -0700 Message-Id: <20220905182932.7134-2-pal@sandflow.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220905182932.7134-1-pal@sandflow.com> References: <20220905182932.7134-1-pal@sandflow.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/2] fate/mxf: add JPEG 2000 test 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: Pierre-Anthony Lemieux Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: MelzLJ6fyAVE From: Pierre-Anthony Lemieux --- tests/fate/mxf.mak | 4 ++ tests/ref/fate/mxf-probe-j2k | 78 ++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 tests/ref/fate/mxf-probe-j2k diff --git a/tests/fate/mxf.mak b/tests/fate/mxf.mak index 3ab936b5de..38d1c2ef38 100644 --- a/tests/fate/mxf.mak +++ b/tests/fate/mxf.mak @@ -29,6 +29,10 @@ FATE_MXF_PROBE-$(call ENCDEC, DNXHD, MXF) += fate-mxf-probe-dnxhd fate-mxf-probe-dnxhd: SRC = $(TARGET_SAMPLES)/mxf/multiple_components.mxf fate-mxf-probe-dnxhd: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" +FATE_MXF_PROBE-$(call ENCDEC, JPEG2000, MXF) += fate-mxf-probe-j2k +fate-mxf-probe-j2k: SRC = $(TARGET_SAMPLES)/imf/countdown/countdown-small.mxf +fate-mxf-probe-j2k: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" + FATE_MXF_PROBE-$(call ENCDEC2, DVVIDEO, PCM_S16LE, MXF) += fate-mxf-probe-dv25 fate-mxf-probe-dv25: SRC = $(TARGET_SAMPLES)/mxf/Avid-00005.mxf fate-mxf-probe-dv25: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" diff --git a/tests/ref/fate/mxf-probe-j2k b/tests/ref/fate/mxf-probe-j2k new file mode 100644 index 0000000000..2dbf2ac37d --- /dev/null +++ b/tests/ref/fate/mxf-probe-j2k @@ -0,0 +1,78 @@ +[STREAM] +index=0 +codec_name=jpeg2000 +profile=1798 +codec_type=video +codec_tag_string=[0][0][0][0] +codec_tag=0x0000 +width=640 +height=360 +coded_width=640 +coded_height=360 +closed_captions=0 +film_grain=0 +has_b_frames=0 +sample_aspect_ratio=1:1 +display_aspect_ratio=16:9 +pix_fmt=rgb48le +level=-99 +color_range=unknown +color_space=unknown +color_transfer=bt709 +color_primaries=bt709 +chroma_location=unspecified +field_order=progressive +refs=1 +id=N/A +r_frame_rate=24/1 +avg_frame_rate=24/1 +time_base=1/24 +start_pts=0 +start_time=0.000000 +duration_ts=24 +duration=1.000000 +bit_rate=N/A +max_bit_rate=N/A +bits_per_raw_sample=16 +nb_frames=N/A +nb_read_frames=N/A +nb_read_packets=N/A +DISPOSITION:default=0 +DISPOSITION:dub=0 +DISPOSITION:original=0 +DISPOSITION:comment=0 +DISPOSITION:lyrics=0 +DISPOSITION:karaoke=0 +DISPOSITION:forced=0 +DISPOSITION:hearing_impaired=0 +DISPOSITION:visual_impaired=0 +DISPOSITION:clean_effects=0 +DISPOSITION:attached_pic=0 +DISPOSITION:timed_thumbnails=0 +DISPOSITION:captions=0 +DISPOSITION:descriptions=0 +DISPOSITION:metadata=0 +DISPOSITION:dependent=0 +DISPOSITION:still_image=0 +TAG:file_package_umid=0x060A2B340101010501010F201300000035E05073878E4B2FB69D2369F25ADFC9 +TAG:file_package_name=File Package: SMPTE ST 422 / ST 2067-5 frame wrapping of JPEG 2000 codestreams +TAG:track_name=Image Track +[/STREAM] +[FORMAT] +format_name=mxf +duration=1.000000 +bit_rate=577792 +TAG:operational_pattern_ul=060e2b34.04010101.0d010201.01010100 +TAG:uid=f1994e51-a844-49e4-9459-1ddd622eb65d +TAG:generation_uid=1be151ac-cc95-4314-b09f-7420eda9932b +TAG:company_name=Sandflow Consulting LLC +TAG:product_name=dcdm2imf +TAG:product_version_num=0.0.0.0.0 +TAG:product_version=1.0-beta1 +TAG:product_uid=927fc4d1-89a3-4f88-88bb-d363ed33084a +TAG:modification_date=2022-01-07T22:05:01.000000Z +TAG:toolkit_version_num=2.10.38.27240.1 +TAG:application_platform=win32 +TAG:material_package_umid=0x060A2B340101010501010F201300000072BAF0557DA749308C14738BCD4FA116 +TAG:material_package_name=Material Package +[/FORMAT]