Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCHv2] avcodec/leaddec: support format 0x1006
@ 2025-01-19  9:49 Peter Ross
  2025-02-05 22:21 ` Peter Ross
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Ross @ 2025-01-19  9:49 UTC (permalink / raw)
  To: ffmpeg-devel


[-- Attachment #1.1: Type: text/plain, Size: 2333 bytes --]

Fixes ticket #10658.
---

Tested with some different vertical resolution alignments.

When the vertical resolution is not aligned to macroblock height, the
reference encoder & decoder performs buggy placement of the initial
field. Its an internal bug, but because the encoder and decoder are
aligned, end-user does not see it.

FFmpeg decoder does not reproduce this behaviour.

 libavcodec/leaddec.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavcodec/leaddec.c b/libavcodec/leaddec.c
index 88387902ca..e6a91faabc 100644
--- a/libavcodec/leaddec.c
+++ b/libavcodec/leaddec.c
@@ -164,6 +164,10 @@ static int lead_decode_frame(AVCodecContext *avctx, AVFrame * frame,
     case 0x1000:
         avctx->pix_fmt = AV_PIX_FMT_YUV420P;
         break;
+    case 0x1006:
+        fields = 2;
+        avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+        break;
     case 0x2000:
         avctx->pix_fmt = AV_PIX_FMT_YUV444P;
         break;
@@ -237,7 +241,8 @@ static int lead_decode_frame(AVCodecContext *avctx, AVFrame * frame,
                         return ret;
                 }
     } else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) {
-        for (int mb_y = 0; mb_y < (avctx->height + 15) / 16; mb_y++)
+        for (int f = 0; f < fields; f++)
+        for (int mb_y = 0; mb_y < (avctx->height + 15) / 16 / fields; mb_y++)
             for (int mb_x = 0; mb_x < (avctx->width + 15) / 16; mb_x++)
                 for (int b = 0; b < (yuv20p_half ? 4 : 6); b++) {
                     int luma_block = yuv20p_half ? 2 : 4;
@@ -258,8 +263,8 @@ static int lead_decode_frame(AVCodecContext *avctx, AVFrame * frame,
 
                     ret = decode_block(s, &gb, dc_vlc, dc_bits, ac_vlc, ac_bits,
                         dc_pred + plane, dequant[!(b < 4)],
-                        frame->data[plane] + y*frame->linesize[plane] + x,
-                        (yuv20p_half && b < 2 ? 2 : 1) * frame->linesize[plane]);
+                        frame->data[plane] + (f + y*fields)*frame->linesize[plane] + x,
+                        (yuv20p_half && b < 2 ? 2 : 1) * fields * frame->linesize[plane]);
                     if (ret < 0)
                         return ret;
 
-- 
2.45.2

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCHv2] avcodec/leaddec: support format 0x1006
  2025-01-19  9:49 [FFmpeg-devel] [PATCHv2] avcodec/leaddec: support format 0x1006 Peter Ross
@ 2025-02-05 22:21 ` Peter Ross
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Ross @ 2025-02-05 22:21 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Sun, Jan 19, 2025 at 08:49:50PM +1100, Peter Ross wrote:
> Fixes ticket #10658.
> ---
> 
> Tested with some different vertical resolution alignments.
> 
> When the vertical resolution is not aligned to macroblock height, the
> reference encoder & decoder performs buggy placement of the initial
> field. Its an internal bug, but because the encoder and decoder are
> aligned, end-user does not see it.
> 
> FFmpeg decoder does not reproduce this behaviour.

will apply soon

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-05 22:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-19  9:49 [FFmpeg-devel] [PATCHv2] avcodec/leaddec: support format 0x1006 Peter Ross
2025-02-05 22:21 ` Peter Ross

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git