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

Delta Between Two Patch Sets: examples/analyzer.cc

Issue 1382: Motion Vector overlay in the Analyzer
Left Patch Set: Created 2 years, 6 months ago
Right Patch Set: Motion Vector overlay in the Analyzer Created 2 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /*Daala video codec 1 /*Daala video codec
2 Copyright (c) 2002-2015 Daala project contributors. All rights reserved. 2 Copyright (c) 2002-2015 Daala project contributors. All rights reserved.
3 3
4 Redistribution and use in source and binary forms, with or without 4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are met: 5 modification, are permitted provided that the following conditions are met:
6 6
7 - Redistributions of source code must retain the above copyright notice, this 7 - Redistributions of source code must retain the above copyright notice, this
8 list of conditions and the following disclaimer. 8 list of conditions and the following disclaimer.
9 9
10 - Redistributions in binary form must reproduce the above copyright notice, 10 - Redistributions in binary form must reproduce the above copyright notice,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 int mv1[2]; 106 int mv1[2];
107 /*Whether or not this MV actually has a valid value.*/ 107 /*Whether or not this MV actually has a valid value.*/
108 unsigned valid:1; 108 unsigned valid:1;
109 /*The ref image that this MV points into.*/ 109 /*The ref image that this MV points into.*/
110 /*For P frame, 0:golden frame, 1:previous frame. */ 110 /*For P frame, 0:golden frame, 1:previous frame. */
111 /*For B frame, 1:previous frame, 2:next frame, 3:both frames.*/ 111 /*For B frame, 1:previous frame, 2:next frame, 3:both frames.*/
112 unsigned ref:3; 112 unsigned ref:3;
113 }; 113 };
114 114
115 void od_img_draw_line(const int x, const int y, 115 void od_img_draw_line(const int x, const int y,
116 unsigned char *channel, const int channel_stride) 116 unsigned char *channel, const int channel_stride) {
117 {
negge 2016/06/24 15:02:59 Open bracket on previous line.
luc.trudeau 2016/07/01 19:45:03 Done.
118 int p0[2]; 117 int p0[2];
119 int p1[2]; 118 int p1[2];
120 int dx[2]; 119 int dx[2];
121 int step[2]; 120 int step[2];
122 int steep; 121 int steep;
123 int err; 122 int err;
124 int derr; 123 int derr;
125 124
126 steep = abs(y) > abs(x); 125 steep = abs(y) > abs(x);
127 p0[0] = 0; 126 p0[0] = 0;
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 int y = sby << OD_LOG_MVBSIZE_MIN; 782 int y = sby << OD_LOG_MVBSIZE_MIN;
784 for (int sbx = 0; sbx < dd.getNHMVBS() + 1; sbx++) { 783 for (int sbx = 0; sbx < dd.getNHMVBS() + 1; sbx++) {
785 int x = sbx << OD_LOG_MVBSIZE_MIN; 784 int x = sbx << OD_LOG_MVBSIZE_MIN;
786 if(x < getDecodeWidth() && y < getDecodeHeight()) { 785 if(x < getDecodeWidth() && y < getDecodeHeight()) {
787 od_mv_grid_pt cur = mv[sby * (dd.getNHMVBS()+1) + sbx]; 786 od_mv_grid_pt cur = mv[sby * (dd.getNHMVBS()+1) + sbx];
788 int mv_x = cur.mv[0] >> OD_LOG_MVBSIZE_MIN; 787 int mv_x = cur.mv[0] >> OD_LOG_MVBSIZE_MIN;
789 int mv_y = cur.mv[1] >> OD_LOG_MVBSIZE_MIN; 788 int mv_y = cur.mv[1] >> OD_LOG_MVBSIZE_MIN;
790 int xx = x + mv_x; 789 int xx = x + mv_x;
791 int yy = y + mv_y; 790 int yy = y + mv_y;
792 if(xx < 0) { 791 if(xx < 0) {
793 » mv_x += xx; 792 mv_x += xx;
negge 2016/06/24 15:02:59 Tab on this line.
luc.trudeau 2016/07/01 19:45:03 Done.
794 } 793 }
795 else if(xx > getDecodeWidth()) { 794 else if(xx > getDecodeWidth()) {
796 mv_x += getDecodeWidth() - xx; 795 mv_x += getDecodeWidth() - xx;
797 } 796 }
798 if(yy < 0) { 797 if(yy < 0) {
799 mv_y += yy; 798 mv_y += yy;
800 } 799 }
801 else if(yy > getDecodeHeight()) { 800 else if(yy > getDecodeHeight()) {
802 mv_y += getDecodeHeight() - yy; 801 mv_y += getDecodeHeight() - yy;
803 } 802 }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 } 1065 }
1067 1066
1068 void TestPanel::computeBitsPerPixel() { 1067 void TestPanel::computeBitsPerPixel() {
1069 int i, j; 1068 int i, j;
1070 double bpp_total; 1069 double bpp_total;
1071 double bits_total; 1070 double bits_total;
1072 double bits_filtered; 1071 double bits_filtered;
1073 static double last_bits_total; 1072 static double last_bits_total;
1074 static double last_bits_filtered; 1073 static double last_bits_filtered;
1075 int totals_q3[MAX_SYMBOL_TYPES] = {0}; 1074 int totals_q3[MAX_SYMBOL_TYPES] = {0};
1075 int sym_count[MAX_SYMBOL_TYPES] = {0};
1076 for (j = 0; j < dd.getFrameHeight(); j++) { 1076 for (j = 0; j < dd.getFrameHeight(); j++) {
1077 for (i = 0; i < dd.getFrameWidth(); i++) { 1077 for (i = 0; i < dd.getFrameWidth(); i++) {
1078 bpp_q3[j*dd.getFrameWidth() + i] = 0; 1078 bpp_q3[j*dd.getFrameWidth() + i] = 0;
1079 } 1079 }
1080 } 1080 }
1081 if (show_bits_filter.length()) { 1081 if (show_bits_filter.length()) {
1082 fprintf(stderr, "Filtering: %s\n", 1082 fprintf(stderr, "Filtering: %s\n",
1083 (const char*)show_bits_filter.mb_str()); 1083 (const char*)show_bits_filter.mb_str());
1084 } 1084 }
1085 bpp_total = 0; 1085 bpp_total = 0;
(...skipping 13 matching lines...) Expand all
1099 if (key.Find(token) >= 0) { 1099 if (key.Find(token) >= 0) {
1100 filter = true; 1100 filter = true;
1101 } 1101 }
1102 } 1102 }
1103 if (!filter) { 1103 if (!filter) {
1104 continue; 1104 continue;
1105 } 1105 }
1106 } 1106 }
1107 bits_filtered += s->bits_q3; 1107 bits_filtered += s->bits_q3;
1108 totals_q3[s->id] += s->bits_q3; 1108 totals_q3[s->id] += s->bits_q3;
1109 sym_count[s->id]++;
1109 switch (s->layer) { 1110 switch (s->layer) {
1110 case 0: 1111 case 0:
1111 case 1: 1112 case 1:
1112 case 2: 1113 case 2:
1113 case 3: { 1114 case 3: {
1114 int n, u, v; 1115 int n, u, v;
1115 double bpp; 1116 double bpp;
1116 n = 1 << (s->level + 2); 1117 n = 1 << (s->level + 2);
1117 bpp = ((double)s->bits_q3)/(n*n); 1118 bpp = ((double)s->bits_q3)/(n*n);
1118 for (v = 0; v < n; v++) { 1119 for (v = 0; v < n; v++) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 /* Find max total. */ 1197 /* Find max total. */
1197 for (i = 0; i < acct->dict.nb_str; i++) { 1198 for (i = 0; i < acct->dict.nb_str; i++) {
1198 if (totals_q3[i] > totals_q3[j]) { 1199 if (totals_q3[i] > totals_q3[j]) {
1199 j = i; 1200 j = i;
1200 } 1201 }
1201 } 1202 }
1202 if (bits_total) { 1203 if (bits_total) {
1203 for (i = 0; i < acct->dict.nb_str; i++) { 1204 for (i = 0; i < acct->dict.nb_str; i++) {
1204 if (totals_q3[i]) { 1205 if (totals_q3[i]) {
1205 if (i == j) fprintf(stderr, "\033[1;31m"); 1206 if (i == j) fprintf(stderr, "\033[1;31m");
1206 fprintf(stderr, "%20s = %10.3f %5.2f %% %5.2f %%\n", 1207 fprintf(stderr, "%20s = %10.3f %5.2f %% %5.2f %% (%f bit/symbol)\n",
1207 acct->dict.str[i], (float)totals_q3[i]/8, 1208 acct->dict.str[i], (float)totals_q3[i]/8,
1208 (float)totals_q3[i]/bits_total*100, 1209 (float)totals_q3[i]/bits_total*100,
1209 (float)totals_q3[i]/bits_filtered*100); 1210 (float)totals_q3[i]/bits_filtered*100, (float)totals_q3[i]/8/sym_coun t[i]);
1210 if (i == j) fprintf(stderr, "\033[0m"); 1211 if (i == j) fprintf(stderr, "\033[0m");
1211 } 1212 }
1212 } 1213 }
1213 fprintf(stderr, "%20s = %10.3f\n", 1214 fprintf(stderr, "%20s = %10.3f\n",
1214 "bits_total", (float)bits_total/8); 1215 "bits_total", (float)bits_total/8);
1215 fprintf(stderr, "%20s = %10.3f %6.2f %% delta: %+.3f\n", "bits_filtered", 1216 fprintf(stderr, "%20s = %10.3f %6.2f %% delta: %+.3f\n", "bits_filtered",
1216 bits_filtered/8, bits_filtered/bits_total*100, (bits_filtered - 1217 bits_filtered/8, bits_filtered/bits_total*100, (bits_filtered -
1217 last_bits_filtered)/8); 1218 last_bits_filtered)/8);
1218 fprintf(stderr, "%20s = %10.3i\n", "nb_syms", acct->nb_syms); 1219 fprintf(stderr, "%20s = %10.3i\n", "nb_syms", acct->nb_syms);
1219 fprintf(stderr, "%20s = %10.3f\n", "bpp_total", (float)bpp_total/8); 1220 fprintf(stderr, "%20s = %10.3f\n", "bpp_total", (float)bpp_total/8);
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 bool TestApp::OnCmdLineParsed(wxCmdLineParser &parser) { 1629 bool TestApp::OnCmdLineParsed(wxCmdLineParser &parser) {
1629 frame = new TestFrame(parser.Found(_(OD_BIT_ACCOUNTING_SWITCH))); 1630 frame = new TestFrame(parser.Found(_(OD_BIT_ACCOUNTING_SWITCH)));
1630 frame->Show(); 1631 frame->Show();
1631 if (parser.GetParamCount() > 0) { 1632 if (parser.GetParamCount() > 0) {
1632 return frame->open(parser.GetParam(0)); 1633 return frame->open(parser.GetParam(0));
1633 } 1634 }
1634 return true; 1635 return true;
1635 } 1636 }
1636 1637
1637 IMPLEMENT_APP(TestApp) 1638 IMPLEMENT_APP(TestApp)
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

RSS Feeds Recent Issues | This issue
This is Rietveld