Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(480105)

Unified Diff: examples/analyzer.cc

Issue 1398: Forward and backward data analyzer
Patch Set: Created 2 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/analyzer.cc
diff --git a/examples/analyzer.cc b/examples/analyzer.cc
index cf3ad7a975c857c25f7e048732fc1d534aa3d0ac..a62efa79d17385182dc44b4ccbdf36c7badafc15 100644
--- a/examples/analyzer.cc
+++ b/examples/analyzer.cc
@@ -440,6 +440,7 @@ private:
int bstride;
bool show_blocks;
bool show_motion;
+ bool show_forward;
unsigned int *flags;
unsigned int flags_len;
@@ -506,6 +507,7 @@ public:
void setShowBits(bool show_bits);
void setShowDering(bool show_dering);
void setShowPlane(bool show_plane, int mask);
+ void setShowForward(bool show_forward);
bool hasPadding();
@@ -556,7 +558,8 @@ public:
enum {
wxID_SHOW_BLOCKS = 6000,
- wxID_SHOW_MOTION,
+ wxID_SHOW_FORWARD,
+ wxID_SHOW_BACKWARD,
wxID_SHOW_SKIP,
wxID_SHOW_NOREF,
wxID_SHOW_PADDING,
@@ -581,7 +584,8 @@ BEGIN_EVENT_TABLE(TestFrame, wxFrame)
EVT_MENU(wxID_ZOOM_OUT, TestFrame::onZoomOut)
EVT_MENU(wxID_ACTUAL_SIZE, TestFrame::onActualSize)
EVT_MENU(wxID_SHOW_BLOCKS, TestFrame::onToggleBlocks)
- EVT_MENU(wxID_SHOW_MOTION, TestFrame::onToggleBlocks)
+ EVT_MENU(wxID_SHOW_FORWARD, TestFrame::onToggleBlocks)
+ EVT_MENU(wxID_SHOW_BACKWARD, TestFrame::onToggleBlocks)
EVT_MENU(wxID_SHOW_SKIP, TestFrame::onResetAndToggleViewMenuCheckBox)
EVT_MENU(wxID_SHOW_NOREF, TestFrame::onResetAndToggleViewMenuCheckBox)
EVT_MENU(wxID_SHOW_PADDING, TestFrame::onToggleViewMenuCheckBox)
@@ -784,8 +788,16 @@ void TestPanel::render() {
int x = sbx << OD_LOG_MVBSIZE_MIN;
if(x < getDecodeWidth() && y < getDecodeHeight()) {
od_mv_grid_pt cur = mv[sby * (dd.getNHMVBS()+1) + sbx];
- int mv_x = cur.mv[0] >> OD_LOG_MVBSIZE_MIN;
- int mv_y = cur.mv[1] >> OD_LOG_MVBSIZE_MIN;
+ int mv_x;
+ int mv_y;
+ if (show_forward) {
+ mv_x = cur.mv[0] >> OD_LOG_MVBSIZE_MIN;
+ mv_y = cur.mv[1] >> OD_LOG_MVBSIZE_MIN;
+ }
+ else {
+ mv_x = cur.mv1[0] >> OD_LOG_MVBSIZE_MIN;
+ mv_y = cur.mv1[1] >> OD_LOG_MVBSIZE_MIN;
+ }
int xx = x + mv_x;
int yy = y + mv_y;
if(xx < 0) {
@@ -1055,6 +1067,10 @@ void TestPanel::setShowPlane(bool show_plane, int mask) {
}
}
+void TestPanel::setShowForward(bool show_forward) {
+ this->show_forward = show_forward;
+}
+
bool TestPanel::hasPadding() {
return dd.getFrameWidth() > dd.getWidth() ||
dd.getFrameHeight() > dd.getHeight();
@@ -1391,9 +1407,15 @@ TestFrame::TestFrame(const bool bit_accounting) : wxFrame(NULL, wxID_ANY,
viewMenu->Append(wxID_ACTUAL_SIZE, _("Actual size\tCtrl-0"),
_("Actual size of the frame"));
viewMenu->AppendSeparator();
- viewMenu->AppendCheckItem(wxID_SHOW_MOTION,
- _("&MC Blocks\tCtrl-M"),
+
+ wxMenu *motionMenu = new wxMenu();
+ motionMenu->AppendCheckItem(wxID_SHOW_FORWARD, _("Forward Prediction\tCtrl-F"),
+ _("&Show Forward Prediction"));
+ motionMenu->AppendCheckItem(wxID_SHOW_BACKWARD, _("Backward Prediction\tCtrl-M"),
+ _("&Show Backward Prediction"));
+ viewMenu->AppendSubMenu(motionMenu, _("&MC Blocks\tCtrl-M"),
_("Show motion-compensation block sizes"));
+
viewMenu->AppendCheckItem(wxID_SHOW_BLOCKS, _("&Transform Blocks\tCtrl-B"),
_("Show transform block sizes"));
viewMenu->AppendSeparator();
@@ -1497,8 +1519,10 @@ bool TestFrame::setZoom(int zoom) {
void TestFrame::onToggleBlocks(wxCommandEvent &event) {
GetMenuBar()->Check(wxID_SHOW_BLOCKS, false);
- GetMenuBar()->Check(wxID_SHOW_MOTION, false);
+ GetMenuBar()->Check(wxID_SHOW_FORWARD, false);
+ GetMenuBar()->Check(wxID_SHOW_BACKWARD, false);
onToggleViewMenuCheckBox(event);
+ panel->setShowForward(event.GetId() == wxID_SHOW_FORWARD);
}
void TestFrame::onToggleViewMenuCheckBox(wxCommandEvent &event) {
@@ -1524,7 +1548,8 @@ void TestFrame::onResetAndToggleViewMenuCheckBox(wxCommandEvent &event) {
void TestFrame::updateViewMenu() {
panel->setShowBlocks(GetMenuBar()->IsChecked(wxID_SHOW_BLOCKS));
- panel->setShowMotion(GetMenuBar()->IsChecked(wxID_SHOW_MOTION));
+ panel->setShowMotion(GetMenuBar()->IsChecked(wxID_SHOW_FORWARD)
+ || GetMenuBar()->IsChecked(wxID_SHOW_BACKWARD));
panel->setShowSkip(GetMenuBar()->IsChecked(wxID_SHOW_SKIP));
panel->setShowNoRef(GetMenuBar()->IsChecked(wxID_SHOW_NOREF));
panel->setShowPadding(GetMenuBar()->IsChecked(wxID_SHOW_PADDING));
@@ -1542,7 +1567,8 @@ void TestFrame::onViewReset(wxCommandEvent &WXUNUSED(event)) {
GetMenuBar()->Check(wxID_SHOW_BITS, false);
GetMenuBar()->Check(wxID_SHOW_DERING, false);
GetMenuBar()->Check(wxID_SHOW_BLOCKS, false);
- GetMenuBar()->Check(wxID_SHOW_MOTION, false);
+ GetMenuBar()->Check(wxID_SHOW_FORWARD, false);
+ GetMenuBar()->Check(wxID_SHOW_BACKWARD, false);
GetMenuBar()->Check(wxID_SHOW_PADDING, false);
GetMenuBar()->Check(wxID_SHOW_NOREF, false);
GetMenuBar()->Check(wxID_SHOW_SKIP, false);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld