Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2

2024-01-16 Thread aybe aybe
These email issues made me forgot to tell an important thing...

That new FPS patch is meant to be applied right after this:

avformat/psxstr: fix unknown sector type 00/80
a96d556baaf7cb71babad96238eadb532d02f3a6

i.e. not over the previous FPS patch attempt:

avformat/psxstr: basic FPS detection instead of fixed value
464243adac7abfa9b926a1faf6f59515661efa7f

I think we're good now :)

-- Original Message --
>From "aybe aybe" 
To "FFmpeg development discussions and patches"

Date 1/16/2024 3:39:09 PM
Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for
STRv1 is like STRv2

>Lol, I told you I was struggling with emClient, it decided to send .eml as 
>.url...
>
>Here are the patches, hopefully!
>
>[FFmpeg-devel] [PATCH 1/2] avformat/psxstr: infer video FPS using sector LBA
>https://ffmpeg.org/pipermail/ffmpeg-devel/2024-January/319701.html
>
>[FFmpeg-devel] [PATCH 2/2] avformat/psxstr: update fate checksums
>https://ffmpeg.org/pipermail/ffmpeg-devel/2024-January/319702.html
>
>-- Original Message --
>From "aybe" mailto:aybe@hotmail.com>>
>To "FFmpeg development discussions and patches" 
>mailto:ffmpeg-devel@ffmpeg.org>>
>Date 1/16/2024 3:32:36 PM
>Subject Re[2]: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 
>is like STRv2
>
>Modern email clients like to do stuff they're told not to...
>
>The link I meant previously: https://github.com/aybe/FFmpeg-PSX-STR-tests
>
>
>-- Original Message --
>From "aybe aybe" 
>mailto:aybe.one-at-hotmail....@ffmpeg.org>>
>To "FFmpeg development discussions and patches" 
>mailto:ffmpeg-devel@ffmpeg.org>>
>Date 1/16/2024 3:27:16 PM
>Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is 
>like STRv2
>
>The new patch appears to work, stuff is synchronized, except:
>- 30 FPS video still seen as 150FPS by VLC
>- 15 FPS video emits tons of "[vost#0:0/rawvideo @ 0269b580] Clipping 
>frame in rate conversion by 0.199989"
>
>As for the corrupt samples, been able to find the original sources:
>
>- the first is good old Descent
>- was cut at exactly 2MB
>- works in FFmpeg
>- the second is Ridge Racer Type 4
>- bad/incomplete extract with a tool that added "RIFFCDXA" header for 
>whatever reason
>- does NOT work in FFmpeg, comprised of 38 audio streams + 2 video streams 
>(only decodes some audio then aborts)
>- but if I extract the relevant section from it, then works in FFmpeg
>
>New videos, samples, logs:
>https://github.com/aybe/FFmpeg-PSX-STR-tests
>
>------ Original Message ------
>From "Michael Niedermayer" 
>mailto:mich...@niedermayer.cc><mailto:mich...@niedermayer.cc>>
>To "FFmpeg development discussions and patches" 
>mailto:ffmpeg-devel@ffmpeg.org><mailto:ffmpeg-devel@ffmpeg.org>>
>Date 1/16/2024 12:42:49 AM
>Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is 
>like STRv2
>
>On Mon, Jan 15, 2024 at 04:14:46PM +, aybe aybe wrote:
>Hi!
>
>I just tried what you've suggested, using 150 and setting AVPacket->pts using 
>sector MSF as LBA.
>
>The results are somewhat mixed:
>
>- NTSC video: A/V synchronized but is now seen as 120 FPS by VLC
>- PAL video: A/V not synchronized anymore but still seen as 25 FPS by VLC
>
>can you send the patch for this plus links to one sample for both cases ?
>
>id like to take a look
>
>thx
>
>[...]
>--
>Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
>The greatest way to live with honor in this world is to be what we pretend
>to be. -- Socrates
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2

2024-01-16 Thread aybe aybe
Lol, I told you I was struggling with emClient, it decided to send .eml as 
.url...

Here are the patches, hopefully!

