Add frame inspection data to the analyzer.
Change-Id: I753b51a1ae9759086198c7433410717296f61c20
diff --git a/examples/analyzer.cc b/examples/analyzer.cc
index 3a02e32..6c2a35f 100644
--- a/examples/analyzer.cc
+++ b/examples/analyzer.cc
@@ -18,6 +18,7 @@
#include "aom/aomdx.h"
#include "av1/common/accounting.h"
#include "av1/common/onyxc_int.h"
+#include "av1/decoder/inspection.h"
#define OD_SIGNMASK(a) (-((a) < 0))
#define OD_FLIPSIGNI(a, b) (((a) + OD_SIGNMASK(b)) ^ OD_SIGNMASK(b))
@@ -39,6 +40,8 @@
const AvxVideoInfo *info;
const AvxInterface *decoder;
+ insp_frame_data frame_data;
+
aom_codec_ctx_t codec;
public:
@@ -57,8 +60,10 @@
int getWidth() const;
int getHeight() const;
- bool setAccountingEnabled(bool enable);
bool getAccountingStruct(Accounting **acct);
+ bool setInspectionCallback();
+
+ static void inspect(void *decoder, void *data);
};
AV1Decoder::AV1Decoder()
@@ -84,6 +89,8 @@
fprintf(stderr, "Failed to initialize decoder.");
return false;
}
+ ifd_init(&frame_data, info->frame_width, info->frame_height);
+ setInspectionCallback();
return true;
}
@@ -119,6 +126,19 @@
AOM_CODEC_OK;
}
+bool AV1Decoder::setInspectionCallback() {
+ aom_inspect_init ii;
+ ii.inspect_cb = AV1Decoder::inspect;
+ ii.inspect_ctx = (void *)this;
+ return aom_codec_control(&codec, AV1_SET_INSPECTION_CALLBACK, &ii) ==
+ AOM_CODEC_OK;
+}
+
+void AV1Decoder::inspect(void *pbi, void *data) {
+ AV1Decoder *decoder = (AV1Decoder *)data;
+ ifd_inspect(&decoder->frame_data, pbi);
+}
+
#define MIN_ZOOM (1)
#define MAX_ZOOM (4)