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