From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 2B6964F0D7 for ; Sun, 15 Jun 2025 16:57:19 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 5198D68D722; Sun, 15 Jun 2025 19:55:57 +0300 (EEST) Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 381BF68D5E3 for ; Sun, 15 Jun 2025 19:55:56 +0300 (EEST) Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-747abb3cd0bso3476590b3a.1 for ; Sun, 15 Jun 2025 09:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750006554; x=1750611354; darn=ffmpeg.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date :references:in-reply-to:message-id:from:from:to:cc:subject:date :message-id:reply-to; bh=SANZkIKDPUKtSljtWLKU8tAwpvUaHAMijR0dhMS7yCE=; b=dLUIkJO6NWQClKO2akxVxR9aTmj/i8kePeM3YJ7oOpYVQiM1K8RyYRhWdV1+lzBtkX glq78MriJqaL9xO0E/JHdv9NGtGsZAWFsHr/xabqOtaRSfluFeBnrDIkG31k4CT9ZuZg B65lLYVlEtlCW3GRG392qtVkpdJs2nK0V59b2/JJDy+s2mFW34aC/0p9khvsQaUW2AeJ q0w4NPySHAMOWzf4LxbQefIg6G/CXxiQzAJAiJchdCTjmaxJ+fYkN6qWj57SbSD0LoWb 1IVVcGlu/Ggy5F9UBi2/LrJAtF5EGs1qZWB1y5IVmgp8/TPYeqvQ0LRd6+cTIMQbaRC3 Q71g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750006554; x=1750611354; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date :references:in-reply-to:message-id:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=SANZkIKDPUKtSljtWLKU8tAwpvUaHAMijR0dhMS7yCE=; b=LU458xxVBFETeRu4xygN94KX+U6UzSKnkB6JnT4X4v7euOfetE/h5/nVQQsoPpr7H4 7CO8L+RPCl8Ryf6mKh8FGTUJdgSnvelYgjoMKAIFWVlHZelEumpcHoSsA+bAzWWPWehZ r1bw4rl5JIC3xLJ/7XDX92dkpmUHEVRDQ6FmIAYTZ4DAla/vPaIPMDKoXHUy5HO3cgJs tBqaItwkSQz6xEsliaaMDQLYfS51c15jxHWXrnGy1Otr5AAgDaTekLMUOMWsou6LibT7 pbuViAkGxPsHeP8fYsb44QDzBJ+eMVj+fF7P4QxdZFpFLgtRbQzd/aXCO1UohnQDZ1P3 MiAw== X-Gm-Message-State: AOJu0YzIP5BylJZHLvDgno2Ly8nS4qieJmyoon3SRVIK8oJn1K1oI19V ptnrC38ckvJqGDoS2Y2mcCoruNkC3rHAFRTnBFMvrqTUGWOLqElcHWxxb/DgzQ== X-Gm-Gg: ASbGncsr4dR7oc6HTVbYwO6oAD0LYC+VD+EbRxp1BMF2NG7GgkJpB3F7tSrL7m3mMux +Yo5ndhrMAdHpGOpipt7TnUDEiP1pjcxSs7JpoFXWiUYb5vfM0xLfePGVfGfgsGjpCZkYlCYjVx njEnTDRB4RPdct4o16E1tSO79ezV7zCf767bHAPurJ9SAXmbA7WioO+711HtJDn5BZCQTmgekF1 bjEN7E9kMsIwkReXpMk3q4s1+ubXFhrDqwDSUNzL3tDixGMsieholH0Udzlk7tnIFgxCStHxxtS skKHLI1tsQpF8EhP3qEPoUv2hJ9IFx7D89d1wX8/heel8hPe3SNrgEFUKL9OEY3p4vevPLH0MAi STBZc8Dd7RMFjOjDe X-Google-Smtp-Source: AGHT+IGbM7sNXWqzvOja9SazFtMR/NWWeEC7aGkebtnBXsxr2JgKh0OzxO3taldQOn3vQXGJkpes8g== X-Received: by 2002:a05:6a21:68f:b0:1f3:1ba1:266a with SMTP id adf61e73a8af0-21fbc41233bmr9447598637.0.1750006554200; Sun, 15 Jun 2025 09:55:54 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-748900062cesm5248561b3a.57.2025.06.15.09.55.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Jun 2025 09:55:53 -0700 (PDT) From: Andreas Rheinhardt X-Google-Original-From: Andreas Rheinhardt Message-Id: In-Reply-To: References: Date: Sun, 15 Jun 2025 16:54:03 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 12/47] avcodec/motion_est: Fix indentation 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: Andreas Rheinhardt Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Andreas Rheinhardt Forgotten after 919e749772d09900b41877e21ccb994fab0013ab. Signed-off-by: Andreas Rheinhardt --- libavcodec/motion_est.c | 180 ++++++++++++++++++++-------------------- 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 93aa909fb5..333048d1c8 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -118,64 +118,64 @@ static av_always_inline int cmp_direct_inline(MPVEncContext *const s, const int const uint8_t * const * const src = c->src[src_index]; int d; //FIXME check chroma 4mv, (no crashes ...) - av_assert2(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)); - if(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)){ - const int time_pp = s->c.pp_time; - const int time_pb = s->c.pb_time; - const int mask= 2*qpel+1; - if (s->c.mv_type == MV_TYPE_8X8) { - int i; - for(i=0; i<4; i++){ - int fx = c->direct_basis_mv[i][0] + hx; - int fy = c->direct_basis_mv[i][1] + hy; - int bx = hx ? fx - c->co_located_mv[i][0] : c->co_located_mv[i][0]*(time_pb - time_pp)/time_pp + ((i &1)<<(qpel+4)); - int by = hy ? fy - c->co_located_mv[i][1] : c->co_located_mv[i][1]*(time_pb - time_pp)/time_pp + ((i>>1)<<(qpel+4)); - int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); - int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); - - uint8_t *dst= c->temp + 8*(i&1) + 8*stride*(i>>1); - if(qpel){ - c->qpel_put[1][fxy](dst, ref[0] + (fx>>2) + (fy>>2)*stride, stride); - c->qpel_avg[1][bxy](dst, ref[8] + (bx>>2) + (by>>2)*stride, stride); - }else{ - c->hpel_put[1][fxy](dst, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 8); - c->hpel_avg[1][bxy](dst, ref[8] + (bx>>1) + (by>>1)*stride, stride, 8); - } - } - }else{ - int fx = c->direct_basis_mv[0][0] + hx; - int fy = c->direct_basis_mv[0][1] + hy; - int bx = hx ? fx - c->co_located_mv[0][0] : (c->co_located_mv[0][0]*(time_pb - time_pp)/time_pp); - int by = hy ? fy - c->co_located_mv[0][1] : (c->co_located_mv[0][1]*(time_pb - time_pp)/time_pp); - int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); - int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); - - if(qpel){ - c->qpel_put[1][fxy](c->temp , ref[0] + (fx>>2) + (fy>>2)*stride , stride); - c->qpel_put[1][fxy](c->temp + 8 , ref[0] + (fx>>2) + (fy>>2)*stride + 8 , stride); - c->qpel_put[1][fxy](c->temp + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8*stride, stride); - c->qpel_put[1][fxy](c->temp + 8 + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8 + 8*stride, stride); - c->qpel_avg[1][bxy](c->temp , ref[8] + (bx>>2) + (by>>2)*stride , stride); - c->qpel_avg[1][bxy](c->temp + 8 , ref[8] + (bx>>2) + (by>>2)*stride + 8 , stride); - c->qpel_avg[1][bxy](c->temp + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8*stride, stride); - c->qpel_avg[1][bxy](c->temp + 8 + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8 + 8*stride, stride); - }else{ - av_assert2((fx>>1) + 16*s->c.mb_x >= -16); - av_assert2((fy>>1) + 16*s->c.mb_y >= -16); - av_assert2((fx>>1) + 16*s->c.mb_x <= s->c.width); - av_assert2((fy>>1) + 16*s->c.mb_y <= s->c.height); - av_assert2((bx>>1) + 16*s->c.mb_x >= -16); - av_assert2((by>>1) + 16*s->c.mb_y >= -16); - av_assert2((bx>>1) + 16*s->c.mb_x <= s->c.width); - av_assert2((by>>1) + 16*s->c.mb_y <= s->c.height); - - c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); - c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); + av_assert2(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)); + if (x >= c->xmin && hx <= c->xmax << (qpel + 1) && + y >= c->ymin && hy <= c->ymax << (qpel + 1)) { + const int time_pp = s->c.pp_time; + const int time_pb = s->c.pb_time; + const int mask = 2 * qpel + 1; + if (s->c.mv_type == MV_TYPE_8X8) { + for(int i = 0; i < 4; ++i) { + int fx = c->direct_basis_mv[i][0] + hx; + int fy = c->direct_basis_mv[i][1] + hy; + int bx = hx ? fx - c->co_located_mv[i][0] : c->co_located_mv[i][0] * (time_pb - time_pp)/time_pp + ((i &1)<<(qpel+4)); + int by = hy ? fy - c->co_located_mv[i][1] : c->co_located_mv[i][1] * (time_pb - time_pp)/time_pp + ((i>>1)<<(qpel+4)); + int fxy = (fx & mask) + ((fy & mask) << (qpel + 1)); + int bxy = (bx & mask) + ((by & mask) << (qpel + 1)); + + uint8_t *dst = c->temp + 8 * (i & 1) + 8 * stride * (i >> 1); + if (qpel) { + c->qpel_put[1][fxy](dst, ref[0] + (fx >> 2) + (fy >> 2) * stride, stride); + c->qpel_avg[1][bxy](dst, ref[8] + (bx >> 2) + (by >> 2) * stride, stride); + } else { + c->hpel_put[1][fxy](dst, ref[0] + (fx >> 1) + (fy >> 1) * stride, stride, 8); + c->hpel_avg[1][bxy](dst, ref[8] + (bx >> 1) + (by >> 1) * stride, stride, 8); } } - d = cmp_func(s, c->temp, src[0], stride, 16); - }else - d= 256*256*256*32; + } else { + int fx = c->direct_basis_mv[0][0] + hx; + int fy = c->direct_basis_mv[0][1] + hy; + int bx = hx ? fx - c->co_located_mv[0][0] : (c->co_located_mv[0][0] * (time_pb - time_pp)/time_pp); + int by = hy ? fy - c->co_located_mv[0][1] : (c->co_located_mv[0][1] * (time_pb - time_pp)/time_pp); + int fxy = (fx & mask) + ((fy & mask) << (qpel + 1)); + int bxy = (bx & mask) + ((by & mask) << (qpel + 1)); + + if (qpel) { + c->qpel_put[1][fxy](c->temp , ref[0] + (fx>>2) + (fy>>2)*stride , stride); + c->qpel_put[1][fxy](c->temp + 8 , ref[0] + (fx>>2) + (fy>>2)*stride + 8 , stride); + c->qpel_put[1][fxy](c->temp + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8*stride, stride); + c->qpel_put[1][fxy](c->temp + 8 + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8 + 8*stride, stride); + c->qpel_avg[1][bxy](c->temp , ref[8] + (bx>>2) + (by>>2)*stride , stride); + c->qpel_avg[1][bxy](c->temp + 8 , ref[8] + (bx>>2) + (by>>2)*stride + 8 , stride); + c->qpel_avg[1][bxy](c->temp + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8*stride, stride); + c->qpel_avg[1][bxy](c->temp + 8 + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8 + 8*stride, stride); + } else { + av_assert2((fx >> 1) + 16 * s->c.mb_x >= -16); + av_assert2((fy >> 1) + 16 * s->c.mb_y >= -16); + av_assert2((fx >> 1) + 16 * s->c.mb_x <= s->c.width); + av_assert2((fy >> 1) + 16 * s->c.mb_y <= s->c.height); + av_assert2((bx >> 1) + 16 * s->c.mb_x >= -16); + av_assert2((by >> 1) + 16 * s->c.mb_y >= -16); + av_assert2((bx >> 1) + 16 * s->c.mb_x <= s->c.width); + av_assert2((by >> 1) + 16 * s->c.mb_y <= s->c.height); + + c->hpel_put[0][fxy](c->temp, ref[0] + (fx >> 1) + (fy >> 1) * stride, stride, 16); + c->hpel_avg[0][bxy](c->temp, ref[8] + (bx >> 1) + (by >> 1) * stride, stride, 16); + } + } + d = cmp_func(s, c->temp, src[0], stride, 16); + } else + d = 256 * 256 * 256 * 32; return d; } @@ -192,42 +192,42 @@ static av_always_inline int cmp_inline(MPVEncContext *const s, const int x, cons const uint8_t * const * const src = c->src[src_index]; int d; //FIXME check chroma 4mv, (no crashes ...) - int uvdxy; /* no, it might not be used uninitialized */ - if(dxy){ - if(qpel){ - if (h << size == 16) { - c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); //FIXME prototype (add h) - } else if (size == 0 && h == 8) { - c->qpel_put[1][dxy](c->temp , ref[0] + x + y*stride , stride); - c->qpel_put[1][dxy](c->temp + 8, ref[0] + x + y*stride + 8, stride); - } else - av_assert2(0); - if(chroma){ - int cx= hx/2; - int cy= hy/2; - cx= (cx>>1)|(cx&1); - cy= (cy>>1)|(cy&1); - uvdxy= (cx&1) + 2*(cy&1); - // FIXME x/y wrong, but MPEG-4 qpel is sick anyway, we should drop as much of it as possible in favor for H.264 - } - }else{ - c->hpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride, h); - if(chroma) - uvdxy= dxy | (x&1) | (2*(y&1)); + int uvdxy; /* no, it might not be used uninitialized */ + if (dxy) { + if (qpel) { + if (h << size == 16) { + c->qpel_put[size][dxy](c->temp, ref[0] + x + y * stride, stride); //FIXME prototype (add h) + } else if (size == 0 && h == 8) { + c->qpel_put[1][dxy](c->temp , ref[0] + x + y * stride , stride); + c->qpel_put[1][dxy](c->temp + 8, ref[0] + x + y * stride + 8, stride); + } else + av_assert2(0); + if (chroma) { + int cx = hx / 2; + int cy = hy / 2; + cx = (cx >> 1) | (cx & 1); + cy = (cy >> 1) | (cy & 1); + uvdxy = (cx & 1) + 2 * (cy & 1); + // FIXME x/y wrong, but MPEG-4 qpel is sick anyway, we should drop as much of it as possible in favor for H.264 } - d = cmp_func(s, c->temp, src[0], stride, h); - }else{ - d = cmp_func(s, src[0], ref[0] + x + y*stride, stride, h); - if(chroma) - uvdxy= (x&1) + 2*(y&1); - } - if(chroma){ - uint8_t * const uvtemp= c->temp + 16*stride; - c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); - c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); - d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1); - d += chroma_cmp_func(s, uvtemp+8, src[2], uvstride, h>>1); + } else { + c->hpel_put[size][dxy](c->temp, ref[0] + x + y * stride, stride, h); + if (chroma) + uvdxy = dxy | (x & 1) | (2 * (y & 1)); } + d = cmp_func(s, c->temp, src[0], stride, h); + } else { + d = cmp_func(s, src[0], ref[0] + x + y * stride, stride, h); + if (chroma) + uvdxy = (x & 1) + 2 * (y & 1); + } + if (chroma) { + uint8_t *const uvtemp = c->temp + 16 * stride; + c->hpel_put[size + 1][uvdxy](uvtemp , ref[1] + (x >> 1) + (y >> 1) * uvstride, uvstride, h >> 1); + c->hpel_put[size + 1][uvdxy](uvtemp + 8, ref[2] + (x >> 1) + (y >> 1) * uvstride, uvstride, h >> 1); + d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h >> 1); + d += chroma_cmp_func(s, uvtemp + 8, src[2], uvstride, h >> 1); + } return d; } -- ffmpeg-codebot _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".