mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 10:34:05 +00:00
Remove encoderstate dependency from cli module.
Changes function print_frame_info to use a kvz_frame_info struct to get the data to be printed.
This commit is contained in:
parent
7edc1b0b1c
commit
afd0d3eee0
27
src/cli.c
27
src/cli.c
|
@ -24,7 +24,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cli.h"
|
#include "cli.h"
|
||||||
#include "encoderstate.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -356,28 +355,26 @@ void print_help(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void print_frame_info(encoder_state_t *state, double frame_psnr[3])
|
void print_frame_info(const kvz_frame_info *const info,
|
||||||
|
const double frame_psnr[3],
|
||||||
|
const uint32_t bytes)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "POC %4d QP %2d (%c-frame) %10d bits PSNR: %2.4f %2.4f %2.4f",
|
fprintf(stderr, "POC %4d QP %2d (%c-frame) %10d bits PSNR: %2.4f %2.4f %2.4f",
|
||||||
state->global->poc,
|
info->poc,
|
||||||
state->global->QP,
|
info->qp,
|
||||||
"BPI"[state->global->slicetype % 3], state->stats_bitstream_length << 3,
|
"BPI"[info->slice_type % 3],
|
||||||
|
bytes << 3,
|
||||||
frame_psnr[0], frame_psnr[1], frame_psnr[2]);
|
frame_psnr[0], frame_psnr[1], frame_psnr[2]);
|
||||||
|
|
||||||
if (state->global->slicetype != KVZ_SLICE_I) {
|
if (info->slice_type != KVZ_SLICE_I) {
|
||||||
// Print reference picture lists
|
// Print reference picture lists
|
||||||
int ref_list_len[2];
|
|
||||||
int ref_list_poc[2][16];
|
|
||||||
|
|
||||||
kvz_encoder_get_ref_lists(state, ref_list_len, ref_list_poc);
|
|
||||||
|
|
||||||
fprintf(stderr, " [L0 ");
|
fprintf(stderr, " [L0 ");
|
||||||
for (int j = ref_list_len[0] - 1; j >= 0; j--) {
|
for (int j = info->ref_list_len[0] - 1; j >= 0; j--) {
|
||||||
fprintf(stderr, "%d ", ref_list_poc[0][j]);
|
fprintf(stderr, "%d ", info->ref_list[0][j]);
|
||||||
}
|
}
|
||||||
fprintf(stderr, "] [L1 ");
|
fprintf(stderr, "] [L1 ");
|
||||||
for (int j = 0; j < ref_list_len[1]; j++) {
|
for (int j = 0; j < info->ref_list_len[1]; j++) {
|
||||||
fprintf(stderr, "%d ", ref_list_poc[1][j]);
|
fprintf(stderr, "%d ", info->ref_list[1][j]);
|
||||||
}
|
}
|
||||||
fprintf(stderr, "]");
|
fprintf(stderr, "]");
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,8 @@ void cmdline_opts_free(const kvz_api *api, cmdline_opts_t *opts);
|
||||||
|
|
||||||
void print_version(void);
|
void print_version(void);
|
||||||
void print_help(void);
|
void print_help(void);
|
||||||
void print_frame_info(encoder_state_t *state, double frame_psnr[3]);
|
void print_frame_info(const kvz_frame_info *const info,
|
||||||
|
const double frame_psnr[3],
|
||||||
|
const uint32_t bytes);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -212,7 +212,8 @@ int main(int argc, char *argv[])
|
||||||
kvz_data_chunk* chunks_out = NULL;
|
kvz_data_chunk* chunks_out = NULL;
|
||||||
kvz_picture *img_rec = NULL;
|
kvz_picture *img_rec = NULL;
|
||||||
uint32_t len_out = 0;
|
uint32_t len_out = 0;
|
||||||
if (!api->encoder_encode(enc, img_in, &chunks_out, &len_out, &img_rec, NULL)) {
|
kvz_frame_info info_out;
|
||||||
|
if (!api->encoder_encode(enc, img_in, &chunks_out, &len_out, &img_rec, &info_out)) {
|
||||||
fprintf(stderr, "Failed to encode image.\n");
|
fprintf(stderr, "Failed to encode image.\n");
|
||||||
api->picture_free(img_in);
|
api->picture_free(img_in);
|
||||||
goto exit_failure;
|
goto exit_failure;
|
||||||
|
@ -269,7 +270,7 @@ int main(int argc, char *argv[])
|
||||||
psnr_sum[1] += frame_psnr[1];
|
psnr_sum[1] += frame_psnr[1];
|
||||||
psnr_sum[2] += frame_psnr[2];
|
psnr_sum[2] += frame_psnr[2];
|
||||||
|
|
||||||
print_frame_info(state, frame_psnr);
|
print_frame_info(&info_out, frame_psnr, len_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
api->picture_free(img_in);
|
api->picture_free(img_in);
|
||||||
|
|
Loading…
Reference in a new issue