FFmpeg
Loading...
Searching...
No Matches
venc_data_dump.c
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include <stdio.h>
20#include <stdint.h>
21#include <stdlib.h>
22
23#include "decode_simple.h"
24
25#include "libavutil/common.h"
26#include "libavutil/dict.h"
27#include "libavutil/error.h"
29
31
32#include "libavcodec/avcodec.h"
33
35{
37
38 if (!frame)
39 return 0;
40
41 fprintf(stdout, "frame %"PRId64"\n", dc->decoder->frame_num - 1);
42
44 if (sd) {
46
47 fprintf(stdout, "AVVideoEncParams %d\n", par->type);
48 fprintf(stdout, "qp %d\n", par->qp);
49 for (int i = 0; i < FF_ARRAY_ELEMS(par->delta_qp); i++)
50 for (int j = 0; j < FF_ARRAY_ELEMS(par->delta_qp[i]); j++) {
51 if (par->delta_qp[i][j])
52 fprintf(stdout, "delta_qp[%d][%d] %"PRId32"\n", i, j, par->delta_qp[i][j]);
53 }
54
55 if (par->nb_blocks) {
56 fprintf(stdout, "nb_blocks %d\n", par->nb_blocks);
57 for (int i = 0; i < par->nb_blocks; i++) {
59
60 fprintf(stdout, "block %d %d:%d %dx%d %"PRId32"\n",
61 i, b->src_x, b->src_y, b->w, b->h, b->delta_qp);
62 }
63 }
64 }
65
66 return 0;
67}
68
69int main(int argc, char **argv)
70{
72
73 unsigned int stream_idx, max_frames;
74 const char *filename, *thread_type = NULL, *nb_threads = NULL;
75 int ret = 0;
76
77 if (argc <= 3) {
78 fprintf(stderr, "Usage: %s <input file> <stream index> <max frame count> [<thread count> <thread type>]\n", argv[0]);
79 return 0;
80 }
81
82 filename = argv[1];
83 stream_idx = strtol(argv[2], NULL, 0);
84 max_frames = strtol(argv[3], NULL, 0);
85 if (argc > 5) {
86 nb_threads = argv[4];
87 thread_type = argv[5];
88 }
89
90 ret = ds_open(&dc, filename, stream_idx);
91 if (ret < 0)
92 goto finish;
93
95 dc.max_frames = max_frames;
96
97 ret = av_dict_set(&dc.decoder_opts, "threads", nb_threads, 0);
98 ret |= av_dict_set(&dc.decoder_opts, "thread_type", thread_type, 0);
99 ret |= av_dict_set(&dc.decoder_opts, "export_side_data", "venc_params", 0);
100
101 if (ret < 0)
102 goto finish;
103
104 ret = ds_run(&dc);
105
106finish:
107 ds_free(&dc);
108 return ret;
109}
Libavcodec external API header.
Main libavformat public API header.
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
common internal and external API header
#define NULL
Definition coverity.c:32
int ds_open(DecodeContext *dc, const char *url, int stream_idx)
void ds_free(DecodeContext *dc)
int ds_run(DecodeContext *dc)
static AVFrame * frame
Public dictionary API.
int main
Definition dovi_rpuenc.c:38
error code definitions
static av_always_inline int process_frame(AVTextFormatContext *tfc, InputFile *ifile, AVFrame *frame, const AVPacket *pkt, int *packet_new)
Definition ffprobe.c:1596
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Definition dict.c:86
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition frame.c:659
@ AV_FRAME_DATA_VIDEO_ENC_PARAMS
Encoding parameters for a video frame, as described by AVVideoEncParams.
Definition frame.h:170
#define b
Definition input.c:43
#define FF_ARRAY_ELEMS(a)
int64_t frame_num
Frame counter, set by libavcodec.
Definition avcodec.h:1883
Structure to hold side data for an AVFrame.
Definition frame.h:327
uint8_t * data
Definition frame.h:329
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
Data structure for storing block-level encoding information.
Video encoding parameters for a given frame.
int32_t delta_qp[4][2]
Quantisation parameter offset from the base (per-frame) qp for a given plane (first index) and AC/DC ...
enum AVVideoEncParamsType type
Type of the parameters (the codec they are used with).
unsigned int nb_blocks
Number of blocks in the array.
int32_t qp
Base quantisation parameter for the frame.
AVDictionary * decoder_opts
int(* process_frame)(struct DecodeContext *dc, AVFrame *frame)
AVCodecContext * decoder
static void finish(void)
Definition movenc.c:374
static int process_frame(DecodeContext *dc, AVFrame *frame)
static av_always_inline AVVideoBlockParams * av_video_enc_params_block(AVVideoEncParams *par, unsigned int idx)
Get the block at the specified idx.