* [FFmpeg-devel] [PATCH 1/3] avformat/takdec: Don't initialize get_bits context to read one value
@ 2022-01-05 21:37 Andreas Rheinhardt
2022-01-05 21:38 ` [FFmpeg-devel] [PATCH 2/3] avcodec/mlpdec: Use get_bits() instead of get_bits_long() when possible Andreas Rheinhardt
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Andreas Rheinhardt @ 2022-01-05 21:37 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/tak.h | 1 -
libavformat/takdec.c | 3 +--
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/libavcodec/tak.h b/libavcodec/tak.h
index dc45a8c070..6069118971 100644
--- a/libavcodec/tak.h
+++ b/libavcodec/tak.h
@@ -44,7 +44,6 @@
#define TAK_LAST_FRAME_SIZE_BITS 24
#define TAK_ENCODER_CODEC_BITS 6
#define TAK_ENCODER_PROFILE_BITS 4
-#define TAK_ENCODER_VERSION_BITS 24
#define TAK_SAMPLE_RATE_MIN 6000
#define TAK_CHANNELS_MIN 1
#define TAK_BPS_MIN 8
diff --git a/libavformat/takdec.c b/libavformat/takdec.c
index bb256e1190..cc1f049512 100644
--- a/libavformat/takdec.c
+++ b/libavformat/takdec.c
@@ -171,9 +171,8 @@ static int tak_read_header(AVFormatContext *s)
get_bits(&gb, TAK_LAST_FRAME_SIZE_BITS);
av_freep(&buffer);
} else if (type == TAK_METADATA_ENCODER) {
- init_get_bits8(&gb, buffer, size - 3);
av_log(s, AV_LOG_VERBOSE, "encoder version: %0X\n",
- get_bits_long(&gb, TAK_ENCODER_VERSION_BITS));
+ AV_RL24(buffer));
av_freep(&buffer);
}
}
--
2.32.0
_______________________________________________
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] 7+ messages in thread
* [FFmpeg-devel] [PATCH 2/3] avcodec/mlpdec: Use get_bits() instead of get_bits_long() when possible
2022-01-05 21:37 [FFmpeg-devel] [PATCH 1/3] avformat/takdec: Don't initialize get_bits context to read one value Andreas Rheinhardt
@ 2022-01-05 21:38 ` Andreas Rheinhardt
2022-01-06 9:32 ` Michael Niedermayer
2022-01-05 21:38 ` [FFmpeg-devel] [PATCH 3/3] avcodec/jpeglsdec: Avoid get_bits_long() where possible Andreas Rheinhardt
2022-01-06 10:10 ` [FFmpeg-devel] [PATCH 1/3] avformat/takdec: Don't initialize get_bits context to read one value Paul B Mahol
2 siblings, 1 reply; 7+ messages in thread
From: Andreas Rheinhardt @ 2022-01-05 21:38 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
huff_lsbs is guaranteed to be in the range of 0..24 and
so is lsb_bits here, so one can use get_bits().
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mlpdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 29fac54542..61b9a641dd 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -268,7 +268,7 @@ static inline int read_huff_channels(MLPDecodeContext *m, GetBitContext *gbp,
return AVERROR_INVALIDDATA;
if (lsb_bits > 0)
- result = (result << lsb_bits) + get_bits_long(gbp, lsb_bits);
+ result = (result << lsb_bits) + get_bits(gbp, lsb_bits);
result += cp->sign_huff_offset;
result *= 1 << quant_step_size;
--
2.32.0
_______________________________________________
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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/3] avcodec/mlpdec: Use get_bits() instead of get_bits_long() when possible
2022-01-05 21:38 ` [FFmpeg-devel] [PATCH 2/3] avcodec/mlpdec: Use get_bits() instead of get_bits_long() when possible Andreas Rheinhardt
@ 2022-01-06 9:32 ` Michael Niedermayer
2022-01-06 9:35 ` Andreas Rheinhardt
0 siblings, 1 reply; 7+ messages in thread
From: Michael Niedermayer @ 2022-01-06 9:32 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 1341 bytes --]
On Wed, Jan 05, 2022 at 10:38:34PM +0100, Andreas Rheinhardt wrote:
> huff_lsbs is guaranteed to be in the range of 0..24 and
> so is lsb_bits here, so one can use get_bits().
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavcodec/mlpdec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
> index 29fac54542..61b9a641dd 100644
> --- a/libavcodec/mlpdec.c
> +++ b/libavcodec/mlpdec.c
> @@ -268,7 +268,7 @@ static inline int read_huff_channels(MLPDecodeContext *m, GetBitContext *gbp,
> return AVERROR_INVALIDDATA;
>
> if (lsb_bits > 0)
> - result = (result << lsb_bits) + get_bits_long(gbp, lsb_bits);
> + result = (result << lsb_bits) + get_bits(gbp, lsb_bits);
>
> result += cp->sign_huff_offset;
> result *= 1 << quant_step_size;
This seems not to fully work
Assertion n>0 && n<=25 failed at libavcodec/get_bits.h:403
lsb_bits and cp->huff_lsbs are 31 in this failure, it seems
the checks that prevent this are conditional but i didnt debug/check this
any further
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Observe your enemies, for they first find out your faults. -- Antisthenes
[-- 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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/3] avcodec/mlpdec: Use get_bits() instead of get_bits_long() when possible
2022-01-06 9:32 ` Michael Niedermayer
@ 2022-01-06 9:35 ` Andreas Rheinhardt
0 siblings, 0 replies; 7+ messages in thread
From: Andreas Rheinhardt @ 2022-01-06 9:35 UTC (permalink / raw)
To: ffmpeg-devel
Michael Niedermayer:
> On Wed, Jan 05, 2022 at 10:38:34PM +0100, Andreas Rheinhardt wrote:
>> huff_lsbs is guaranteed to be in the range of 0..24 and
>> so is lsb_bits here, so one can use get_bits().
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>> ---
>> libavcodec/mlpdec.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
>> index 29fac54542..61b9a641dd 100644
>> --- a/libavcodec/mlpdec.c
>> +++ b/libavcodec/mlpdec.c
>> @@ -268,7 +268,7 @@ static inline int read_huff_channels(MLPDecodeContext *m, GetBitContext *gbp,
>> return AVERROR_INVALIDDATA;
>>
>> if (lsb_bits > 0)
>> - result = (result << lsb_bits) + get_bits_long(gbp, lsb_bits);
>> + result = (result << lsb_bits) + get_bits(gbp, lsb_bits);
>>
>> result += cp->sign_huff_offset;
>> result *= 1 << quant_step_size;
>
> This seems not to fully work
>
> Assertion n>0 && n<=25 failed at libavcodec/get_bits.h:403
>
> lsb_bits and cp->huff_lsbs are 31 in this failure, it seems
> the checks that prevent this are conditional but i didnt debug/check this
> any further
>
Seems like I misread the check at line 841: It does not apply to the
first codebook: if (cp->codebook > 0 && cp->huff_lsbs > 24) {
Thanks for testing, patch dropped.
- Andreas
_______________________________________________
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] 7+ messages in thread
* [FFmpeg-devel] [PATCH 3/3] avcodec/jpeglsdec: Avoid get_bits_long() where possible
2022-01-05 21:37 [FFmpeg-devel] [PATCH 1/3] avformat/takdec: Don't initialize get_bits context to read one value Andreas Rheinhardt
2022-01-05 21:38 ` [FFmpeg-devel] [PATCH 2/3] avcodec/mlpdec: Use get_bits() instead of get_bits_long() when possible Andreas Rheinhardt
@ 2022-01-05 21:38 ` Andreas Rheinhardt
2022-01-08 13:06 ` Andreas Rheinhardt
2022-01-06 10:10 ` [FFmpeg-devel] [PATCH 1/3] avformat/takdec: Don't initialize get_bits context to read one value Paul B Mahol
2 siblings, 1 reply; 7+ messages in thread
From: Andreas Rheinhardt @ 2022-01-05 21:38 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
It is possible here, because the values of ff_log2_run used
here are actually in the range 0..15 given that run_index is
in the range 0..31.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/jpeglsdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index 32c0d2eb3f..269c71dc18 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -277,7 +277,7 @@ static inline int ls_decode_line(JLSState *state, MJpegDecodeContext *s,
/* decode aborted run */
r = ff_log2_run[state->run_index[comp]];
if (r)
- r = get_bits_long(&s->gb, r);
+ r = get_bits(&s->gb, r);
if (x + r * stride > w) {
r = (w - x) / stride;
}
--
2.32.0
_______________________________________________
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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/3] avcodec/jpeglsdec: Avoid get_bits_long() where possible
2022-01-05 21:38 ` [FFmpeg-devel] [PATCH 3/3] avcodec/jpeglsdec: Avoid get_bits_long() where possible Andreas Rheinhardt
@ 2022-01-08 13:06 ` Andreas Rheinhardt
0 siblings, 0 replies; 7+ messages in thread
From: Andreas Rheinhardt @ 2022-01-08 13:06 UTC (permalink / raw)
To: ffmpeg-devel
Andreas Rheinhardt:
> It is possible here, because the values of ff_log2_run used
> here are actually in the range 0..15 given that run_index is
> in the range 0..31.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavcodec/jpeglsdec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
> index 32c0d2eb3f..269c71dc18 100644
> --- a/libavcodec/jpeglsdec.c
> +++ b/libavcodec/jpeglsdec.c
> @@ -277,7 +277,7 @@ static inline int ls_decode_line(JLSState *state, MJpegDecodeContext *s,
> /* decode aborted run */
> r = ff_log2_run[state->run_index[comp]];
> if (r)
> - r = get_bits_long(&s->gb, r);
> + r = get_bits(&s->gb, r);
> if (x + r * stride > w) {
> r = (w - x) / stride;
> }
>
Will apply this patch tonight unless there are objections.
- Andreas
_______________________________________________
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] 7+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/3] avformat/takdec: Don't initialize get_bits context to read one value
2022-01-05 21:37 [FFmpeg-devel] [PATCH 1/3] avformat/takdec: Don't initialize get_bits context to read one value Andreas Rheinhardt
2022-01-05 21:38 ` [FFmpeg-devel] [PATCH 2/3] avcodec/mlpdec: Use get_bits() instead of get_bits_long() when possible Andreas Rheinhardt
2022-01-05 21:38 ` [FFmpeg-devel] [PATCH 3/3] avcodec/jpeglsdec: Avoid get_bits_long() where possible Andreas Rheinhardt
@ 2022-01-06 10:10 ` Paul B Mahol
2 siblings, 0 replies; 7+ messages in thread
From: Paul B Mahol @ 2022-01-06 10:10 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Andreas Rheinhardt
LGTM
_______________________________________________
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] 7+ messages in thread
end of thread, other threads:[~2022-01-08 13:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 21:37 [FFmpeg-devel] [PATCH 1/3] avformat/takdec: Don't initialize get_bits context to read one value Andreas Rheinhardt
2022-01-05 21:38 ` [FFmpeg-devel] [PATCH 2/3] avcodec/mlpdec: Use get_bits() instead of get_bits_long() when possible Andreas Rheinhardt
2022-01-06 9:32 ` Michael Niedermayer
2022-01-06 9:35 ` Andreas Rheinhardt
2022-01-05 21:38 ` [FFmpeg-devel] [PATCH 3/3] avcodec/jpeglsdec: Avoid get_bits_long() where possible Andreas Rheinhardt
2022-01-08 13:06 ` Andreas Rheinhardt
2022-01-06 10:10 ` [FFmpeg-devel] [PATCH 1/3] avformat/takdec: Don't initialize get_bits context to read one value Paul B Mahol
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