* [FFmpeg-devel] [PATCH 2/6] avcodec/huffyuv: Inline common alloc/free functions in their callers
2024-04-04 4:59 [FFmpeg-devel] [PATCH 1/6] avcodec/huffyuvdec: Don't zero unnecessarily Andreas Rheinhardt
@ 2024-04-04 5:02 ` Andreas Rheinhardt
2024-04-04 5:02 ` [FFmpeg-devel] [PATCH 3/6] avcodec/huffyuv(dec|enc): Use union for temp/temp16 Andreas Rheinhardt
` (9 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-04-04 5:02 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/huffyuv.c | 28 ++--------------------------
libavcodec/huffyuv.h | 2 --
libavcodec/huffyuvdec.c | 14 +++++++++++---
libavcodec/huffyuvenc.c | 18 ++++++++++++------
4 files changed, 25 insertions(+), 37 deletions(-)
diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
index aaba313bf1..723ab6b92b 100644
--- a/libavcodec/huffyuv.c
+++ b/libavcodec/huffyuv.c
@@ -28,12 +28,11 @@
* huffyuv codec for libavcodec.
*/
+#include <stddef.h>
#include <stdint.h>
-#include "libavutil/attributes.h"
-#include "libavutil/error.h"
#include "libavutil/log.h"
-#include "libavutil/mem.h"
+#include "libavutil/macros.h"
#include "huffyuv.h"
@@ -59,26 +58,3 @@ int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int
}
return 0;
}
-
-av_cold int ff_huffyuv_alloc_temp(uint8_t *temp[3], uint16_t *temp16[3], int width)
-{
- int i;
-
- for (i=0; i<3; i++) {
- temp[i] = av_malloc(4 * width + 16);
- if (!temp[i])
- return AVERROR(ENOMEM);
- temp16[i] = (uint16_t*)temp[i];
- }
- return 0;
-}
-
-av_cold void ff_huffyuv_common_end(uint8_t *temp[3], uint16_t *temp16[3])
-{
- int i;
-
- for(i = 0; i < 3; i++) {
- av_freep(&temp[i]);
- temp16[i] = NULL;
- }
-}
diff --git a/libavcodec/huffyuv.h b/libavcodec/huffyuv.h
index 22a766611e..62866b7a48 100644
--- a/libavcodec/huffyuv.h
+++ b/libavcodec/huffyuv.h
@@ -55,8 +55,6 @@ typedef enum Predictor {
MEDIAN,
} Predictor;
-void ff_huffyuv_common_end(uint8_t *temp[3], uint16_t *temp16[3]);
-int ff_huffyuv_alloc_temp(uint8_t *temp[3], uint16_t *temp16[3], int width);
int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int n);
#endif /* AVCODEC_HUFFYUV_H */
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 29e5419d91..e390380867 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -323,7 +323,11 @@ static av_cold int decode_end(AVCodecContext *avctx)
HYuvDecContext *s = avctx->priv_data;
int i;
- ff_huffyuv_common_end(s->temp, s->temp16);
+ for (int i = 0; i < 3; i++) {
+ av_freep(&s->temp[i]);
+ s->temp16[i] = NULL;
+ }
+
av_freep(&s->bitstream_buffer);
for (i = 0; i < 8; i++)
@@ -599,8 +603,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
- if ((ret = ff_huffyuv_alloc_temp(s->temp, s->temp16, avctx->width)) < 0)
- return ret;
+ for (int i = 0; i < 3; i++) {
+ s->temp[i] = av_malloc(4 * avctx->width + 16);
+ if (!s->temp[i])
+ return AVERROR(ENOMEM);
+ s->temp16[i] = (uint16_t*)s->temp[i];
+ }
return 0;
}
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index 0222565245..8329666fc0 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -430,12 +430,15 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->stats[i][j]= 0;
}
- ret = ff_huffyuv_alloc_temp(s->temp, s->temp16, avctx->width);
- if (ret < 0)
- return ret;
-
s->picture_number=0;
+ for (int i = 0; i < 3; i++) {
+ s->temp[i] = av_malloc(4 * avctx->width + 16);
+ if (!s->temp[i])
+ return AVERROR(ENOMEM);
+ s->temp16[i] = (uint16_t*)s->temp[i];
+ }
+
return 0;
}
static int encode_422_bitstream(HYuvEncContext *s, int offset, int count)
@@ -1035,10 +1038,13 @@ static av_cold int encode_end(AVCodecContext *avctx)
{
HYuvEncContext *s = avctx->priv_data;
- ff_huffyuv_common_end(s->temp, s->temp16);
-
av_freep(&avctx->stats_out);
+ for (int i = 0; i < 3; i++) {
+ av_freep(&s->temp[i]);
+ s->temp16[i] = NULL;
+ }
+
return 0;
}
--
2.40.1
_______________________________________________
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] 13+ messages in thread
* [FFmpeg-devel] [PATCH 3/6] avcodec/huffyuv(dec|enc): Use union for temp/temp16
2024-04-04 4:59 [FFmpeg-devel] [PATCH 1/6] avcodec/huffyuvdec: Don't zero unnecessarily Andreas Rheinhardt
2024-04-04 5:02 ` [FFmpeg-devel] [PATCH 2/6] avcodec/huffyuv: Inline common alloc/free functions in their callers Andreas Rheinhardt
@ 2024-04-04 5:02 ` Andreas Rheinhardt
2024-04-04 5:02 ` [FFmpeg-devel] [PATCH 4/6] avcodec/huffyuv: Return proper error code Andreas Rheinhardt
` (8 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-04-04 5:02 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
These pointers already point to the same buffers, so using
a union is possible and avoids the overhead of syncing the
pointers (and saves some memory).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/huffyuvdec.c | 11 +++++------
libavcodec/huffyuvenc.c | 11 +++++------
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index e390380867..12ecfcb933 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -70,8 +70,10 @@ typedef struct HYuvDecContext {
int context;
int last_slice_end;
- uint8_t *temp[3];
- uint16_t *temp16[3]; ///< identical to temp but 16bit type
+ union {
+ uint8_t *temp[3];
+ uint16_t *temp16[3];
+ };
uint8_t len[4][MAX_VLC_N];
uint32_t bits[4][MAX_VLC_N];
uint32_t pix_bgr_map[1<<VLC_BITS];
@@ -323,10 +325,8 @@ static av_cold int decode_end(AVCodecContext *avctx)
HYuvDecContext *s = avctx->priv_data;
int i;
- for (int i = 0; i < 3; i++) {
+ for (int i = 0; i < 3; i++)
av_freep(&s->temp[i]);
- s->temp16[i] = NULL;
- }
av_freep(&s->bitstream_buffer);
@@ -607,7 +607,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->temp[i] = av_malloc(4 * avctx->width + 16);
if (!s->temp[i])
return AVERROR(ENOMEM);
- s->temp16[i] = (uint16_t*)s->temp[i];
}
return 0;
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index 8329666fc0..4f709143a2 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -65,8 +65,10 @@ typedef struct HYuvEncContext {
int context;
int picture_number;
- uint8_t *temp[3];
- uint16_t *temp16[3]; ///< identical to temp but 16bit type
+ union {
+ uint8_t *temp[3];
+ uint16_t *temp16[3];
+ };
uint64_t stats[4][MAX_VLC_N];
uint8_t len[4][MAX_VLC_N];
uint32_t bits[4][MAX_VLC_N];
@@ -436,7 +438,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->temp[i] = av_malloc(4 * avctx->width + 16);
if (!s->temp[i])
return AVERROR(ENOMEM);
- s->temp16[i] = (uint16_t*)s->temp[i];
}
return 0;
@@ -1040,10 +1041,8 @@ static av_cold int encode_end(AVCodecContext *avctx)
av_freep(&avctx->stats_out);
- for (int i = 0; i < 3; i++) {
+ for (int i = 0; i < 3; i++)
av_freep(&s->temp[i]);
- s->temp16[i] = NULL;
- }
return 0;
}
--
2.40.1
_______________________________________________
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] 13+ messages in thread
* [FFmpeg-devel] [PATCH 4/6] avcodec/huffyuv: Return proper error code
2024-04-04 4:59 [FFmpeg-devel] [PATCH 1/6] avcodec/huffyuvdec: Don't zero unnecessarily Andreas Rheinhardt
2024-04-04 5:02 ` [FFmpeg-devel] [PATCH 2/6] avcodec/huffyuv: Inline common alloc/free functions in their callers Andreas Rheinhardt
2024-04-04 5:02 ` [FFmpeg-devel] [PATCH 3/6] avcodec/huffyuv(dec|enc): Use union for temp/temp16 Andreas Rheinhardt
@ 2024-04-04 5:02 ` Andreas Rheinhardt
2024-04-04 5:02 ` [FFmpeg-devel] [PATCH 5/6] avcodec/huffyuvenc: Avoid duplicate variables Andreas Rheinhardt
` (7 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-04-04 5:02 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Also forward said error code in the encoder.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/huffyuv.c | 3 ++-
libavcodec/huffyuvenc.c | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
index 723ab6b92b..f22c5ebc59 100644
--- a/libavcodec/huffyuv.c
+++ b/libavcodec/huffyuv.c
@@ -31,6 +31,7 @@
#include <stddef.h>
#include <stdint.h>
+#include "libavutil/error.h"
#include "libavutil/log.h"
#include "libavutil/macros.h"
@@ -48,7 +49,7 @@ int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int
for (int i = FF_ARRAY_ELEMS(lens) - 1; i > 0; i--) {
if ((lens[i] + codes[i]) & 1) {
av_log(NULL, AV_LOG_ERROR, "Error generating huffman table\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
codes[i - 1] = (lens[i] + codes[i]) >> 1;
}
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index 4f709143a2..152f94cefb 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -232,9 +232,9 @@ static int store_huffman_tables(HYuvEncContext *s, uint8_t *buf)
if ((ret = ff_huff_gen_len_table(s->len[i], s->stats[i], s->vlc_n, 0)) < 0)
return ret;
- if (ff_huffyuv_generate_bits_table(s->bits[i], s->len[i], s->vlc_n) < 0) {
- return -1;
- }
+ ret = ff_huffyuv_generate_bits_table(s->bits[i], s->len[i], s->vlc_n);
+ if (ret < 0)
+ return ret;
size += store_table(s, s->len[i], buf + size);
}
--
2.40.1
_______________________________________________
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] 13+ messages in thread
* [FFmpeg-devel] [PATCH 5/6] avcodec/huffyuvenc: Avoid duplicate variables
2024-04-04 4:59 [FFmpeg-devel] [PATCH 1/6] avcodec/huffyuvdec: Don't zero unnecessarily Andreas Rheinhardt
` (2 preceding siblings ...)
2024-04-04 5:02 ` [FFmpeg-devel] [PATCH 4/6] avcodec/huffyuv: Return proper error code Andreas Rheinhardt
@ 2024-04-04 5:02 ` Andreas Rheinhardt
2024-04-04 5:02 ` [FFmpeg-devel] [PATCH 6/6] avcodec/huffyuvenc: Avoid code duplication Andreas Rheinhardt
` (6 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-04-04 5:02 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Also simplify assigningfake strides.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/huffyuvenc.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index 152f94cefb..fd6b01de81 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -755,16 +755,15 @@ static inline int encode_bgra_bitstream(HYuvEncContext *s, int count, int planes
}
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
- const AVFrame *pict, int *got_packet)
+ const AVFrame *p, int *got_packet)
{
HYuvEncContext *s = avctx->priv_data;
const int width = avctx->width;
const int width2 = avctx->width >> 1;
const int height = avctx->height;
- const int fake_ystride = s->interlaced ? pict->linesize[0]*2 : pict->linesize[0];
- const int fake_ustride = s->interlaced ? pict->linesize[1]*2 : pict->linesize[1];
- const int fake_vstride = s->interlaced ? pict->linesize[2]*2 : pict->linesize[2];
- const AVFrame * const p = pict;
+ const int fake_ystride = (1 + s->interlaced) * p->linesize[0];
+ const int fake_ustride = (1 + s->interlaced) * p->linesize[1];
+ const int fake_vstride = (1 + s->interlaced) * p->linesize[2];
int i, j, size = 0, ret;
if ((ret = ff_alloc_packet(avctx, pkt, width * height * 3 * 4 + FF_INPUT_BUFFER_MIN_SIZE)) < 0)
--
2.40.1
_______________________________________________
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] 13+ messages in thread
* [FFmpeg-devel] [PATCH 6/6] avcodec/huffyuvenc: Avoid code duplication
2024-04-04 4:59 [FFmpeg-devel] [PATCH 1/6] avcodec/huffyuvdec: Don't zero unnecessarily Andreas Rheinhardt
` (3 preceding siblings ...)
2024-04-04 5:02 ` [FFmpeg-devel] [PATCH 5/6] avcodec/huffyuvenc: Avoid duplicate variables Andreas Rheinhardt
@ 2024-04-04 5:02 ` Andreas Rheinhardt
2024-04-04 17:52 ` [FFmpeg-devel] [PATCH 7/7] avcodec/huffyuvenc: Deduplicate options Andreas Rheinhardt
` (5 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-04-04 5:02 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
This also fixes misindentated code.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/huffyuvenc.c | 146 ++++++++++++----------------------------
1 file changed, 43 insertions(+), 103 deletions(-)
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index fd6b01de81..d822793406 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -499,7 +499,7 @@ static int encode_422_bitstream(HYuvEncContext *s, int offset, int count)
static int encode_plane_bitstream(HYuvEncContext *s, int width, int plane)
{
- int i, count = width/2;
+ int count = width/2;
if (put_bytes_left(&s->pb, 0) < count * s->bps / 2) {
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
@@ -546,112 +546,52 @@ static int encode_plane_bitstream(HYuvEncContext *s, int width, int plane)
put_bits(&s->pb, s->len[plane][y1>>2], s->bits[plane][y1>>2]);\
put_bits(&s->pb, 2, y1&3);
- if (s->bps <= 8) {
- if (s->flags & AV_CODEC_FLAG_PASS1) {
- for (i = 0; i < count; i++) {
- LOAD2;
- STAT2;
- }
- if (width&1) {
- LOADEND;
- STATEND;
- }
- }
- if (s->avctx->flags2 & AV_CODEC_FLAG2_NO_OUTPUT)
- return 0;
+#define ENCODE_PLANE(LOAD, LOADEND, WRITE, WRITEEND, STAT, STATEND) \
+do { \
+ if (s->flags & AV_CODEC_FLAG_PASS1) { \
+ for (int i = 0; i < count; i++) { \
+ LOAD; \
+ STAT; \
+ } \
+ if (width & 1) { \
+ LOADEND; \
+ STATEND; \
+ } \
+ } \
+ if (s->avctx->flags2 & AV_CODEC_FLAG2_NO_OUTPUT) \
+ return 0; \
+ \
+ if (s->context) { \
+ for (int i = 0; i < count; i++) { \
+ LOAD; \
+ STAT; \
+ WRITE; \
+ } \
+ if (width & 1) { \
+ LOADEND; \
+ STATEND; \
+ WRITEEND; \
+ } \
+ } else { \
+ for (int i = 0; i < count; i++) { \
+ LOAD; \
+ WRITE; \
+ } \
+ if (width & 1) { \
+ LOADEND; \
+ WRITEEND; \
+ } \
+ } \
+} while (0)
- if (s->context) {
- for (i = 0; i < count; i++) {
- LOAD2;
- STAT2;
- WRITE2;
- }
- if (width&1) {
- LOADEND;
- STATEND;
- WRITEEND;
- }
- } else {
- for (i = 0; i < count; i++) {
- LOAD2;
- WRITE2;
- }
- if (width&1) {
- LOADEND;
- WRITEEND;
- }
- }
+ if (s->bps <= 8) {
+ ENCODE_PLANE(LOAD2, LOADEND, WRITE2, WRITEEND, STAT2, STATEND);
} else if (s->bps <= 14) {
int mask = s->n - 1;
- if (s->flags & AV_CODEC_FLAG_PASS1) {
- for (i = 0; i < count; i++) {
- LOAD2_14;
- STAT2;
- }
- if (width&1) {
- LOADEND_14;
- STATEND;
- }
- }
- if (s->avctx->flags2 & AV_CODEC_FLAG2_NO_OUTPUT)
- return 0;
-
- if (s->context) {
- for (i = 0; i < count; i++) {
- LOAD2_14;
- STAT2;
- WRITE2;
- }
- if (width&1) {
- LOADEND_14;
- STATEND;
- WRITEEND;
- }
- } else {
- for (i = 0; i < count; i++) {
- LOAD2_14;
- WRITE2;
- }
- if (width&1) {
- LOADEND_14;
- WRITEEND;
- }
- }
+
+ ENCODE_PLANE(LOAD2_14, LOADEND_14, WRITE2, WRITEEND, STAT2, STATEND);
} else {
- if (s->flags & AV_CODEC_FLAG_PASS1) {
- for (i = 0; i < count; i++) {
- LOAD2_16;
- STAT2_16;
- }
- if (width&1) {
- LOADEND_16;
- STATEND_16;
- }
- }
- if (s->avctx->flags2 & AV_CODEC_FLAG2_NO_OUTPUT)
- return 0;
-
- if (s->context) {
- for (i = 0; i < count; i++) {
- LOAD2_16;
- STAT2_16;
- WRITE2_16;
- }
- if (width&1) {
- LOADEND_16;
- STATEND_16;
- WRITEEND_16;
- }
- } else {
- for (i = 0; i < count; i++) {
- LOAD2_16;
- WRITE2_16;
- }
- if (width&1) {
- LOADEND_16;
- WRITEEND_16;
- }
- }
+ ENCODE_PLANE(LOAD2_16, LOADEND_16, WRITE2_16, WRITEEND_16, STAT2_16, STATEND_16);
}
#undef LOAD2
#undef STAT2
--
2.40.1
_______________________________________________
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] 13+ messages in thread
* [FFmpeg-devel] [PATCH 7/7] avcodec/huffyuvenc: Deduplicate options
2024-04-04 4:59 [FFmpeg-devel] [PATCH 1/6] avcodec/huffyuvdec: Don't zero unnecessarily Andreas Rheinhardt
` (4 preceding siblings ...)
2024-04-04 5:02 ` [FFmpeg-devel] [PATCH 6/6] avcodec/huffyuvenc: Avoid code duplication Andreas Rheinhardt
@ 2024-04-04 17:52 ` Andreas Rheinhardt
2024-04-04 19:30 ` [FFmpeg-devel] [PATCH 8/9] avcodec/huffyuvdec: Use assert to check for things that can't fail Andreas Rheinhardt
` (4 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-04-04 17:52 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/huffyuvenc.c | 42 ++++++++++++++++++-----------------------
1 file changed, 18 insertions(+), 24 deletions(-)
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index d822793406..294d6ad41c 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -989,37 +989,24 @@ static av_cold int encode_end(AVCodecContext *avctx)
#define OFFSET(x) offsetof(HYuvEncContext, x)
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
-#define COMMON_OPTIONS \
- { "non_deterministic", "Allow multithreading for e.g. context=1 at the expense of determinism", \
- OFFSET(non_determ), AV_OPT_TYPE_BOOL, { .i64 = 0 }, \
- 0, 1, VE }, \
- { "pred", "Prediction method", OFFSET(predictor), AV_OPT_TYPE_INT, { .i64 = LEFT }, LEFT, MEDIAN, VE, .unit = "pred" }, \
- { "left", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LEFT }, INT_MIN, INT_MAX, VE, .unit = "pred" }, \
- { "plane", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PLANE }, INT_MIN, INT_MAX, VE, .unit = "pred" }, \
- { "median", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MEDIAN }, INT_MIN, INT_MAX, VE, .unit = "pred" }, \
-
-static const AVOption normal_options[] = {
- COMMON_OPTIONS
- { NULL },
-};
-
-static const AVOption ff_options[] = {
- COMMON_OPTIONS
+static const AVOption options[] = {
+ /* ffvhuff-only options */
{ "context", "Set per-frame huffman tables", OFFSET(context), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
+ /* Common options */
+ { "non_deterministic", "Allow multithreading for e.g. context=1 at the expense of determinism",
+ OFFSET(non_determ), AV_OPT_TYPE_BOOL, { .i64 = 0 },
+ 0, 1, VE },
+ { "pred", "Prediction method", OFFSET(predictor), AV_OPT_TYPE_INT, { .i64 = LEFT }, LEFT, MEDIAN, VE, .unit = "pred" },
+ { "left", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LEFT }, INT_MIN, INT_MAX, VE, .unit = "pred" },
+ { "plane", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PLANE }, INT_MIN, INT_MAX, VE, .unit = "pred" },
+ { "median", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MEDIAN }, INT_MIN, INT_MAX, VE, .unit = "pred" },
{ NULL },
};
static const AVClass normal_class = {
.class_name = "huffyuv",
.item_name = av_default_item_name,
- .option = normal_options,
- .version = LIBAVUTIL_VERSION_INT,
-};
-
-static const AVClass ff_class = {
- .class_name = "ffvhuff",
- .item_name = av_default_item_name,
- .option = ff_options,
+ .option = options + 1,
.version = LIBAVUTIL_VERSION_INT,
};
@@ -1043,6 +1030,13 @@ const FFCodec ff_huffyuv_encoder = {
};
#if CONFIG_FFVHUFF_ENCODER
+static const AVClass ff_class = {
+ .class_name = "ffvhuff",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
const FFCodec ff_ffvhuff_encoder = {
.p.name = "ffvhuff",
CODEC_LONG_NAME("Huffyuv FFmpeg variant"),
--
2.40.1
_______________________________________________
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] 13+ messages in thread
* [FFmpeg-devel] [PATCH 8/9] avcodec/huffyuvdec: Use assert to check for things that can't fail
2024-04-04 4:59 [FFmpeg-devel] [PATCH 1/6] avcodec/huffyuvdec: Don't zero unnecessarily Andreas Rheinhardt
` (5 preceding siblings ...)
2024-04-04 17:52 ` [FFmpeg-devel] [PATCH 7/7] avcodec/huffyuvenc: Deduplicate options Andreas Rheinhardt
@ 2024-04-04 19:30 ` Andreas Rheinhardt
2024-04-04 19:30 ` [FFmpeg-devel] [PATCH 9/9] avcodec/dv: Don't pretend initializing work chunks can fail Andreas Rheinhardt
` (3 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-04-04 19:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/huffyuvdec.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index e35d55c8ad..a8ccb724f5 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -290,13 +290,13 @@ static int read_old_huffman_tables(HYuvDecContext *s)
bytestream2_init(&gb, classic_shift_luma,
sizeof(classic_shift_luma));
- if ((ret = read_len_table(s->len[0], &gb, 256)) < 0)
- return ret;
+ ret = read_len_table(s->len[0], &gb, 256);
+ av_assert1(ret >= 0);
bytestream2_init(&gb, classic_shift_chroma,
sizeof(classic_shift_chroma));
- if ((ret = read_len_table(s->len[1], &gb, 256)) < 0)
- return ret;
+ ret = read_len_table(s->len[1], &gb, 256);
+ av_assert1(ret >= 0);
for (i = 0; i < 256; i++)
s->bits[0][i] = classic_add_luma[i];
--
2.40.1
_______________________________________________
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] 13+ messages in thread
* [FFmpeg-devel] [PATCH 9/9] avcodec/dv: Don't pretend initializing work chunks can fail
2024-04-04 4:59 [FFmpeg-devel] [PATCH 1/6] avcodec/huffyuvdec: Don't zero unnecessarily Andreas Rheinhardt
` (6 preceding siblings ...)
2024-04-04 19:30 ` [FFmpeg-devel] [PATCH 8/9] avcodec/huffyuvdec: Use assert to check for things that can't fail Andreas Rheinhardt
@ 2024-04-04 19:30 ` Andreas Rheinhardt
2024-04-04 19:33 ` Andreas Rheinhardt
2024-04-04 19:33 ` [FFmpeg-devel] [PATCH v2 8/9] avcodec/huffyuvdec: Use bytestream API for byte-aligned reads Andreas Rheinhardt
` (2 subsequent siblings)
10 siblings, 1 reply; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-04-04 19:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/dv.c | 4 +---
libavcodec/dv_internal.h | 2 +-
libavcodec/dvdec.c | 6 +-----
libavcodec/dvenc.c | 6 +-----
4 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index eb49978ad8..194d982562 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -166,7 +166,7 @@ static inline void dv_calc_mb_coordinates(const AVDVProfile *d, int chan,
}
}
-int ff_dv_init_dynamic_tables(DVwork_chunk *work_chunks, const AVDVProfile *d)
+void ff_dv_init_dynamic_tables(DVwork_chunk *work_chunks, const AVDVProfile *d)
{
int j, i, c, s, p;
@@ -185,6 +185,4 @@ int ff_dv_init_dynamic_tables(DVwork_chunk *work_chunks, const AVDVProfile *d)
}
}
}
-
- return 0;
}
diff --git a/libavcodec/dv_internal.h b/libavcodec/dv_internal.h
index 4b4151c88d..05e26a8138 100644
--- a/libavcodec/dv_internal.h
+++ b/libavcodec/dv_internal.h
@@ -32,7 +32,7 @@ typedef struct DVwork_chunk {
uint16_t mb_coordinates[5];
} DVwork_chunk;
-int ff_dv_init_dynamic_tables(DVwork_chunk *work_chunks, const AVDVProfile *d);
+void ff_dv_init_dynamic_tables(DVwork_chunk *work_chunks, const AVDVProfile *d);
static inline int dv_work_pool_size(const AVDVProfile *d)
{
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index a06e4807e7..9e8d40187d 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -637,11 +637,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
if (sys != s->sys) {
- ret = ff_dv_init_dynamic_tables(s->work_chunks, sys);
- if (ret < 0) {
- av_log(avctx, AV_LOG_ERROR, "Error initializing the work tables.\n");
- return ret;
- }
+ ff_dv_init_dynamic_tables(s->work_chunks, sys);
dv_init_weight_tables(s, sys);
s->sys = sys;
}
diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index ce21247081..3afeedbb87 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -93,11 +93,7 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
- ret = ff_dv_init_dynamic_tables(s->work_chunks, s->sys);
- if (ret < 0) {
- av_log(avctx, AV_LOG_ERROR, "Error initializing work tables.\n");
- return ret;
- }
+ ff_dv_init_dynamic_tables(s->work_chunks, s->sys);
memset(&fdsp,0, sizeof(fdsp));
memset(&mecc,0, sizeof(mecc));
--
2.40.1
_______________________________________________
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] 13+ messages in thread
* Re: [FFmpeg-devel] [PATCH 9/9] avcodec/dv: Don't pretend initializing work chunks can fail
2024-04-04 19:30 ` [FFmpeg-devel] [PATCH 9/9] avcodec/dv: Don't pretend initializing work chunks can fail Andreas Rheinhardt
@ 2024-04-04 19:33 ` Andreas Rheinhardt
0 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-04-04 19:33 UTC (permalink / raw)
To: ffmpeg-devel
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavcodec/dv.c | 4 +---
> libavcodec/dv_internal.h | 2 +-
> libavcodec/dvdec.c | 6 +-----
> libavcodec/dvenc.c | 6 +-----
> 4 files changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/libavcodec/dv.c b/libavcodec/dv.c
> index eb49978ad8..194d982562 100644
> --- a/libavcodec/dv.c
> +++ b/libavcodec/dv.c
> @@ -166,7 +166,7 @@ static inline void dv_calc_mb_coordinates(const AVDVProfile *d, int chan,
> }
> }
>
> -int ff_dv_init_dynamic_tables(DVwork_chunk *work_chunks, const AVDVProfile *d)
> +void ff_dv_init_dynamic_tables(DVwork_chunk *work_chunks, const AVDVProfile *d)
> {
> int j, i, c, s, p;
>
> @@ -185,6 +185,4 @@ int ff_dv_init_dynamic_tables(DVwork_chunk *work_chunks, const AVDVProfile *d)
> }
> }
> }
> -
> - return 0;
> }
> diff --git a/libavcodec/dv_internal.h b/libavcodec/dv_internal.h
> index 4b4151c88d..05e26a8138 100644
> --- a/libavcodec/dv_internal.h
> +++ b/libavcodec/dv_internal.h
> @@ -32,7 +32,7 @@ typedef struct DVwork_chunk {
> uint16_t mb_coordinates[5];
> } DVwork_chunk;
>
> -int ff_dv_init_dynamic_tables(DVwork_chunk *work_chunks, const AVDVProfile *d);
> +void ff_dv_init_dynamic_tables(DVwork_chunk *work_chunks, const AVDVProfile *d);
>
> static inline int dv_work_pool_size(const AVDVProfile *d)
> {
> diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
> index a06e4807e7..9e8d40187d 100644
> --- a/libavcodec/dvdec.c
> +++ b/libavcodec/dvdec.c
> @@ -637,11 +637,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame,
> }
>
> if (sys != s->sys) {
> - ret = ff_dv_init_dynamic_tables(s->work_chunks, sys);
> - if (ret < 0) {
> - av_log(avctx, AV_LOG_ERROR, "Error initializing the work tables.\n");
> - return ret;
> - }
> + ff_dv_init_dynamic_tables(s->work_chunks, sys);
> dv_init_weight_tables(s, sys);
> s->sys = sys;
> }
> diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
> index ce21247081..3afeedbb87 100644
> --- a/libavcodec/dvenc.c
> +++ b/libavcodec/dvenc.c
> @@ -93,11 +93,7 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
> return AVERROR(EINVAL);
> }
>
> - ret = ff_dv_init_dynamic_tables(s->work_chunks, s->sys);
> - if (ret < 0) {
> - av_log(avctx, AV_LOG_ERROR, "Error initializing work tables.\n");
> - return ret;
> - }
> + ff_dv_init_dynamic_tables(s->work_chunks, s->sys);
>
> memset(&fdsp,0, sizeof(fdsp));
> memset(&mecc,0, sizeof(mecc));
Sorry, sent the wrong patches. Ignore v1 of #8 and #9.
- 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] 13+ messages in thread
* [FFmpeg-devel] [PATCH v2 8/9] avcodec/huffyuvdec: Use bytestream API for byte-aligned reads
2024-04-04 4:59 [FFmpeg-devel] [PATCH 1/6] avcodec/huffyuvdec: Don't zero unnecessarily Andreas Rheinhardt
` (7 preceding siblings ...)
2024-04-04 19:30 ` [FFmpeg-devel] [PATCH 9/9] avcodec/dv: Don't pretend initializing work chunks can fail Andreas Rheinhardt
@ 2024-04-04 19:33 ` Andreas Rheinhardt
2024-04-04 19:33 ` [FFmpeg-devel] [PATCH v2 9/9] avcodec/huffyuvdec: Use assert to check for things that can't fail Andreas Rheinhardt
2024-04-05 22:23 ` [FFmpeg-devel] [PATCH 1/6] avcodec/huffyuvdec: Don't zero unnecessarily Andreas Rheinhardt
10 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-04-04 19:33 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
This also allows to remove the padding from these buffers.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/huffyuvdec.c | 53 ++++++++++++++++++++++-------------------
1 file changed, 28 insertions(+), 25 deletions(-)
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 12ecfcb933..e35d55c8ad 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -36,6 +36,7 @@
#include "avcodec.h"
#include "bswapdsp.h"
+#include "bytestream.h"
#include "codec_internal.h"
#include "get_bits.h"
#include "huffyuv.h"
@@ -86,21 +87,17 @@ typedef struct HYuvDecContext {
} HYuvDecContext;
-#define classic_shift_luma_table_size 42
-static const unsigned char classic_shift_luma[classic_shift_luma_table_size + AV_INPUT_BUFFER_PADDING_SIZE] = {
+static const uint8_t classic_shift_luma[] = {
34, 36, 35, 69, 135, 232, 9, 16, 10, 24, 11, 23, 12, 16, 13, 10,
14, 8, 15, 8, 16, 8, 17, 20, 16, 10, 207, 206, 205, 236, 11, 8,
- 10, 21, 9, 23, 8, 8, 199, 70, 69, 68, 0,
- 0,0,0,0,0,0,0,0,
+ 10, 21, 9, 23, 8, 8, 199, 70, 69, 68,
};
-#define classic_shift_chroma_table_size 59
-static const unsigned char classic_shift_chroma[classic_shift_chroma_table_size + AV_INPUT_BUFFER_PADDING_SIZE] = {
+static const uint8_t classic_shift_chroma[] = {
66, 36, 37, 38, 39, 40, 41, 75, 76, 77, 110, 239, 144, 81, 82, 83,
84, 85, 118, 183, 56, 57, 88, 89, 56, 89, 154, 57, 58, 57, 26, 141,
57, 56, 58, 57, 58, 57, 184, 119, 214, 245, 116, 83, 82, 49, 80, 79,
- 78, 77, 44, 75, 41, 40, 39, 38, 37, 36, 34, 0,
- 0,0,0,0,0,0,0,0,
+ 78, 77, 44, 75, 41, 40, 39, 38, 37, 36, 34,
};
static const unsigned char classic_add_luma[256] = {
@@ -141,23 +138,30 @@ static const unsigned char classic_add_chroma[256] = {
6, 12, 8, 10, 7, 9, 6, 4, 6, 2, 2, 3, 3, 3, 3, 2,
};
-static int read_len_table(uint8_t *dst, GetBitContext *gb, int n)
+static int read_len_table(uint8_t *dst, GetByteContext *gb, int n)
{
int i, val, repeat;
for (i = 0; i < n;) {
- repeat = get_bits(gb, 3);
- val = get_bits(gb, 5);
- if (repeat == 0)
- repeat = get_bits(gb, 8);
- if (i + repeat > n || get_bits_left(gb) < 0) {
- av_log(NULL, AV_LOG_ERROR, "Error reading huffman table\n");
- return AVERROR_INVALIDDATA;
+ if (bytestream2_get_bytes_left(gb) <= 0)
+ goto error;
+ repeat = bytestream2_peek_byteu(gb) >> 5;
+ val = bytestream2_get_byteu(gb) & 0x1F;
+ if (repeat == 0) {
+ if (bytestream2_get_bytes_left(gb) <= 0)
+ goto error;
+ repeat = bytestream2_get_byteu(gb);
}
+ if (i + repeat > n)
+ goto error;
while (repeat--)
dst[i++] = val;
}
return 0;
+
+error:
+ av_log(NULL, AV_LOG_ERROR, "Error reading huffman table\n");
+ return AVERROR_INVALIDDATA;
}
static int generate_joint_tables(HYuvDecContext *s)
@@ -253,12 +257,11 @@ out:
static int read_huffman_tables(HYuvDecContext *s, const uint8_t *src, int length)
{
- GetBitContext gb;
+ GetByteContext gb;
int i, ret;
int count = 3;
- if ((ret = init_get_bits(&gb, src, length * 8)) < 0)
- return ret;
+ bytestream2_init(&gb, src, length);
if (s->version > 2)
count = 1 + s->alpha + 2*s->chroma;
@@ -277,21 +280,21 @@ static int read_huffman_tables(HYuvDecContext *s, const uint8_t *src, int length
if ((ret = generate_joint_tables(s)) < 0)
return ret;
- return (get_bits_count(&gb) + 7) / 8;
+ return bytestream2_tell(&gb);
}
static int read_old_huffman_tables(HYuvDecContext *s)
{
- GetBitContext gb;
+ GetByteContext gb;
int i, ret;
- init_get_bits(&gb, classic_shift_luma,
- classic_shift_luma_table_size * 8);
+ bytestream2_init(&gb, classic_shift_luma,
+ sizeof(classic_shift_luma));
if ((ret = read_len_table(s->len[0], &gb, 256)) < 0)
return ret;
- init_get_bits(&gb, classic_shift_chroma,
- classic_shift_chroma_table_size * 8);
+ bytestream2_init(&gb, classic_shift_chroma,
+ sizeof(classic_shift_chroma));
if ((ret = read_len_table(s->len[1], &gb, 256)) < 0)
return ret;
--
2.40.1
_______________________________________________
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] 13+ messages in thread
* [FFmpeg-devel] [PATCH v2 9/9] avcodec/huffyuvdec: Use assert to check for things that can't fail
2024-04-04 4:59 [FFmpeg-devel] [PATCH 1/6] avcodec/huffyuvdec: Don't zero unnecessarily Andreas Rheinhardt
` (8 preceding siblings ...)
2024-04-04 19:33 ` [FFmpeg-devel] [PATCH v2 8/9] avcodec/huffyuvdec: Use bytestream API for byte-aligned reads Andreas Rheinhardt
@ 2024-04-04 19:33 ` Andreas Rheinhardt
2024-04-05 22:23 ` [FFmpeg-devel] [PATCH 1/6] avcodec/huffyuvdec: Don't zero unnecessarily Andreas Rheinhardt
10 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-04-04 19:33 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/huffyuvdec.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index e35d55c8ad..a8ccb724f5 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -290,13 +290,13 @@ static int read_old_huffman_tables(HYuvDecContext *s)
bytestream2_init(&gb, classic_shift_luma,
sizeof(classic_shift_luma));
- if ((ret = read_len_table(s->len[0], &gb, 256)) < 0)
- return ret;
+ ret = read_len_table(s->len[0], &gb, 256);
+ av_assert1(ret >= 0);
bytestream2_init(&gb, classic_shift_chroma,
sizeof(classic_shift_chroma));
- if ((ret = read_len_table(s->len[1], &gb, 256)) < 0)
- return ret;
+ ret = read_len_table(s->len[1], &gb, 256);
+ av_assert1(ret >= 0);
for (i = 0; i < 256; i++)
s->bits[0][i] = classic_add_luma[i];
--
2.40.1
_______________________________________________
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] 13+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/6] avcodec/huffyuvdec: Don't zero unnecessarily
2024-04-04 4:59 [FFmpeg-devel] [PATCH 1/6] avcodec/huffyuvdec: Don't zero unnecessarily Andreas Rheinhardt
` (9 preceding siblings ...)
2024-04-04 19:33 ` [FFmpeg-devel] [PATCH v2 9/9] avcodec/huffyuvdec: Use assert to check for things that can't fail Andreas Rheinhardt
@ 2024-04-05 22:23 ` Andreas Rheinhardt
10 siblings, 0 replies; 13+ messages in thread
From: Andreas Rheinhardt @ 2024-04-05 22:23 UTC (permalink / raw)
To: ffmpeg-devel
Andreas Rheinhardt:
> A decoder's private data has already been zeroed (apart from options)
> before init is called.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavcodec/huffyuvdec.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
> index 3bed27be21..29e5419d91 100644
> --- a/libavcodec/huffyuvdec.c
> +++ b/libavcodec/huffyuvdec.c
> @@ -346,7 +346,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
> ff_bswapdsp_init(&s->bdsp);
> ff_huffyuvdsp_init(&s->hdsp, avctx->pix_fmt);
> ff_llviddsp_init(&s->llviddsp);
> - memset(s->vlc, 0, 4 * sizeof(VLC));
>
> s->interlaced = avctx->height > 288;
> s->bgr32 = 1;
Will apply this patchset tomorrow 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] 13+ messages in thread