[FFmpeg-devel] [PATCH 1/2] avformat/psxstr: infer video FPS using sector LBA
https://ffmpeg.org/pipermail/ffmpeg-devel/2024-January/319701.html

[FFmpeg-devel] [PATCH 2/2] avformat/psxstr: update fate checksums
https://ffmpeg.org/pipermail/ffmpeg-devel/2024-January/319702.html

-- Original Message --
>From "aybe" mailto:aybe@hotmail.com>>
To "FFmpeg development discussions and patches" 
mailto:ffmpeg-devel@ffmpeg.org>>
Date 1/16/2024 3:32:36 PM
Subject Re[2]: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is 
like STRv2

Modern email clients like to do stuff they're told not to...

The link I meant previously: https://github.com/aybe/FFmpeg-PSX-STR-tests


-- Original Message --
>From "aybe aybe" 
>mailto:aybe.one-at-hotmail@ffmpeg.org>>
To "FFmpeg development discussions and patches" 
mailto:ffmpeg-devel@ffmpeg.org>>
Date 1/16/2024 3:27:16 PM
Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is 
like STRv2

The new patch appears to work, stuff is synchronized, except:
- 30 FPS video still seen as 150FPS by VLC
- 15 FPS video emits tons of "[vost#0:0/rawvideo @ 0269b580] Clipping 
frame in rate conversion by 0.199989"

As for the corrupt samples, been able to find the original sources:

- the first is good old Descent
- was cut at exactly 2MB
- works in FFmpeg
- the second is Ridge Racer Type 4
- bad/incomplete extract with a tool that added "RIFFCDXA" header for 
whatever reason
- does NOT work in FFmpeg, comprised of 38 audio streams + 2 video streams 
(only decodes some audio then aborts)
- but if I extract the relevant section from it, then works in FFmpeg

New videos, samples, logs:
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Faybe%2FFFmpeg-PSX-STR-tests&data=05%7C02%7C%7Cc7debed92bce42a5bcd908dc169f43bd%7C84df9e7fe9f640afb435%7C1%7C0%7C638410120640174537%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2Faq1Hcn5X%2FVCvtVi5GO6Jes7mrPUCeZyrIZvDiAj6lw%3D&reserved=0

-- Original Message --
>From "Michael Niedermayer" 
>mailto:mich...@niedermayer.cc><mailto:mich...@niedermayer.cc>>
To "FFmpeg development discussions and patches" 
mailto:ffmpeg-devel@ffmpeg.org><mailto:ffmpeg-devel@ffmpeg.org>>
Date 1/16/2024 12:42:49 AM
Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is 
like STRv2

On Mon, Jan 15, 2024 at 04:14:46PM +, aybe aybe wrote:
Hi!

I just tried what you've suggested, using 150 and setting AVPacket->pts using 
sector MSF as LBA.

The results are somewhat mixed:

- NTSC video: A/V synchronized but is now seen as 120 FPS by VLC
- PAL video: A/V not synchronized anymore but still seen as 25 FPS by VLC

can you send the patch for this plus links to one sample for both cases ?

id like to take a look

thx

