From patchwork Sun Jan 24 23:05:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 25154 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 1AE9C44B72A for ; Mon, 25 Jan 2021 01:06:46 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E48C56883D3; Mon, 25 Jan 2021 01:06:45 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 17611680534 for ; Mon, 25 Jan 2021 01:06:39 +0200 (EET) Received: by mail-qt1-f179.google.com with SMTP id v3so8474122qtw.4 for ; Sun, 24 Jan 2021 15:06:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=plmQMfmBsFEAZmwP3SgvWTm9L4mCT7Dyz1/D02RxsJI=; b=sEnIk0CqfU8Fdgr0vRamrReTUp3X0CeL27afyNsrd6aLW3LCEAcnbhfP9jQXkc9vpP t0MTVWrMf8W+wHz8YigRmxDvrpYyfQqh7Js4wLGnfmDqJmBWTJN5kHZIFiwE28l4NT0i ZNH9JXVIpgp/fzAO0uShzXlcXkqh8vnyQTmRxg6fqCeW3xc8EIRbAX8ND44F1O3Cnbyi gaCcjDHSFk0C6XjDlVkmdDaZuZUn8uA2fMP1y0HcDKh+MJ1GJiReU5rT88jVCoE41dzW APRLpzQ675me3GcoAPf52b2saTJMKBrZ28YlEKn8UXF7qsV+yb+nFIRU2wpEHd30qEXF 8nyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=plmQMfmBsFEAZmwP3SgvWTm9L4mCT7Dyz1/D02RxsJI=; b=QjCwfOJOaSJuxg+QVCEbfpUK54pkyQUS5wH2HTosXxBSwEAfWlwEErtdY/5dbBkCw2 6HAsg8HNqGbC8n3TiosLeczB3VvkfLLPDX3RYS865kfhTy9VwwmO8DE3WyPQJHCQ28Qn C0HuSVWPL4yc96BEiqQtE4f9Z66CrgQCOUlHpap+px6TgsmNrlGhqQmyuACWxPzmLgeO USt8lhoWhK5jycbdOrElN5i2plxbXZFKOJzzhWofDrhw6klR8ElT70V095lG0DVogiVO 0JASbc6GH7mFkLBxj1PZkX6T8Nk6S6ppEgFY8rNnICkNZJ8+swBTTKtE/c4pWmximAdX crdA== X-Gm-Message-State: AOAM532UCRkpk0prtUe0KhijxoqVff/ZMYITw2zQMw393fMadL8xZMGN B83coFsZfe/F8gwRUH6pr9BOLLYgCDELJA== X-Google-Smtp-Source: ABdhPJwMKLY4kNlrgm0yyvVQ1WmGf8Q0le9HB5OjABPLO0SXOsnVURpLg6+qN789+JltLgpBD/PgXw== X-Received: by 2002:ac8:6b10:: with SMTP id w16mr46226qts.354.1611529597211; Sun, 24 Jan 2021 15:06:37 -0800 (PST) Received: from localhost.localdomain ([191.83.212.133]) by smtp.gmail.com with ESMTPSA id i8sm10172861qtr.84.2021.01.24.15.06.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Jan 2021 15:06:36 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sun, 24 Jan 2021 20:05:51 -0300 Message-Id: <20210124230552.6842-1-jamrial@gmail.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec: remove long dead debug_mv code 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" FF_API_DEBUG_MV has been zero since ffmpeg 4.0 Signed-off-by: James Almer --- fftools/ffmpeg.c | 6 +- libavcodec/avcodec.h | 24 ------- libavcodec/mpegpicture.c | 3 - libavcodec/mpegutils.c | 128 ------------------------------------- libavcodec/options_table.h | 7 -- libavcodec/pthread_frame.c | 4 -- 6 files changed, 1 insertion(+), 171 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 4419c68d11..d7c833be63 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -4032,11 +4032,7 @@ static int check_keyboard_interaction(int64_t cur_time) if(key == 'D') { debug = input_streams[0]->dec_ctx->debug << 1; if(!debug) debug = 1; - while(debug & (FF_DEBUG_DCT_COEFF -#if FF_API_DEBUG_MV - |FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE -#endif - )) //unsupported, would just crash + while (debug & FF_DEBUG_DCT_COEFF) //unsupported, would just crash debug += debug; }else{ char buf[32]; diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index fdb4276260..dc8738c819 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1619,39 +1619,17 @@ typedef struct AVCodecContext { #define FF_DEBUG_BITSTREAM 4 #define FF_DEBUG_MB_TYPE 8 #define FF_DEBUG_QP 16 -#if FF_API_DEBUG_MV -/** - * @deprecated this option does nothing - */ -#define FF_DEBUG_MV 32 -#endif #define FF_DEBUG_DCT_COEFF 0x00000040 #define FF_DEBUG_SKIP 0x00000080 #define FF_DEBUG_STARTCODE 0x00000100 #define FF_DEBUG_ER 0x00000400 #define FF_DEBUG_MMCO 0x00000800 #define FF_DEBUG_BUGS 0x00001000 -#if FF_API_DEBUG_MV -#define FF_DEBUG_VIS_QP 0x00002000 -#define FF_DEBUG_VIS_MB_TYPE 0x00004000 -#endif #define FF_DEBUG_BUFFERS 0x00008000 #define FF_DEBUG_THREADS 0x00010000 #define FF_DEBUG_GREEN_MD 0x00800000 #define FF_DEBUG_NOMC 0x01000000 -#if FF_API_DEBUG_MV - /** - * debug - * - encoding: Set by user. - * - decoding: Set by user. - */ - int debug_mv; -#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 // visualize forward predicted MVs of P-frames -#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 // visualize forward predicted MVs of B-frames -#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 // visualize backward predicted MVs of B-frames -#endif - /** * Error recognition; may misdetect some more or less valid parts as errors. * - encoding: unused @@ -2163,7 +2141,6 @@ typedef struct AVCodecContext { */ int seek_preroll; -#if !FF_API_DEBUG_MV /** * debug motion vectors * - encoding: Set by user. @@ -2173,7 +2150,6 @@ typedef struct AVCodecContext { #define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames #define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames #define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames -#endif /** * custom intra quantization matrix diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index e495e315e6..e3f648895d 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -203,9 +203,6 @@ static int alloc_picture_tables(AVCodecContext *avctx, Picture *pic, int encodin } if (out_format == FMT_H263 || encoding || -#if FF_API_DEBUG_MV - avctx->debug_mv || -#endif (avctx->export_side_data & AV_CODEC_EXPORT_DATA_MVS)) { int mv_size = 2 * (b8_array_size + 4) * sizeof(int16_t); int ref_index_size = 4 * mb_array_size; diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c index c0ee3aae85..e5105ecc58 100644 --- a/libavcodec/mpegutils.c +++ b/libavcodec/mpegutils.c @@ -262,132 +262,4 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_ av_log(avctx, AV_LOG_DEBUG, "\n"); } } - -#if FF_API_DEBUG_MV - if ((avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) || - (avctx->debug_mv)) { - int mb_y; - int i, ret; - int h_chroma_shift, v_chroma_shift, block_height; - const int mv_sample_log2 = avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_SVQ3 ? 2 : 1; - const int mv_stride = (mb_width << mv_sample_log2) + - (avctx->codec->id == AV_CODEC_ID_H264 ? 0 : 1); - - if (low_delay) - *low_delay = 0; // needed to see the vectors without trashing the buffers - - ret = av_pix_fmt_get_chroma_sub_sample (avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); - if (ret) - return ret; - - av_frame_make_writable(pict); - - pict->opaque = NULL; - block_height = 16 >> v_chroma_shift; - - for (mb_y = 0; mb_y < mb_height; mb_y++) { - int mb_x; - for (mb_x = 0; mb_x < mb_width; mb_x++) { - const int mb_index = mb_x + mb_y * mb_stride; - if ((avctx->debug & FF_DEBUG_VIS_QP)) { - uint64_t c = (qscale_table[mb_index] * 128 / 31) * - 0x0101010101010101ULL; - int y; - for (y = 0; y < block_height; y++) { - *(uint64_t *)(pict->data[1] + 8 * mb_x + - (block_height * mb_y + y) * - pict->linesize[1]) = c; - *(uint64_t *)(pict->data[2] + 8 * mb_x + - (block_height * mb_y + y) * - pict->linesize[2]) = c; - } - } - if ((avctx->debug & FF_DEBUG_VIS_MB_TYPE) && - motion_val[0]) { - int mb_type = mbtype_table[mb_index]; - uint64_t u,v; - int y; -#define COLOR(theta, r) \ - u = (int)(128 + r * cos(theta * M_PI / 180)); \ - v = (int)(128 + r * sin(theta * M_PI / 180)); - - - u = v = 128; - if (IS_PCM(mb_type)) { - COLOR(120, 48) - } else if ((IS_INTRA(mb_type) && IS_ACPRED(mb_type)) || - IS_INTRA16x16(mb_type)) { - COLOR(30, 48) - } else if (IS_INTRA4x4(mb_type)) { - COLOR(90, 48) - } else if (IS_DIRECT(mb_type) && IS_SKIP(mb_type)) { - // COLOR(120, 48) - } else if (IS_DIRECT(mb_type)) { - COLOR(150, 48) - } else if (IS_GMC(mb_type) && IS_SKIP(mb_type)) { - COLOR(170, 48) - } else if (IS_GMC(mb_type)) { - COLOR(190, 48) - } else if (IS_SKIP(mb_type)) { - // COLOR(180, 48) - } else if (!USES_LIST(mb_type, 1)) { - COLOR(240, 48) - } else if (!USES_LIST(mb_type, 0)) { - COLOR(0, 48) - } else { - av_assert2(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1)); - COLOR(300,48) - } - - u *= 0x0101010101010101ULL; - v *= 0x0101010101010101ULL; - for (y = 0; y < block_height; y++) { - *(uint64_t *)(pict->data[1] + 8 * mb_x + - (block_height * mb_y + y) * pict->linesize[1]) = u; - *(uint64_t *)(pict->data[2] + 8 * mb_x + - (block_height * mb_y + y) * pict->linesize[2]) = v; - } - - // segmentation - if (IS_8X8(mb_type) || IS_16X8(mb_type)) { - *(uint64_t *)(pict->data[0] + 16 * mb_x + 0 + - (16 * mb_y + 8) * pict->linesize[0]) ^= 0x8080808080808080ULL; - *(uint64_t *)(pict->data[0] + 16 * mb_x + 8 + - (16 * mb_y + 8) * pict->linesize[0]) ^= 0x8080808080808080ULL; - } - if (IS_8X8(mb_type) || IS_8X16(mb_type)) { - for (y = 0; y < 16; y++) - pict->data[0][16 * mb_x + 8 + (16 * mb_y + y) * - pict->linesize[0]] ^= 0x80; - } - if (IS_8X8(mb_type) && mv_sample_log2 >= 2) { - int dm = 1 << (mv_sample_log2 - 2); - for (i = 0; i < 4; i++) { - int sx = mb_x * 16 + 8 * (i & 1); - int sy = mb_y * 16 + 8 * (i >> 1); - int xy = (mb_x * 2 + (i & 1) + - (mb_y * 2 + (i >> 1)) * mv_stride) << (mv_sample_log2 - 1); - // FIXME bidir - int32_t *mv = (int32_t *) &motion_val[0][xy]; - if (mv[0] != mv[dm] || - mv[dm * mv_stride] != mv[dm * (mv_stride + 1)]) - for (y = 0; y < 8; y++) - pict->data[0][sx + 4 + (sy + y) * pict->linesize[0]] ^= 0x80; - if (mv[0] != mv[dm * mv_stride] || mv[dm] != mv[dm * (mv_stride + 1)]) - *(uint64_t *)(pict->data[0] + sx + (sy + 4) * - pict->linesize[0]) ^= 0x8080808080808080ULL; - } - } - - if (IS_INTERLACED(mb_type) && - avctx->codec->id == AV_CODEC_ID_H264) { - // hmm - } - } - if (mbskip_table) - mbskip_table[mb_index] = 0; - } - } - } -#endif } diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 1b9d39a3a7..61b4fb9e7f 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -208,9 +208,6 @@ static const AVOption avcodec_options[] = { {"bitstream", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BITSTREAM }, INT_MIN, INT_MAX, V|D, "debug"}, {"mb_type", "macroblock (MB) type", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"}, {"qp", "per-block quantization parameter (QP)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_QP }, INT_MIN, INT_MAX, V|D, "debug"}, -#if FF_API_DEBUG_MV -{"mv", "motion vector", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MV }, INT_MIN, INT_MAX, V|D, "debug"}, -#endif {"dct_coeff", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_DCT_COEFF }, INT_MIN, INT_MAX, V|D, "debug"}, {"green_metadata", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_GREEN_MD }, INT_MIN, INT_MAX, V|D, "debug"}, {"skip", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_SKIP }, INT_MIN, INT_MAX, V|D, "debug"}, @@ -218,10 +215,6 @@ static const AVOption avcodec_options[] = { {"er", "error recognition", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_ER }, INT_MIN, INT_MAX, V|D, "debug"}, {"mmco", "memory management control operations (H.264)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MMCO }, INT_MIN, INT_MAX, V|D, "debug"}, {"bugs", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUGS }, INT_MIN, INT_MAX, V|D, "debug"}, -#if FF_API_DEBUG_MV -{"vis_qp", "visualize quantization parameter (QP), lower QP are tinted greener", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_QP }, INT_MIN, INT_MAX, V|D, "debug"}, -{"vis_mb_type", "visualize block types", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"}, -#endif {"buffers", "picture buffer allocations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUFFERS }, INT_MIN, INT_MAX, V|D, "debug"}, {"thread_ops", "threading operations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_THREADS }, INT_MIN, INT_MAX, V|A|D, "debug"}, {"nomc", "skip motion compensation", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_NOMC }, INT_MIN, INT_MAX, V|A|D, "debug"}, diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index c9d2e00ce3..a570e25e0d 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -774,10 +774,6 @@ int ff_frame_thread_init(AVCodecContext *avctx) if (!thread_count) { int nb_cpus = av_cpu_count(); -#if FF_API_DEBUG_MV - if ((avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) || avctx->debug_mv) - nb_cpus = 1; -#endif // use number of cores + 1 as thread count if there is more than one if (nb_cpus > 1) thread_count = avctx->thread_count = FFMIN(nb_cpus + 1, MAX_AUTO_THREADS);