Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions libavcodec/eatgq.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,16 @@ static av_cold int tgq_decode_init(AVCodecContext *avctx)
return 0;
}

static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
static int tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
{
const uint8_t *scantable = ff_zigzag_direct;
int i, j, value;
block[0] = get_sbits(gb, 8) * s->qtable[0];
for (i = 1; i < 64;) {
switch (show_bits(gb, 3)) {
case 4:
if (i >= 63)
return AVERROR_INVALIDDATA;
block[scantable[i++]] = 0;
case 0:
block[scantable[i++]] = 0;
Expand All @@ -73,6 +75,8 @@ static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb
case 1:
skip_bits(gb, 2);
value = get_bits(gb, 6);
if (value > 64 - i)
return AVERROR_INVALIDDATA;
for (j = 0; j < value; j++)
block[scantable[i++]] = 0;
break;
Expand Down Expand Up @@ -100,6 +104,7 @@ static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb
}
}
block[0] += 128 << 4;
return 0;
}

static void tgq_idct_put_mb(TgqContext *s, int16_t (*block)[64], AVFrame *frame,
Expand Down Expand Up @@ -160,8 +165,11 @@ static int tgq_decode_mb(TgqContext *s, GetByteContext *gbyte,
if (ret < 0)
return ret;

for (i = 0; i < 6; i++)
tgq_decode_block(s, s->block[i], &gb);
for (i = 0; i < 6; i++) {
int ret = tgq_decode_block(s, s->block[i], &gb);
if (ret < 0)
return ret;
}
tgq_idct_put_mb(s, s->block, frame, mb_x, mb_y);
bytestream2_skip(gbyte, mode);
} else {
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/wbmpdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static int wbmp_decode_frame(AVCodecContext *avctx, AVFrame *p,
if (p->linesize[0] == (width + 7) / 8)
bytestream2_get_buffer(&gb, p->data[0], height * ((width + 7) / 8));
else
readbits(p->data[0], width, height, p->linesize[0], gb.buffer, gb.buffer_end - gb.buffer_start);
readbits(p->data[0], width, height, p->linesize[0], gb.buffer, gb.buffer_end - gb.buffer);

p->key_frame = 1;
p->pict_type = AV_PICTURE_TYPE_I;
Expand Down
15 changes: 15 additions & 0 deletions libavfilter/vf_showinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "libavutil/mastering_display_metadata.h"
#include "libavutil/video_enc_params.h"
#include "libavutil/detection_bbox.h"
#include "libavutil/ambient_viewing_environment.h"
#include "libavutil/uuid.h"

#include "avfilter.h"
Expand Down Expand Up @@ -601,6 +602,17 @@ static void dump_dovi_metadata(AVFilterContext *ctx, const AVFrameSideData *sd)
av_log(ctx, AV_LOG_INFO, "source_diagonal=%"PRIu16"; ", color->source_diagonal);
}

static void dump_ambient_viewing_environment(AVFilterContext *ctx, const AVFrameSideData *sd)
{
const AVAmbientViewingEnvironment *ambient_viewing_environment =
(const AVAmbientViewingEnvironment *)sd->data;

av_log(ctx, AV_LOG_INFO, "ambient_illuminance=%f, ambient_light_x=%f, ambient_light_y=%f",
av_q2d(ambient_viewing_environment->ambient_illuminance),
av_q2d(ambient_viewing_environment->ambient_light_x),
av_q2d(ambient_viewing_environment->ambient_light_y));
}

static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
{
const char *color_range_str = av_color_range_name(frame->color_range);
Expand Down Expand Up @@ -797,6 +809,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
case AV_FRAME_DATA_DOVI_METADATA:
dump_dovi_metadata(ctx, sd);
break;
case AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT:
dump_ambient_viewing_environment(ctx, sd);
break;
default:
if (name)
av_log(ctx, AV_LOG_INFO,
Expand Down