Avoid anonymously typedeffed structs and enums, drop an unused context member,
a small wording fix, sizeof(type) ---> sizeof(*variable), silence a needlessly
verbose log message.
---
libavcodec/cinepakenc.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/libavcodec/cinepakenc.c b/libavcodec/cinepakenc.c
index 05a7b88..917cead 100644
--- a/libavcodec/cinepakenc.c
+++ b/libavcodec/cinepakenc.c
@@ -102,7 +102,7 @@
// NOTE the decoder in ffmpeg has its own arbitrary limitation on the number
// of strips, currently 32
-typedef enum {
+typedef enum CinepakMode {
MODE_V1_ONLY = 0,
MODE_V1_V4,
MODE_MC,
@@ -110,7 +110,7 @@ typedef enum {
MODE_COUNT,
} CinepakMode;
-typedef enum {
+typedef enum mb_encoding {
ENC_V1,
ENC_V4,
ENC_SKIP,
@@ -118,7 +118,7 @@ typedef enum {
ENC_UNCERTAIN
} mb_encoding;
-typedef struct {
+typedef struct mb_info {
int v1_vector; // index into v1 codebook
int v1_error; // error when using V1 encoding
int v4_vector[4]; // indices into v4 codebook
@@ -127,7 +127,7 @@ typedef struct {
mb_encoding best_encoding; // last result from calculate_mode_score()
} mb_info;
-typedef struct {
+typedef struct strip_info {
int v1_codebook[CODEBOOK_MAX * VECTOR_MAX];
int v4_codebook[CODEBOOK_MAX * VECTOR_MAX];
int v1_size;
@@ -135,8 +135,7 @@ typedef struct {
CinepakMode mode;
} strip_info;
-typedef struct {
- const AVClass *class;
+typedef struct CinepakEncContext {
AVCodecContext *avctx;
unsigned char *pict_bufs[4], *strip_buf, *frame_buf;
AVFrame *last_frame;
@@ -197,7 +196,7 @@ static av_cold int cinepak_encode_init(AVCodecContext
*avctx)
}
if (s->min_min_strips > s->max_max_strips) {
- av_log(avctx, AV_LOG_ERROR, "minimal number of strips can not exceed
maximal (got %i and %i)\n",
+ av_log(avctx, AV_LOG_ERROR, "minimum number of strips must not exceed
maximum (got %i and %i)\n",
s->min_min_strips, s->max_max_strips);
return AVERROR(EINVAL);
}
@@ -212,10 +211,10 @@ static av_cold int cinepak_encode_init(AVCodecContext
*avctx)
if (!(s->input_frame = av_frame_alloc()))
goto enomem;
- if (!(s->codebook_input = av_malloc(sizeof(int) * (avctx->pix_fmt ==
AV_PIX_FMT_RGB24 ? 6 : 4) * (avctx->width * avctx->height) >> 2)))
+ if (!(s->codebook_input = av_malloc(sizeof(*s->codebook_input) *
(avctx->pix_fmt == AV_PIX_FMT_RGB24 ? 6 : 4) * (avctx->width * avctx->height)
>> 2)))
goto enomem;
- if (!(s->codebook_closest = av_malloc(sizeof(int) * (avctx->width *
avctx->height) >> 2)))
+ if (!(s->codebook_closest = av_malloc(sizeof(*s->codebook_closest) *
(avctx->width * avctx->height) >> 2)))
goto enomem;
for (x = 0; x < (avctx->pix_fmt == AV_PIX_FMT_RGB24 ? 4 : 3); x++)
@@ -618,7 +617,7 @@ static int encode_mode(CinepakEncContext *s, int h,
switch (info->mode) {
case MODE_V1_ONLY:
- av_log(s->avctx, AV_LOG_INFO, "mb_count = %i\n", mb_count);
+ av_log(s->avctx, AV_LOG_VERBOSE, "mb_count = %i\n", mb_count);
ret += write_chunk_header(buf + ret, 0x32, mb_count);
for (x = 0; x < mb_count; x++)
--
2.1.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel