From patchwork Tue Feb 18 10:27:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alen_Vre=C4=8Dko?= X-Patchwork-Id: 17836 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a05:6214:1865:0:0:0:0 with SMTP id eh5csp580135qvb; Tue, 18 Feb 2020 02:27:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxT3YBE4iAPYD8ZaXxFbEZNp5+Z7NPwtweClJlmKPQc+IBRLs+XAEw8woutFFKVSLHVOKAt X-Received: by 2002:a17:906:559:: with SMTP id k25mr18915125eja.296.1582021638929; Tue, 18 Feb 2020 02:27:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582021638; cv=none; d=google.com; s=arc-20160816; b=nT0zNbeH8BW2oTLsyejRd8cl9JWRLG2ZC8FehFa/y07CGTRX8Rm9I0SXLsXciDtsMD nhtm7r6pLRgCoridrUpTnT3+XywjKpdeEM8vj53L6dUj5Z0Cx59YWqawt1dVrRK1aO6b XKMaZDY/NE5KFF9hvriwhyyfY9gfsoijzMSQUf6t/9PaWIqPHVXt/h7cjUDDtr9eDu9C L2isQFWF7UZa/J+rHSpX3shOKdEZTgRPKNH6CltdoqJneRHrFN2tOT1VH5+Hh51flgwP TBOd9hzcDegMcxULprwmpejbMaT6mt9AqgHxoP+zmU6M9LuEpBKoVnjyoFt6O/WicdCC 26aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :thread-index:thread-topic:mime-version:references:in-reply-to :message-id:to:from:date:dkim-signature:dkim-filter:delivered-to; bh=Wq+TJcIiduQ+SMy1CpuZd7o0aKutc6Imn1Y419I4LWI=; b=Nlmsfi7bzGsvdlzCD9MSBt0Bg9xZcWVp7g9RO2Cx/ftoWHl6TPr/D7c+nzw246QUVF AE0Is6RW4rTQEUYbKBDggmh03brhHah/qbKGrgfKEsnN96pV7rUjBerPV2f553fT0eXG BHtZ3x3Tgzby+w29bgO/5+912ZPtXJHU686ljPqdmPcEP2jDZvc09vnBnRRqA1e0BRJ9 iADytT8SG1ImGIBT+Eokc5Vaq2Dkm5HNNqTRPsxapSZhPnCkCT3tJe+MPSl8fUD9OF+M xBl7/oV0C4+xwGfattTV9bwH3NfozO1ekGep5TpO3UlPNueZ7lis6idGcUXIjy3leibY LKmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@fora.si header.s=AEE0C26A-5E8C-11E8-8665-7BEB883373C3 header.b=JDObyC27; 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=NONE dis=NONE) header.from=fora.si Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id lw12si1995409ejb.147.2020.02.18.02.27.18; Tue, 18 Feb 2020 02:27: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=@fora.si header.s=AEE0C26A-5E8C-11E8-8665-7BEB883373C3 header.b=JDObyC27; 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=NONE dis=NONE) header.from=fora.si Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 25042689D3A; Tue, 18 Feb 2020 12:27:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.fora.si (mail.fora.si [89.212.147.59]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8B150687F16 for ; Tue, 18 Feb 2020 12:27:08 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by mail.fora.si (Postfix) with ESMTP id 192828087EB2 for ; Tue, 18 Feb 2020 11:27:08 +0100 (CET) Received: from mail.fora.si ([127.0.0.1]) by localhost (mail.fora.si [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id orzE3V_1eP-E for ; Tue, 18 Feb 2020 11:27:07 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail.fora.si (Postfix) with ESMTP id 5C98480B620E for ; Tue, 18 Feb 2020 11:27:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.fora.si 5C98480B620E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fora.si; s=AEE0C26A-5E8C-11E8-8665-7BEB883373C3; t=1582021627; bh=X97uuWb97k88wpXx/nqpsAVDvsIHRsTYFDKbog1GaNU=; h=Date:From:To:Message-ID:MIME-Version; b=JDObyC27iJLiDn8VtRtahcyMOIM3AQMJ5IFpr5unPUeIzBDhOVz6k3mHAdbMt/i6k mwBNjsrObr2taTuxlTfx5OYCvfg+Jo+xBjA/A5Eto63sGYAb7yQsppXhR/I9U4SpkW zxDlph5EMmErm11OWcXYyzy412/H61bfOQa1JJnJ7CjdKf5EEXBhhiFBC2nLIU2Dem HGzOWFwXMsTgYp5LTStfsYk4hNc17SznOmBlNfyJkdECy2T6pQkSQSM0fW1NBhiOC2 nA1JixlzU+oM/qBNNAev0fS7UevOMSQBjcyP1IeP/M/ztsDbzeHo/48lTXe01zB/dp J4yK/dQM+r+tg== X-Virus-Scanned: amavisd-new at mail.fora.si Received: from mail.fora.si ([127.0.0.1]) by localhost (mail.fora.si [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id CK99u4x99kdt for ; Tue, 18 Feb 2020 11:27:07 +0100 (CET) Received: from mail.fora.si (mail.fora.si [192.168.41.209]) by mail.fora.si (Postfix) with ESMTP id 424DC8087EB2 for ; Tue, 18 Feb 2020 11:27:07 +0100 (CET) Date: Tue, 18 Feb 2020 11:27:07 +0100 (CET) From: Alen =?utf-8?q?Vre=C4=8Dko?= To: ffmpeg-devel Message-ID: <1901993192.202425.1582021627225.JavaMail.zimbra@fora.si> In-Reply-To: <304853391.201535.1582020904681.JavaMail.zimbra@fora.si> References: <608846815.195543.1581952227982.JavaMail.zimbra@fora.si> <90BE462A-80F5-4779-BDE4-38A53BE3540D@gmail.com> <304853391.201535.1582020904681.JavaMail.zimbra@fora.si> MIME-Version: 1.0 X-Originating-IP: [192.168.41.209] X-Mailer: Zimbra 8.8.8_GA_2075 (ZimbraWebClient - FF72 (Linux)/8.8.8_GA_2031) Thread-Topic: dvbsub.c, change segment order to be in line with spec Thread-Index: YBu7oAL6Ko0OMR6VZgQ6T4Ej7ooANnYD1XHg Subject: [FFmpeg-devel] [PATCH, v2] dvbsub.c, change segment order to be in line with spec X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: /IUts0PQ1v54 Content-Length: 9991 On https://patchwork.ffmpeg.org/project/ffmpeg/list/ the new patch doesn't show up. I used the same filename as before. Just in case sending it again with changed filename (and also changed commit message). Sorry for the extra message. Alen ----- Original Message ----- From: "Alen Vrečko" To: "ffmpeg-devel" Sent: Tuesday, February 18, 2020 11:15:04 AM Subject: Re: [FFmpeg-devel] dvbsub.c, change segment order to be in line with spec Sure thing. I attached a new patch. Thank you. Alen ----- Original Message ----- From: "Carl Eugen Hoyos" To: "ffmpeg-devel" Sent: Monday, February 17, 2020 6:28:17 PM Subject: Re: [FFmpeg-devel] dvbsub.c, change segment order to be in line with spec > Am 17.02.2020 um 16:10 schrieb Alen Vrečko : > > Hello, everyone. > > I'd like to request a change in order of DVB segments to be in line with ETSI 300 743. Basically Region Composition Segment should come before CLUT segment. This caused problems on legacy STBs namely Amino A110. > > In the ETSI EN 300 743 V1.6.1 (2018-10) section 4.4 it is written: > > The order of their listing here matches their ordering, when present, in a display set: > display definition segment ... > page composition segment ... > region composition segment ... > disparity signalling segment ... > CLUT definition segment ... > alternative CLUT segment ... > object data segment ... > end of display set segment ... > > It makes sense for this order to be implemented by ffmpeg. > > I attached a patch, made using git format-patch. This should really include a micro library version bump. Thank you, Carl Eugen From d3c475fa7ea0984b7f603b02d32eb59363f727f5 Mon Sep 17 00:00:00 2001 From: Alen Vrecko Date: Mon, 17 Feb 2020 15:47:05 +0100 Subject: [PATCH] Change Dvb segment order to be in line with ETSI EN 300 743. Having CLUT before Region Composition Segment caused problems on legacy STBs i.e. Amino A110. In the ETSI EN 300 743 V1.6.1 (2018-10) section 4.4 it is written: The order of their listing here matches their ordering, when present, in a display set: display definition segment ... page composition segment ... region composition segment ... disparity signalling segment ... CLUT definition segment ... alternative CLUT segment ... object data segment ... end of display set segment ... It makes sense for this order to be respected by ffmpeg. --- libavcodec/dvbsub.c | 80 ++++++++++++++++++++++---------------------- libavcodec/version.h | 2 +- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/libavcodec/dvbsub.c b/libavcodec/dvbsub.c index a8d43d81d6..e76d3044b8 100644 --- a/libavcodec/dvbsub.c +++ b/libavcodec/dvbsub.c @@ -296,6 +296,46 @@ static int encode_dvb_subtitles(AVCodecContext *avctx, bytestream_put_be16(&pseg_len, q - pseg_len - 2); + for (region_id = 0; region_id < h->num_rects; region_id++) { + + /* region composition segment */ + + if (h->rects[region_id]->nb_colors <= 4) { + /* 2 bpp, some decoders do not support it correctly */ + bpp_index = 0; + } else if (h->rects[region_id]->nb_colors <= 16) { + /* 4 bpp, standard encoding */ + bpp_index = 1; + } else if (h->rects[region_id]->nb_colors <= 256) { + /* 8 bpp, standard encoding */ + bpp_index = 2; + } else { + return -1; + } + + *q++ = 0x0f; /* sync_byte */ + *q++ = 0x11; /* segment_type */ + bytestream_put_be16(&q, page_id); + pseg_len = q; + q += 2; /* segment length */ + *q++ = region_id; + *q++ = (s->object_version << 4) | (0 << 3) | 0x07; /* version , no fill */ + bytestream_put_be16(&q, h->rects[region_id]->w); /* region width */ + bytestream_put_be16(&q, h->rects[region_id]->h); /* region height */ + *q++ = ((1 + bpp_index) << 5) | ((1 + bpp_index) << 2) | 0x03; + *q++ = region_id; /* clut_id == region_id */ + *q++ = 0; /* 8 bit fill colors */ + *q++ = 0x03; /* 4 bit and 2 bit fill colors */ + + bytestream_put_be16(&q, region_id); /* object_id == region_id */ + *q++ = (0 << 6) | (0 << 4); + *q++ = 0; + *q++ = 0xf0; + *q++ = 0; + + bytestream_put_be16(&pseg_len, q - pseg_len - 2); + } + if (h->num_rects) { for (clut_id = 0; clut_id < h->num_rects; clut_id++) { @@ -346,46 +386,6 @@ static int encode_dvb_subtitles(AVCodecContext *avctx, } } - for (region_id = 0; region_id < h->num_rects; region_id++) { - - /* region composition segment */ - - if (h->rects[region_id]->nb_colors <= 4) { - /* 2 bpp, some decoders do not support it correctly */ - bpp_index = 0; - } else if (h->rects[region_id]->nb_colors <= 16) { - /* 4 bpp, standard encoding */ - bpp_index = 1; - } else if (h->rects[region_id]->nb_colors <= 256) { - /* 8 bpp, standard encoding */ - bpp_index = 2; - } else { - return -1; - } - - *q++ = 0x0f; /* sync_byte */ - *q++ = 0x11; /* segment_type */ - bytestream_put_be16(&q, page_id); - pseg_len = q; - q += 2; /* segment length */ - *q++ = region_id; - *q++ = (s->object_version << 4) | (0 << 3) | 0x07; /* version , no fill */ - bytestream_put_be16(&q, h->rects[region_id]->w); /* region width */ - bytestream_put_be16(&q, h->rects[region_id]->h); /* region height */ - *q++ = ((1 + bpp_index) << 5) | ((1 + bpp_index) << 2) | 0x03; - *q++ = region_id; /* clut_id == region_id */ - *q++ = 0; /* 8 bit fill colors */ - *q++ = 0x03; /* 4 bit and 2 bit fill colors */ - - bytestream_put_be16(&q, region_id); /* object_id == region_id */ - *q++ = (0 << 6) | (0 << 4); - *q++ = 0; - *q++ = 0xf0; - *q++ = 0; - - bytestream_put_be16(&pseg_len, q - pseg_len - 2); - } - if (h->num_rects) { for (object_id = 0; object_id < h->num_rects; object_id++) { diff --git a/libavcodec/version.h b/libavcodec/version.h index 5c8147f681..5fff689eb4 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 70 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ -- 2.21.1