From patchwork Fri Jun 26 00:47:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 20613 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 6A6E244BC8F for ; Fri, 26 Jun 2020 03:47:43 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 34AE1687FF9; Fri, 26 Jun 2020 03:47:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5C75E687FAA for ; Fri, 26 Jun 2020 03:47:36 +0300 (EEST) Received: by mail-pj1-f47.google.com with SMTP id cm23so4195469pjb.5 for ; Thu, 25 Jun 2020 17:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=YmxS4jRh/2/r/VCAdRHgAXug3b8ml1m2rMtOT4jH5rQ=; b=fLx+8N/VhS+ogCDINJGP7IUXR9sU+pd4ZZuJiFTCEBTghJJIJI4eXQ352n+EPrUD6D 3CyjFbvayhnDPAy0Q8Q6rsYawyg5FQSKJmsAc2bZJY9lAD585yXgmxa0Amp7SkKGITjT 4kU9nW8E61ot3l+8BIUYgINBOQSOaDZyn3k9KoGmonuQI3nwtAkETPJ+i0Ic8A8XD1aZ YEgpFYl85bM/aoKRQi73cNdpCbnZ7Om1g1JHNBhMkpvq0Kk30yq89+gBOjT0yF/sjZq8 TTntc4OXGeaJnKDFrMnDGdizEH9tWyaNvXd4+J77N66m0bSFlKO2jCh0/PjNhGwdP5Ib z4Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=YmxS4jRh/2/r/VCAdRHgAXug3b8ml1m2rMtOT4jH5rQ=; b=G4+YzBfFq5UlobfHOFVOB4wOWxdbZHCxc3eL0cxtU2XRJqADYvmrhayLe0ABQ/7o8i hXTt9QuLULaez3Ydi0meLPrbQD246FBw8jPnnE93DmLmDT3lshJ5ZUXf7YJt8AgCopu5 Fc2yx5EbSEbh3zPQNu7vioqumRL6VWEQT9i0Gqhdm20KUVUiDyzr0/zIKXDtcrr8YECk Uzg1IjMNji7moUqjZF4k9ppPhkFp0EMi+KGEkhJbroIb1Wh2eoLVOLTad4kQP7mX4gz2 RsmfF72ipPtUvZnwL51l1gM3+LxvC1vfabzUYIHGS+ujOKty7W1ivIoIJT6zIc/gwsNQ YVcg== X-Gm-Message-State: AOAM533aovs/DXG7IpIliYvk4SlPtQ6UJraXf/w/AwA976jsWxL7egE7 VQqwrQ4ozDRG2z/acKP56oApbF/S X-Google-Smtp-Source: ABdhPJxmX4+5Giy9P6VkDOxW8ftO8NIB4ofsLnyL+o0iK/LgOg66FmMqP0DepRnQgWZjLrWdc/yEDg== X-Received: by 2002:a17:902:724a:: with SMTP id c10mr379649pll.143.1593132453839; Thu, 25 Jun 2020 17:47:33 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f20sm3942768pfn.51.2020.06.25.17.47.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jun 2020 17:47:32 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 26 Jun 2020 08:47:21 +0800 Message-Id: <1593132446-21202-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH 1/6] avcodec/dvbsubdec: simplify code by using OFFSET() macro 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/dvbsubdec.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index f63a1f3..af6c78a 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1730,10 +1730,11 @@ end: } #define DS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_SUBTITLE_PARAM +#define OFFSET(x) offsetof(DVBSubContext, x) static const AVOption options[] = { - {"compute_edt", "compute end of time using pts or timeout", offsetof(DVBSubContext, compute_edt), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DS}, - {"compute_clut", "compute clut when not available(-1) or always(1) or never(0)", offsetof(DVBSubContext, compute_clut), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, DS}, - {"dvb_substream", "", offsetof(DVBSubContext, substream), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 63, DS}, + {"compute_edt", "compute end of time using pts or timeout", OFFSET(compute_edt), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DS}, + {"compute_clut", "compute clut when not available(-1) or always(1) or never(0)", OFFSET(compute_clut), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, DS}, + {"dvb_substream", "", OFFSET(substream), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 63, DS}, {NULL} }; static const AVClass dvbsubdec_class = { From patchwork Fri Jun 26 00:47:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 20614 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 6444644BC8F for ; Fri, 26 Jun 2020 03:47:46 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4CEDB6881F3; Fri, 26 Jun 2020 03:47:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 77F4D687FAA for ; Fri, 26 Jun 2020 03:47:37 +0300 (EEST) Received: by mail-pl1-f196.google.com with SMTP id d10so3598608pls.5 for ; Thu, 25 Jun 2020 17:47:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Oqm8gd8oj+N18JKosQW0rIs9z1dfObWFlTK5lSqktOA=; b=mHa2lDFDT3d9AQwpFKM8lxq73JerVjZ4E1pXnJ1yk2BoBEuBtOLDDUA3F3TpmeV+lI JkD8gMtp8yxj4SBaI9/Qs4EgDtkfl6bR7ugev+6oPZHIgQGfUEAcTMcopcEICfK+V6Gk D2q7pcCFJWDn40QHFkwUQVjLheIYg1xMb9zHOrHxBMyks+7zfWN/bE2k2qSj1Ty7PA8Q ADtD5hYy9jibr8So9M9YYgt9CooqGN+Y3vpJZGY7z8OpD+1CAAgHYGz/gfF4BcFyoF/l KvVDv8pdKVQ1lZX1bWFbetvsXkJLIHYnAIfROFmw6sTVq25MwWtgECo7X6r1iQUvXB08 937Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Oqm8gd8oj+N18JKosQW0rIs9z1dfObWFlTK5lSqktOA=; b=XQMY183+LH7PO8y0KpMTJCa6jgLOY406qIj14XlBOzWwVeDXt1EaQ8avzDg0M+9Um7 s0TfyZ8A9i3DU8nKih10oObwzEUwk1XrFm+PGLMi60beF44cVdu2pmAN3W0ouyi2jwFi PB9EA+LGpByuV7IdnR9pKtO4kSUWvcoel8ef73L6zbCCfU1n7UkOhumvx0pjGQIufo1w neQAKbMdwXMxbrJtgWk7+qPZzTFet28Cqs+xR127JAlw5c9m78xLl3wJp+KIGH5kq/Uz X+pS0YOT7XRnVCtGg1OkCNPyRQvNoe4uM454DNfU0d3PhUhHIvada1sp+A3OkajCuioD J3aQ== X-Gm-Message-State: AOAM533u0cuapDxSft5FBto/YiivDASqTtHLrrVK2DN0cO1So59QUfwB XGdAAurLjbnaYMJ6GxKPp7kXjDKN X-Google-Smtp-Source: ABdhPJxeiqxhmNM/wtURxSE1VqwCXJcAp7E0ngc4bFY3+H5lunLoo8ULvnBUGEqOdv7SOsb8pZao0A== X-Received: by 2002:a17:90a:f198:: with SMTP id bv24mr685265pjb.206.1593132455338; Thu, 25 Jun 2020 17:47:35 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f20sm3942768pfn.51.2020.06.25.17.47.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jun 2020 17:47:34 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 26 Jun 2020 08:47:22 +0800 Message-Id: <1593132446-21202-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1593132446-21202-1-git-send-email-lance.lmwang@gmail.com> References: <1593132446-21202-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/6] avcodec/dvbsubdec: prefer to use variable instead of type for sizeof 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/dvbsubdec.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index af6c78a..263ba59 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -813,7 +813,7 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou ret = AVERROR(ENOMEM); goto fail; } - memcpy(rect->data[1], clut_table, (1 << region->depth) * sizeof(uint32_t)); + memcpy(rect->data[1], clut_table, (1 << region->depth) * sizeof(*clut_table)); rect->data[0] = av_malloc(region->buf_size); if (!rect->data[0]) { @@ -1073,11 +1073,11 @@ static int dvbsub_parse_clut_segment(AVCodecContext *avctx, clut = get_clut(ctx, clut_id); if (!clut) { - clut = av_malloc(sizeof(DVBSubCLUT)); + clut = av_malloc(sizeof(*clut)); if (!clut) return AVERROR(ENOMEM); - memcpy(clut, &default_clut, sizeof(DVBSubCLUT)); + memcpy(clut, &default_clut, sizeof(*clut)); clut->id = clut_id; clut->version = -1; @@ -1163,7 +1163,7 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx, region = get_region(ctx, region_id); if (!region) { - region = av_mallocz(sizeof(DVBSubRegion)); + region = av_mallocz(sizeof(*region)); if (!region) return AVERROR(ENOMEM); @@ -1244,7 +1244,7 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx, object = get_object(ctx, object_id); if (!object) { - object = av_mallocz(sizeof(DVBSubObject)); + object = av_mallocz(sizeof(*object)); if (!object) return AVERROR(ENOMEM); @@ -1255,7 +1255,7 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx, object->type = (*buf) >> 6; - display = av_mallocz(sizeof(DVBSubObjectDisplay)); + display = av_mallocz(sizeof(*display)); if (!display) return AVERROR(ENOMEM); @@ -1352,7 +1352,7 @@ static int dvbsub_parse_page_segment(AVCodecContext *avctx, } if (!display) { - display = av_mallocz(sizeof(DVBSubRegionDisplay)); + display = av_mallocz(sizeof(*display)); if (!display) return AVERROR(ENOMEM); } From patchwork Fri Jun 26 00:47:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 20615 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 548F344BC8F for ; Fri, 26 Jun 2020 03:47:47 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3F17A6882E5; Fri, 26 Jun 2020 03:47:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E51E96881F3 for ; Fri, 26 Jun 2020 03:47:38 +0300 (EEST) Received: by mail-pl1-f193.google.com with SMTP id s14so3594194plq.6 for ; Thu, 25 Jun 2020 17:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5gKeBTkZvqwwCnmz/Jg0qwCDNEFwyerE2uj9JSgPiqI=; b=NlrrBX6TyTNOOpMnfUpXovltggFeaD7s8/aveXFbBbTqJuiy4QiOZFeY6cYgLKljnt 6UaCKFbejSmRnvI8etXmCrhlWLnIrI3f/P5O2CKq3IUtcpIL6EPpkK6qtxc6Pe8+ka1P 3GqyA0oFjYOAxBfeXcA8gzMlYU9egrGAl2wV6T5NhSHf2dvuiAPdhD7AUJ0CQNPa47Uj yciGplMBbs1wtyczrahAaBpyUc4iyewZ+Me1iQ72zCcEZavfsBXL5zph1nB7pCrCrXe3 jSeu3IYg+PaUzWEkX0PTu+6wpfXXimUKPYKQ96txEz/8doooB1PuOGkV0vATPhoC3PeB GhLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5gKeBTkZvqwwCnmz/Jg0qwCDNEFwyerE2uj9JSgPiqI=; b=Lm1TmQTQABVvE9HemjSXdAgbFiICMNH4rzvfxS2mYKOgXTzXbY0pMhJazVgtbQnySw gXm8VcGElLvC4XLhvvLxYrRbmlbw81SLkEqQ/YTEc6N8Uz85h46MtPAlWtGfO7gEzbTo s44hoowj5KVLmsjSxwsd35qqPTzWlQ5YcyKCf2w/6cAq/EnSO2Ou6sziaEix7FCwf9OX NVqLPaXJxMZgSy5pO78kpKmzfTAQd99fsqC/7we1bUCYxSwocJJfQaKpBCNLqXehPaBK dZJfjLAIvD0XVhIa+u9FmZUm8zj1uWxuv8z2sehjP3IzoviiuyhDiRbS4rYgAF4gMj1A rM9Q== X-Gm-Message-State: AOAM531aU0R3rL++ijQQ57AI2gG8/OvP+RfpbHJN0PMTiSEny4AfN+f8 M+tmHssIKnr/LGKCZjQy6xvKRHBx X-Google-Smtp-Source: ABdhPJypz45qDnscqzAtz19BE3jUCzAt79TGiWo9pobZhJJ1lHfbNWP8MUbtBKAdYjWnAqcSMSIPFA== X-Received: by 2002:a17:90a:8d11:: with SMTP id c17mr646833pjo.201.1593132456836; Thu, 25 Jun 2020 17:47:36 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f20sm3942768pfn.51.2020.06.25.17.47.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jun 2020 17:47:36 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 26 Jun 2020 08:47:23 +0800 Message-Id: <1593132446-21202-3-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1593132446-21202-1-git-send-email-lance.lmwang@gmail.com> References: <1593132446-21202-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 3/6] avcodec/dvbsubdec: Cosmetics 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang reindent code and fix the if( style Signed-off-by: Limin Wang --- libavcodec/dvbsubdec.c | 90 +++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index 263ba59..d151288 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -737,7 +737,7 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou } /* Not touching AVSubtitles again*/ - if(sub->num_rects) { + if (sub->num_rects) { avpriv_request_sample(ctx, "Different Version of Segment asked Twice"); return AVERROR_PATCHWELCOME; } @@ -747,7 +747,7 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou sub->num_rects++; } - if(ctx->compute_edt == 0) { + if (ctx->compute_edt == 0) { sub->end_display_time = ctx->time_out * 1000; *got_output = 1; } else if (ctx->prev_start != AV_NOPTS_VALUE) { @@ -851,7 +851,7 @@ FF_ENABLE_DEPRECATION_WARNINGS return 0; fail: if (sub->rects) { - for(i=0; inum_rects; i++) { + for (i=0; inum_rects; i++) { rect = sub->rects[i]; if (rect) { av_freep(&rect->data[0]); @@ -1088,53 +1088,53 @@ static int dvbsub_parse_clut_segment(AVCodecContext *avctx, if (clut->version != version) { - clut->version = version; + clut->version = version; - while (buf + 4 < buf_end) { - entry_id = *buf++; + while (buf + 4 < buf_end) { + entry_id = *buf++; - depth = (*buf) & 0xe0; + depth = (*buf) & 0xe0; - if (depth == 0) { - av_log(avctx, AV_LOG_ERROR, "Invalid clut depth 0x%x!\n", *buf); - } + if (depth == 0) { + av_log(avctx, AV_LOG_ERROR, "Invalid clut depth 0x%x!\n", *buf); + } - full_range = (*buf++) & 1; + full_range = (*buf++) & 1; - if (full_range) { - y = *buf++; - cr = *buf++; - cb = *buf++; - alpha = *buf++; - } else { - y = buf[0] & 0xfc; - cr = (((buf[0] & 3) << 2) | ((buf[1] >> 6) & 3)) << 4; - cb = (buf[1] << 2) & 0xf0; - alpha = (buf[1] << 6) & 0xc0; + if (full_range) { + y = *buf++; + cr = *buf++; + cb = *buf++; + alpha = *buf++; + } else { + y = buf[0] & 0xfc; + cr = (((buf[0] & 3) << 2) | ((buf[1] >> 6) & 3)) << 4; + cb = (buf[1] << 2) & 0xf0; + alpha = (buf[1] << 6) & 0xc0; - buf += 2; - } + buf += 2; + } - if (y == 0) - alpha = 0xff; + if (y == 0) + alpha = 0xff; - YUV_TO_RGB1_CCIR(cb, cr); - YUV_TO_RGB2_CCIR(r, g, b, y); + YUV_TO_RGB1_CCIR(cb, cr); + YUV_TO_RGB2_CCIR(r, g, b, y); - ff_dlog(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha); - if (!!(depth & 0x80) + !!(depth & 0x40) + !!(depth & 0x20) > 1) { - ff_dlog(avctx, "More than one bit level marked: %x\n", depth); - if (avctx->strict_std_compliance > FF_COMPLIANCE_NORMAL) - return AVERROR_INVALIDDATA; - } + ff_dlog(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha); + if (!!(depth & 0x80) + !!(depth & 0x40) + !!(depth & 0x20) > 1) { + ff_dlog(avctx, "More than one bit level marked: %x\n", depth); + if (avctx->strict_std_compliance > FF_COMPLIANCE_NORMAL) + return AVERROR_INVALIDDATA; + } - if (depth & 0x80 && entry_id < 4) - clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha); - else if (depth & 0x40 && entry_id < 16) - clut->clut16[entry_id] = RGBA(r,g,b,255 - alpha); - else if (depth & 0x20) - clut->clut256[entry_id] = RGBA(r,g,b,255 - alpha); - } + if (depth & 0x80 && entry_id < 4) + clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha); + else if (depth & 0x40 && entry_id < 16) + clut->clut16[entry_id] = RGBA(r,g,b,255 - alpha); + else if (depth & 0x20) + clut->clut256[entry_id] = RGBA(r,g,b,255 - alpha); + } } return 0; @@ -1210,7 +1210,7 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx, } region->depth = 1 << (((*buf++) >> 2) & 7); - if(region->depth<2 || region->depth>8){ + if (region->depth<2 || region->depth>8){ av_log(avctx, AV_LOG_ERROR, "region depth %d is invalid\n", region->depth); region->depth= 4; } @@ -1318,7 +1318,7 @@ static int dvbsub_parse_page_segment(AVCodecContext *avctx, ff_dlog(avctx, "Page time out %ds, state %d\n", ctx->time_out, page_state); - if(ctx->compute_edt == 1) + if (ctx->compute_edt == 1) save_subtitle_set(avctx, sub, got_output); if (page_state == 1 || page_state == 2) { @@ -1601,7 +1601,7 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf, { DVBSubContext *ctx = avctx->priv_data; - if(ctx->compute_edt == 0) + if (ctx->compute_edt == 0) save_subtitle_set(avctx, sub, got_output); #ifdef DEBUG save_display_set(ctx); @@ -1717,12 +1717,12 @@ static int dvbsub_decode(AVCodecContext *avctx, } end: - if(ret < 0) { + if (ret < 0) { *got_sub_ptr = 0; avsubtitle_free(sub); return ret; } else { - if(ctx->compute_edt == 1 ) + if (ctx->compute_edt == 1 ) FFSWAP(int64_t, ctx->prev_start, sub->pts); } From patchwork Fri Jun 26 00:47:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 20616 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 59C4F44BC8F for ; Fri, 26 Jun 2020 03:47:49 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 418C268834D; Fri, 26 Jun 2020 03:47:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 560156806A5 for ; Fri, 26 Jun 2020 03:47:40 +0300 (EEST) Received: by mail-pj1-f65.google.com with SMTP id ev7so3449048pjb.2 for ; Thu, 25 Jun 2020 17:47:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OxMWlabSkA1gveAOSSOIzUlRcy6bfzoXaFGYQhv+BRw=; b=K0x1rsp42FLMS7RfUgsUJiqE5Gy5hRC8QBCqfwLZrbHjuyfbqJ8Wkn40G3M5jqfUdx HOnZ/XOr4myJj4c4o/UhSo8VWXfL0V5MlF6VGAc0k1iGx3VdaMN/pI8f9Y+N2YuqPYz9 asKxeOuY3Lx7HkUDetJNrluM/anMzmiFWVNxtOBIV/7b1aWZwQHYXIWcpJIp0+kKJJJ9 gOyUZA8JHr/Nn7xd6KLfUB2+TOLubbFQ4mp36Y3cJv9xzQb1+ZEce1Wnaupu3vfIAa0n tKr821n2gFWTmyD0gNsmqfsSQffJ2xR13b8YhrLnisWwWk6surFrxZTBfGU2HCTrHa52 l2oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OxMWlabSkA1gveAOSSOIzUlRcy6bfzoXaFGYQhv+BRw=; b=r9Rid3H2HtU67Yn7ouNLZqX+9fWXkQQvD8A9eD6n4lxNC5lo+v0JhuotDUEbpXF6Gu LhfBsUQFHfJljFt96Y8Soxw43qjdC4gsL09F5WrctgQpM5lk6RfhTghMuNky3U0WfWcV jqta8ww3K6TyTqTc0ez0MAAvyxIMx2qNCGEgqX6zzPCYk74voJOf6EqfAYRKfcKTVn0X Pa1w+lyGuqY49/TCTVwWott/JH5gU7jtbbGx1m5ou5VbGp3Tqv3V8/Opdx1SY4FWhR3y 67CsciclWJsrJo6vqklXLVVet69zVZuv4d1U/I5hN3/19sLMv8w2IDZ4VadMjJtv37eI a3uw== X-Gm-Message-State: AOAM531XbesPGw232be62SCtCTC/LUey/CRgfqAWYvf5iwTmM/pcETdy N6bZRg1S2fL8M/4e0unzNcCiUYJa X-Google-Smtp-Source: ABdhPJzWVN0V907MSuA+dXC+kPMPIIuVUNg7OwJHD45bzpbM+X4jlzp7rTZXc0a7YgKv1K7kH+n23w== X-Received: by 2002:a17:90a:65c9:: with SMTP id i9mr658619pjs.201.1593132458364; Thu, 25 Jun 2020 17:47:38 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f20sm3942768pfn.51.2020.06.25.17.47.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jun 2020 17:47:37 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 26 Jun 2020 08:47:24 +0800 Message-Id: <1593132446-21202-4-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1593132446-21202-1-git-send-email-lance.lmwang@gmail.com> References: <1593132446-21202-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 4/6] avutil/bprint: use AV_BPRINT_SIZE_AUTOMATIC instead of 1 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavutil/bprint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/bprint.c b/libavutil/bprint.c index 2f059c5..148b7bb 100644 --- a/libavutil/bprint.c +++ b/libavutil/bprint.c @@ -71,7 +71,7 @@ void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max) unsigned size_auto = (char *)buf + sizeof(*buf) - buf->reserved_internal_buffer; - if (size_max == 1) + if (size_max == AV_BPRINT_SIZE_AUTOMATIC) size_max = size_auto; buf->str = buf->reserved_internal_buffer; buf->len = 0; From patchwork Fri Jun 26 00:47:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 20617 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 4249544BC8F for ; Fri, 26 Jun 2020 03:47:50 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 31CD8689247; Fri, 26 Jun 2020 03:47:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CC04D6881FE for ; Fri, 26 Jun 2020 03:47:41 +0300 (EEST) Received: by mail-pj1-f65.google.com with SMTP id cv18so1048978pjb.1 for ; Thu, 25 Jun 2020 17:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nlp4VY9Tg8fsdwEDjFNwoXXFtJ4VQjI/qyGTXDfM4Ck=; b=a8QtFemcLfpFE0iT2pFPFB9u4mD9VH0IbtqQ4vMwRDG6g3EbkXwJH/jmd0aIPisnpm ui158RnSZa8IgN81PbbkVybtmb3uBqKUcOsAAAI4OQ+lsWhZ28Evc53bGHKqnS0M2HuQ r8U+FUBx9SIYDwSZZLAn+ilcbLA3ZbQTi35v+MtDyZpoomVZkM6JL4pEgCXRUtQP26xS rXOgTK1zYXTTGYeCw5GCodmqOQUNvQmSM5NDpAP79scSt2FxNUbC1aa0gyb1OcBADze1 6TBTuIAIj3jk9/YFgKcEWMEVZQd6eUwnzyyCUN5WM3CcZC3xLfxxB4lS96OlWMNMCnyl Ltfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nlp4VY9Tg8fsdwEDjFNwoXXFtJ4VQjI/qyGTXDfM4Ck=; b=q3+sDVDrlRI9RWX00VGJPQMxxGjDQGpnn5VLI7n/qUeTmLAiqJdoNK8CkcAQGPbsD/ 5soHZMniqay7UyXBpr91syJnBF2QBER5rcEw7mckfooS1j5KLb9yrx3QAsFrG769Dua0 dmGWPjUMIuERzUE3Q0zeCr9TjK++wJoCDFpR6gkV0SgMsVr5RkNn3GEVlAP9AjWb1KFG jAxDPTtM+vzW5hmtRBc6XL9ft8bdWFnV0VIKINTUrBwaX17wttyWB0RGtq6X7DQ6Lx+O 5PvVQRoLYDcrL8ytPV/MOnqLaHLtMjUEaRoSbspCvClorwtyQrx+t4UIwRwFjCf0yZl6 rk5w== X-Gm-Message-State: AOAM533xuxRygQMVVA3YDQHBR9d9Fn42z8ecKNwnmboHmxgG1pZLOgxV EY0g2DIA4vyenC5TQGqdo+lm6e92 X-Google-Smtp-Source: ABdhPJxGw8zRLcNCOGqgkjbu8j4PSzmyPG0aYL4aIpNioLMOLCI9djhfXLT8UEn4jqkO2JLLHrY4hg== X-Received: by 2002:a17:90a:d998:: with SMTP id d24mr641360pjv.43.1593132459852; Thu, 25 Jun 2020 17:47:39 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f20sm3942768pfn.51.2020.06.25.17.47.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jun 2020 17:47:39 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 26 Jun 2020 08:47:25 +0800 Message-Id: <1593132446-21202-5-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1593132446-21202-1-git-send-email-lance.lmwang@gmail.com> References: <1593132446-21202-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 5/6] avformat/aviobuf: INT_MAX -> AV_BPRINT_SIZE_UNLIMITED 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavformat/aviobuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index a77517d..1e32c0c 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -1191,7 +1191,7 @@ int avio_printf(AVIOContext *s, const char *fmt, ...) va_list ap; AVBPrint bp; - av_bprint_init(&bp, 0, INT_MAX); + av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED); va_start(ap, fmt); av_vbprintf(&bp, fmt, ap); va_end(ap); From patchwork Fri Jun 26 00:47:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 20618 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id DE18644A741 for ; Fri, 26 Jun 2020 03:55:29 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B3003688136; Fri, 26 Jun 2020 03:55:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B767C6807F1 for ; Fri, 26 Jun 2020 03:55:22 +0300 (EEST) Received: by mail-pf1-f194.google.com with SMTP id 207so3699788pfu.3 for ; Thu, 25 Jun 2020 17:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fi029BKH812ZnDw0r41sqQNF2/SNgnvuY+sM87LLaHw=; b=GnpDN3sSxCXBEnnO0N341eb3RO8y6fyHQcGDNaPBQ/ij9szMkD8wfGeDgb6R78J4x5 5WmsmLC//yRe7DMiYxsoAnYve9u0qgYVnoFhsLLtEohEOw9BSgkyv3RrKSAe0bs70Gbh zBUDJFEY+R9RKeMrHv8PbW+rlRoJfA3efp+RNZCpof10alcTjhubLkgSdyBzklpjpXKz /5zlnv9VIeNY/eOZanRuYApS3n4EF1iF9y7hUC08a4J7+fLGthsUjjY3bajHvPLyFQfM QwBqs3tJ4CUm7nK6PWXF1uDPcEcaWhqC6GkLkLrxGpDLMqfhI0jZUKS2/tdcEmFipBjs IvbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fi029BKH812ZnDw0r41sqQNF2/SNgnvuY+sM87LLaHw=; b=trSE1lv9uWfZ3+HOYvmbA8/7jp8DsspzlzvS4bDqyUd13fNb/cV5cYdzjnYtR/PuBl dges1azGz4nDQ7PoXl/OoxV5AnRlrv2jaKDUAZ0BMiH7xkMhmz7uBAAT/OAaMloL69Us 01VXDcUJST5uS+alLmW7vdAiTo44z/AA6Z4c7t19u23stdC9QXFkO965pPElr7ZgbkRb 21nEDczut2odDksx034/rELJiCH5NOO3/D5wqxPgwtldPat7HlKmk/q+mt/SSG1ZpLc+ 4CWLBnkXwdvxo/fd7gpVX3EZ7YQghW9lrKrGr5ACIgBP7BrxYRwQ1ucZncUl1n4VeAJH B+Yg== X-Gm-Message-State: AOAM533CK3xzFetomrv7xngNOtgZjQebWERUowtRZqiMn2aXMH1p1f3R NN++umgSb4rFp+05coC/3mr7uI3S X-Google-Smtp-Source: ABdhPJyXVh2Mmd5DtQniFWxR72c8WlIuFHP9Kezz4DJvL33MOS+Lmba79ycmpAsY1C/EWDa2sSyW6g== X-Received: by 2002:aa7:8598:: with SMTP id w24mr376952pfn.2.1593132461327; Thu, 25 Jun 2020 17:47:41 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f20sm3942768pfn.51.2020.06.25.17.47.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jun 2020 17:47:40 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 26 Jun 2020 08:47:26 +0800 Message-Id: <1593132446-21202-6-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1593132446-21202-1-git-send-email-lance.lmwang@gmail.com> References: <1593132446-21202-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 6/6] avformat/gifdec: -1 -> AV_BPRINT_SIZE_UNLIMITED 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavformat/gifdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/gifdec.c b/libavformat/gifdec.c index a31644c..d617de5 100644 --- a/libavformat/gifdec.c +++ b/libavformat/gifdec.c @@ -144,7 +144,7 @@ static int gif_read_header(AVFormatContext *s) AVBPrint bp; int block_size; - av_bprint_init(&bp, 0, -1); + av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED); while ((block_size = avio_r8(pb)) != 0) { avio_read_to_bprint(pb, &bp, block_size); }