diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2017-04-29 16:07:06 +0200 | 
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-04-29 16:07:06 +0200 | 
| commit | 2afbfb1e417914565edb1c7ed14cc1ebf278672d (patch) | |
| tree | 006c43dec92af74323bbd409288094aaf503dc35 | |
| parent | d1ce180fee7b660f989e22e8b91a2cf0f53ded6a (diff) | |
cv, pose-widget: don't premultiply alpha
It doesn't improve perf.
| -rw-r--r-- | cv/video-widget.cpp | 2 | ||||
| -rw-r--r-- | pose-widget/pose-widget.cpp | 18 | 
2 files changed, 8 insertions, 12 deletions
diff --git a/cv/video-widget.cpp b/cv/video-widget.cpp index f4c16776..7d504f3a 100644 --- a/cv/video-widget.cpp +++ b/cv/video-widget.cpp @@ -54,7 +54,7 @@ void cv_video_widget::update_image(const cv::Mat& frame)          const cv::Mat& img = *img_; -        texture = QImage((const unsigned char*) img.data, w, h, QImage::Format_ARGB32_Premultiplied); +        texture = QImage((const unsigned char*) img.data, w, h, QImage::Format_ARGB32);      }  } diff --git a/pose-widget/pose-widget.cpp b/pose-widget/pose-widget.cpp index aee2d628..4be3f09f 100644 --- a/pose-widget/pose-widget.cpp +++ b/pose-widget/pose-widget.cpp @@ -20,8 +20,8 @@ using namespace pose_widget_impl;  pose_transform::pose_transform(QWidget* dst) :      dst(dst), -    image(w, h, QImage::Format_ARGB32_Premultiplied), -    image2(w, h, QImage::Format_ARGB32_Premultiplied), +    image(w, h, QImage::Format_ARGB32), +    image2(w, h, QImage::Format_ARGB32),      width(w), height(h),      fresh(false)  { @@ -303,11 +303,6 @@ void pose_transform::project_quad_texture()                  using uc = unsigned char; -                const float ax_ = fx - unsigned(fx); -                const float ay_ = fy - unsigned(fy); -                const float ax = 1 - ax_; -                const float ay = 1 - ay_; -                  const unsigned px_ = fx + 1;                  const unsigned py_ = fy + 1;                  const unsigned px = fx; @@ -324,6 +319,11 @@ void pose_transform::project_quad_texture()                  // 0, 0 -- ax, ay                  //const uc alpha = (a1 * ax + a3 * ax_) * ay + (a4 * ax + a2 * ax_) * ay_; +                const float ax_ = fx - unsigned(fx); +                const float ay_ = fy - unsigned(fy); +                const float ax = 1 - ax_; +                const float ay = 1 - ay_; +                  const unsigned pos = y * dest_pitch + x * dest_depth;                  for (int k = 0; k < 4; k++) @@ -335,10 +335,6 @@ void pose_transform::project_quad_texture()                      dest[pos + k] = uc((i * ax + i__ * ax_) * ay + (i___ * ax + i_ * ax_) * ay_);                  } - -                // premultiply alpha -                for (int k = 0; k < 3; k++) -                    dest[pos + k] = (dest[pos+k]*num(dest[pos + 3]))/255;              }          }  | 