[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2

2024-01-16 Thread aybe aybe
Modern email clients like to do stuff they're told not to...

The link I meant previously: https://github.com/aybe/FFmpeg-PSX-STR-tests


-- Original Message --
>From "aybe aybe" 
>mailto:aybe.one-at-hotmail@ffmpeg.org>>
To "FFmpeg development discussions and patches" 
mailto:ffmpeg-devel@ffmpeg.org>>
Date 1/16/2024 3:27:16 PM
Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is 
like STRv2

The new patch appears to work, stuff is synchronized, except:
- 30 FPS video still seen as 150FPS by VLC
- 15 FPS video emits tons of "[vost#0:0/rawvideo @ 0269b580] Clipping 
frame in rate conversion by 0.199989"

As for the corrupt samples, been able to find the original sources:

- the first is good old Descent
- was cut at exactly 2MB
- works in FFmpeg
- the second is Ridge Racer Type 4
- bad/incomplete extract with a tool that added "RIFFCDXA" header for 
whatever reason
- does NOT work in FFmpeg, comprised of 38 audio streams + 2 video streams 
(only decodes some audio then aborts)
- but if I extract the relevant section from it, then works in FFmpeg

New videos, samples, logs:
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Faybe%2FFFmpeg-PSX-STR-tests&data=05%7C02%7C%7Cc7debed92bce42a5bcd908dc169f43bd%7C84df9e7fe9f640afb435%7C1%7C0%7C638410120640174537%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2Faq1Hcn5X%2FVCvtVi5GO6Jes7mrPUCeZyrIZvDiAj6lw%3D&reserved=0

-- Original Message --
>From "Michael Niedermayer" 
>mailto:mich...@niedermayer.cc><mailto:mich...@niedermayer.cc>>
To "FFmpeg development discussions and patches" 
mailto:ffmpeg-devel@ffmpeg.org><mailto:ffmpeg-devel@ffmpeg.org>>
Date 1/16/2024 12:42:49 AM
Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is 
like STRv2

On Mon, Jan 15, 2024 at 04:14:46PM +, aybe aybe wrote:
Hi!

I just tried what you've suggested, using 150 and setting AVPacket->pts using 
sector MSF as LBA.

The results are somewhat mixed:

- NTSC video: A/V synchronized but is now seen as 120 FPS by VLC
- PAL video: A/V not synchronized anymore but still seen as 25 FPS by VLC

can you send the patch for this plus links to one sample for both cases ?

id like to take a look

thx

[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2

2024-01-16 Thread aybe aybe
The new patch appears to work, stuff is synchronized, except:
- 30 FPS video still seen as 150FPS by VLC
- 15 FPS video emits tons of "[vost#0:0/rawvideo @ 0269b580] Clipping 
frame in rate conversion by 0.199989"

As for the corrupt samples, been able to find the original sources:

- the first is good old Descent
- was cut at exactly 2MB
- works in FFmpeg
- the second is Ridge Racer Type 4
- bad/incomplete extract with a tool that added "RIFFCDXA" header for 
whatever reason
- does NOT work in FFmpeg, comprised of 38 audio streams + 2 video streams 
(only decodes some audio then aborts)
- but if I extract the relevant section from it, then works in FFmpeg

New videos, samples, logs:
https://github.com/aybe/FFmpeg-PSX-STR-tests

-- Original Message --
From "Michael Niedermayer" 
mailto:mich...@niedermayer.cc>>
To "FFmpeg development discussions and patches" 
mailto:ffmpeg-devel@ffmpeg.org>>
Date 1/16/2024 12:42:49 AM
Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is 
like STRv2

On Mon, Jan 15, 2024 at 04:14:46PM +, aybe aybe wrote:
Hi!

I just tried what you've suggested, using 150 and setting AVPacket->pts using 
sector MSF as LBA.

The results are somewhat mixed:

- NTSC video: A/V synchronized but is now seen as 120 FPS by VLC
- PAL video: A/V not synchronized anymore but still seen as 25 FPS by VLC

can you send the patch for this plus links to one sample for both cases ?

id like to take a look

thx

[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


0001-avformat-psxstr-infer-video-FPS-using-sector-LBA.eml.url
Description: 0001-avformat-psxstr-infer-video-FPS-using-sector-LBA.eml.url


0002-avformat-psxstr-update-fate-checksums.eml.url
Description: 0002-avformat-psxstr-update-fate-checksums.eml.url
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2

2024-01-15 Thread Michael Niedermayer
On Mon, Jan 15, 2024 at 04:14:46PM +, aybe aybe wrote:
> Hi!
> 
> I just tried what you've suggested, using 150 and setting AVPacket->pts using 
> sector MSF as LBA.
> 
> The results are somewhat mixed:

> - NTSC video: A/V synchronized but is now seen as 120 FPS by VLC
> - PAL video: A/V not synchronized anymore but still seen as 25 FPS by VLC

can you send the patch for this plus links to one sample for both cases ?

id like to take a look

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2

2024-01-15 Thread aybe aybe
Hi!

I just tried what you've suggested, using 150 and setting AVPacket->pts using 
sector MSF as LBA.

The results are somewhat mixed:
- NTSC video: A/V synchronized but is now seen as 120 FPS by VLC
- PAL video: A/V not synchronized anymore but still seen as 25 FPS by VLC

Not sure about 150, we assume videos play at 2x CD-ROM, not 100% exact but is 
likely to be the case for 99% of them.

-- Original Message --
>From "Michael Niedermayer via ffmpeg-devel" 
>mailto:ffmpeg-devel@ffmpeg.org>>
To "FFmpeg development discussions and patches" 
mailto:ffmpeg-devel@ffmpeg.org>>
Cc "Michael Niedermayer" mailto:mich...@niedermayer.cc>>
Date 1/14/2024 9:38:06 PM
Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is 
like STRv2

Hi aybe

On Sat, Jan 13, 2024 at 02:28:52AM +, aybe aybe wrote:
Here are the two STR files I have used when writing this patch: 
https://github.com/aybe/FFmpeg-PSX-STR-tests

ok, i can confirm the version patch fixes these, i will apply it


Fanatics would probably say that 30 FPS for NTSC is wrong (i.e. should be 
29.97)...
However, as the reversed-engineered docs in jpsxdec mentions, it is sort of 
impossible to figure out which value to snap to from how frames spans across 
CD-ROM sectors.
The sector count per video frame always seem to juggle between two values, e.g. 
6 sectors, then 7 sectors, rinse/repeat. i.e. it's never constant.

Also, as one can see in the various code samples online on writing a PSX 
program that plays MDEC videos, it is the responsibility of the coder to 
present the frames on screen.
i.e. there is not definitive way on how to do so, and even if there was, you 
can be sure some folks did not play by the rules back then.
The only way to figure out how a movie was intended to be played is to reverse 
engineer a game to see what values they did cram in.
In short, the computed frame rate is 99% good, not 100%. But for mere mortals, 
they are unlikely to notice it at all.

Well, with the subset of samples i have, i dont feel confident that i could
write and test timestamping/fps.

The docuemnt you linked says
"Data is read from the disc one sector at a time at either 75 sectors per 
second (single speed) or 150 sectors per second (double speed). The video and 
audio are spaced out over these sectors so they can be delivered at the 
appropriate times."

what i would suggest to try is:
avpriv_set_pts_info(st, 64, 1, 150); (or 75 for single speed)

and then set AVPacket->pts to the sector number
you never set fps, leave it to libavformat to figure it out.

can you try that ? (i assume you have many samples to easily check)



As for the movies in the samples repository, they are corrupt and FFmpeg fails 
at them, obviously.
I figured these ones were by checking them in a hex-editor but also by loading 
them in https://github.com/m35/jpsxdec which has great logging.
Not sure why these samples were corrupt in first instance, maybe it was 
intentional for testing? I can't tell.

Thats very strange, anyone remembers where these samples are from originally ?

thx

[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2

2024-01-14 Thread Michael Niedermayer via ffmpeg-devel
Hi aybe

On Sat, Jan 13, 2024 at 02:28:52AM +, aybe aybe wrote:
> Here are the two STR files I have used when writing this patch: 
> https://github.com/aybe/FFmpeg-PSX-STR-tests

ok, i can confirm the version patch fixes these, i will apply it


> Fanatics would probably say that 30 FPS for NTSC is wrong (i.e. should be 
> 29.97)...
> However, as the reversed-engineered docs in jpsxdec mentions, it is sort of 
> impossible to figure out which value to snap to from how frames spans across 
> CD-ROM sectors.
> The sector count per video frame always seem to juggle between two values, 
> e.g. 6 sectors, then 7 sectors, rinse/repeat. i.e. it's never constant.
> 
> Also, as one can see in the various code samples online on writing a PSX 
> program that plays MDEC videos, it is the responsibility of the coder to 
> present the frames on screen.
> i.e. there is not definitive way on how to do so, and even if there was, you 
> can be sure some folks did not play by the rules back then.
> The only way to figure out how a movie was intended to be played is to 
> reverse engineer a game to see what values they did cram in.
> In short, the computed frame rate is 99% good, not 100%. But for mere 
> mortals, they are unlikely to notice it at all.

Well, with the subset of samples i have, i dont feel confident that i could
write and test timestamping/fps.

The docuemnt you linked says
"Data is read from the disc one sector at a time at either 75 sectors per 
second (single speed) or 150 sectors per second (double speed). The video and 
audio are spaced out over these sectors so they can be delivered at the 
appropriate times."

what i would suggest to try is:
avpriv_set_pts_info(st, 64, 1, 150); (or 75 for single speed)

and then set AVPacket->pts to the sector number
you never set fps, leave it to libavformat to figure it out.

can you try that ? (i assume you have many samples to easily check)


> 
> As for the movies in the samples repository, they are corrupt and FFmpeg 
> fails at them, obviously.
> I figured these ones were by checking them in a hex-editor but also by 
> loading them in https://github.com/m35/jpsxdec which has great 
> logging.
> Not sure why these samples were corrupt in first instance, maybe it was 
> intentional for testing? I can't tell.

Thats very strange, anyone remembers where these samples are from originally ?

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2

2024-01-12 Thread aybe aybe
I'm afraid I can't tell, I checked the commits before creating patches out of 
them; they did not appear to have superfluous whitespace in them.


-- Original Message --
>From "Michael Niedermayer" 
>mailto:mich...@niedermayer.cc>>
To "FFmpeg development discussions and patches" 
mailto:ffmpeg-devel@ffmpeg.org>>
Date 1/10/2024 3:37:41 AM
Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is 
like STRv2

On Tue, Jan 02, 2024 at 02:49:26AM +, aybe aybe wrote:
Hi,

As I understand, support for .STR files is broken for almost 10 years now 
(since 161442ff2c4b0dd8a5072c6bbe6bf55303fffccf it seems).

Currently, ffmpeg fails with tons of errors like this on version 1 STRs, e.g. 
Wipeout 1:
[mdec @ 027c72c0] ac-tex damaged at 1 9

What happens is that only the audio is present in the video file.

Anyway, that one character patch fixes the problem, video is now rendered.

Signed-off-by: aybe 
mailto:a...@users.noreply.github.com>>
---
libavcodec/mdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
index 44b12471a9..c4904216b8 100644
--- a/libavcodec/mdec.c
+++ b/libavcodec/mdec.c
@@ -68,7 +68,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, 
int16_t *block, int n)
const int qscale = a->qscale;

/* DC coefficient */
- if (a->version == 2) {
+ if (a->version <= 2) {
block[0] = 2 * get_sbits(&a->gb, 10) + 1024;
} else {
component = (n <= 3 ? 0 : n - 4 + 1);
--
2.41.0.windows.1

This is how the patch should look: (there are differencs in the whitespace
which git seems to have problems with in above)
not sure where these differences came from

thx

diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
index 44b12471a9e..c4904216b81 100644
--- a/libavcodec/mdec.c
+++ b/libavcodec/mdec.c
@@ -68,7 +68,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, 
int16_t *block, int n)
const int qscale = a->qscale;

/* DC coefficient */
- if (a->version == 2) {
+ if (a->version <= 2) {
block[0] = 2 * get_sbits(&a->gb, 10) + 1024;
} else {
component = (n <= 3 ? 0 : n - 4 + 1);


[...]

--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2

2024-01-12 Thread aybe aybe
Here are the two STR files I have used when writing this patch: 
https://github.com/aybe/FFmpeg-PSX-STR-tests
Fanatics would probably say that 30 FPS for NTSC is wrong (i.e. should be 
29.97)...
However, as the reversed-engineered docs in jpsxdec mentions, it is sort of 
impossible to figure out which value to snap to from how frames spans across 
CD-ROM sectors.
The sector count per video frame always seem to juggle between two values, e.g. 
6 sectors, then 7 sectors, rinse/repeat. i.e. it's never constant.

Also, as one can see in the various code samples online on writing a PSX 
program that plays MDEC videos, it is the responsibility of the coder to 
present the frames on screen.
i.e. there is not definitive way on how to do so, and even if there was, you 
can be sure some folks did not play by the rules back then.
The only way to figure out how a movie was intended to be played is to reverse 
engineer a game to see what values they did cram in.
In short, the computed frame rate is 99% good, not 100%. But for mere mortals, 
they are unlikely to notice it at all.

As for the movies in the samples repository, they are corrupt and FFmpeg fails 
at them, obviously.
I figured these ones were by checking them in a hex-editor but also by loading 
them in https://github.com/m35/jpsxdec which has great logging.
Not sure why these samples were corrupt in first instance, maybe it was 
intentional for testing? I can't tell.

-- Original Message --
>From "Michael Niedermayer" 
>mailto:mich...@niedermayer.cc>>
To "FFmpeg development discussions and patches" 
mailto:ffmpeg-devel@ffmpeg.org>>
Date 1/10/2024 3:46:02 AM
Subject Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is 
like STRv2

On Tue, Jan 02, 2024 at 02:49:26AM +, aybe aybe wrote:
Hi,

As I understand, support for .STR files is broken for almost 10 years now 
(since 161442ff2c4b0dd8a5072c6bbe6bf55303fffccf it seems).

Currently, ffmpeg fails with tons of errors like this on version 1 STRs, e.g. 
Wipeout 1:
[mdec @ 027c72c0] ac-tex damaged at 1 9

where can i find a psxstr file to test this ?
the psxstr files i find on https://samples.ffmpeg.org/ seem not affected by this

thx

[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2

2024-01-09 Thread Michael Niedermayer
On Tue, Jan 02, 2024 at 02:49:26AM +, aybe aybe wrote:
> Hi,
> 
> As I understand, support for .STR files is broken for almost 10 years now 
> (since 161442ff2c4b0dd8a5072c6bbe6bf55303fffccf it seems).
> 
> Currently, ffmpeg fails with tons of errors like this on version 1 STRs, e.g. 
> Wipeout 1:
> [mdec @ 027c72c0] ac-tex damaged at 1 9

where can i find a psxstr file to test this ?
the psxstr files i find on https://samples.ffmpeg.org/ seem not affected by this

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2

2024-01-09 Thread Michael Niedermayer
On Tue, Jan 02, 2024 at 02:49:26AM +, aybe aybe wrote:
> Hi,
> 
> As I understand, support for .STR files is broken for almost 10 years now 
> (since 161442ff2c4b0dd8a5072c6bbe6bf55303fffccf it seems).
> 
> Currently, ffmpeg fails with tons of errors like this on version 1 STRs, e.g. 
> Wipeout 1:
> [mdec @ 027c72c0] ac-tex damaged at 1 9
> 
> What happens is that only the audio is present in the video file.
> 
> Anyway, that one character patch fixes the problem, video is now rendered.
> 
> Signed-off-by: aybe 
> ---
>   libavcodec/mdec.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
> index 44b12471a9..c4904216b8 100644
> --- a/libavcodec/mdec.c
> +++ b/libavcodec/mdec.c
> @@ -68,7 +68,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, 
> int16_t *block, int n)
>   const int qscale = a->qscale;
> 
>   /* DC coefficient */
> -if (a->version == 2) {
> +if (a->version <= 2) {
>   block[0] = 2 * get_sbits(&a->gb, 10) + 1024;
>   } else {
>   component = (n <= 3 ? 0 : n - 4 + 1);
> --
> 2.41.0.windows.1

This is how the patch should look: (there are differencs in the whitespace
which git seems to have problems with in above)
not sure where these differences came from

thx

diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
index 44b12471a9e..c4904216b81 100644
--- a/libavcodec/mdec.c
+++ b/libavcodec/mdec.c
@@ -68,7 +68,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, 
int16_t *block, int n)
 const int qscale = a->qscale;

 /* DC coefficient */
-if (a->version == 2) {
+if (a->version <= 2) {
 block[0] = 2 * get_sbits(&a->gb, 10) + 1024;
 } else {
 component = (n <= 3 ? 0 : n - 4 + 1);


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2

2024-01-06 Thread aybe aybe
Yes, I can see the warnings in patchwork but I don't understand what's 
the actual problem.

This is how I've done things over here:

- forked https://github.com/FFmpeg/FFmpeg which is synchronized with 
https://git.ffmpeg.org/ffmpeg.git
- made the changes, committed them
- created the patches with 'git format patch' instructions in 
https://ffmpeg.org/developer.html#Submitting-patches-1
- posted the .eml files without any editing (as the log is mentioning in 
patchwork)

Right now I just synced my fork and it merged new changes since then 
with no issues (https://github.com/aybe/FFmpeg/commits/master/).

So I don't know what's going on, maybe someone can shed some light on 
it?

-- Original Message --
>From "michael at niedermayer.cc" 
To
Date 1/5/2024 9:53:52 PM
Subject [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is 
like STRv2

>On Tue, Jan 02, 2024 at 02:49:26AM +, aybe aybe wrote:
>>  Hi,
>>
>>  As I understand, support for .STR files is broken for almost 10 years now 
>> (since 161442ff2c4b0dd8a5072c6bbe6bf55303fffccf it seems).
>>
>>  Currently, ffmpeg fails with tons of errors like this on version 1 STRs, 
>> e.g. Wipeout 1:
>>  [mdec @ 027c72c0] ac-tex damaged at 1 9
>>
>>  What happens is that only the audio is present in the video file.
>>
>>  Anyway, that one character patch fixes the problem, video is now rendered.
>>
>>  Signed-off-by: aybe 
>>  ---
>>libavcodec/mdec.c | 2 +-
>>1 file changed, 1 insertion(+), 1 deletion(-)
>>
>>  diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
>>  index 44b12471a9..c4904216b8 100644
>>  --- a/libavcodec/mdec.c
>>  +++ b/libavcodec/mdec.c
>>  @@ -68,7 +68,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, 
>> int16_t *block, int n)
>>const int qscale = a->qscale;
>>
>>/* DC coefficient */
>>  -if (a->version == 2) {
>>  +if (a->version <= 2) {
>>block[0] = 2 * get_sbits(&a->gb, 10) + 1024;
>>} else {
>>component = (n <= 3 ? 0 : n - 4 + 1);
>
>This seems not to apply automatically here
>
>Applying: avcodec/mdec: DC reading for STRv1 is like STRv2
>Using index info to reconstruct a base tree...
>error: patch failed: libavcodec/mdec.c:68
>error: libavcodec/mdec.c: patch does not apply
>error: Did you hand edit your patch?
>
>[...]
>--
>Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
>Asymptotically faster algorithms should always be preferred if you have
>asymptotical amounts of data
>-- next part --
>A non-text attachment was scrubbed...
>Name: signature.asc
>Type: application/pgp-signature
>Size: 195 bytes
>Desc: not available
>URL: 
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mdec: DC reading for STRv1 is like STRv2

2024-01-05 Thread Michael Niedermayer
On Tue, Jan 02, 2024 at 02:49:26AM +, aybe aybe wrote:
> Hi,
> 
> As I understand, support for .STR files is broken for almost 10 years now 
> (since 161442ff2c4b0dd8a5072c6bbe6bf55303fffccf it seems).
> 
> Currently, ffmpeg fails with tons of errors like this on version 1 STRs, e.g. 
> Wipeout 1:
> [mdec @ 027c72c0] ac-tex damaged at 1 9
> 
> What happens is that only the audio is present in the video file.
> 
> Anyway, that one character patch fixes the problem, video is now rendered.
> 
> Signed-off-by: aybe 
> ---
>   libavcodec/mdec.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
> index 44b12471a9..c4904216b8 100644
> --- a/libavcodec/mdec.c
> +++ b/libavcodec/mdec.c
> @@ -68,7 +68,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, 
> int16_t *block, int n)
>   const int qscale = a->qscale;
> 
>   /* DC coefficient */
> -if (a->version == 2) {
> +if (a->version <= 2) {
>   block[0] = 2 * get_sbits(&a->gb, 10) + 1024;
>   } else {
>   component = (n <= 3 ? 0 : n - 4 + 1);

This seems not to apply automatically here

Applying: avcodec/mdec: DC reading for STRv1 is like STRv2
Using index info to reconstruct a base tree...
error: patch failed: libavcodec/mdec.c:68
error: libavcodec/mdec.c: patch does not apply
error: Did you hand edit your patch?

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".