Skip to content

Commit

Permalink
bgr
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Nov 4, 2023
1 parent 151b7c9 commit d95613e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions highgui/src/jpeg_encoder_rk_mpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,9 @@ class jpeg_encoder_rk_mpp_impl

int init(int width, int height, int quality);

int encode(const unsigned char* rgbdata, std::vector<unsigned char>& outdata) const;
int encode(const unsigned char* bgrdata, std::vector<unsigned char>& outdata) const;

int encode(const unsigned char* rgbdata, const char* outfilepath) const;
int encode(const unsigned char* bgrdata, const char* outfilepath) const;

int deinit();

Expand Down Expand Up @@ -571,7 +571,7 @@ static inline void my_memcpy(unsigned char* dst, const unsigned char* src, int s
#endif
}

int jpeg_encoder_rk_mpp_impl::encode(const unsigned char* rgbdata, std::vector<unsigned char>& outdata) const
int jpeg_encoder_rk_mpp_impl::encode(const unsigned char* bgrdata, std::vector<unsigned char>& outdata) const
{
outdata.clear();

Expand All @@ -595,7 +595,7 @@ int jpeg_encoder_rk_mpp_impl::encode(const unsigned char* rgbdata, std::vector<u

for (int i = 0; i < height; i++)
{
my_memcpy((unsigned char*)mapped_ptr + i * hor_stride, rgbdata + i * width * 3, width * 3);
my_memcpy((unsigned char*)mapped_ptr + i * hor_stride, bgrdata + i * width * 3, width * 3);
}
}

Expand Down Expand Up @@ -679,7 +679,7 @@ int jpeg_encoder_rk_mpp_impl::encode(const unsigned char* rgbdata, std::vector<u
return ret_val;
}

int jpeg_encoder_rk_mpp_impl::encode(const unsigned char* rgbdata, const char* outfilepath) const
int jpeg_encoder_rk_mpp_impl::encode(const unsigned char* bgrdata, const char* outfilepath) const
{
if (!inited)
{
Expand All @@ -703,7 +703,7 @@ int jpeg_encoder_rk_mpp_impl::encode(const unsigned char* rgbdata, const char* o

for (int i = 0; i < height; i++)
{
my_memcpy((unsigned char*)mapped_ptr + i * hor_stride, rgbdata + i * width * 3, width * 3);
my_memcpy((unsigned char*)mapped_ptr + i * hor_stride, bgrdata + i * width * 3, width * 3);
}
}

Expand Down Expand Up @@ -902,14 +902,14 @@ int jpeg_encoder_rk_mpp::init(int width, int height, int quality)
return d->init(width, height, quality);
}

int jpeg_encoder_rk_mpp::encode(const unsigned char* rgbdata, std::vector<unsigned char>& outdata) const
int jpeg_encoder_rk_mpp::encode(const unsigned char* bgrdata, std::vector<unsigned char>& outdata) const
{
return d->encode(rgbdata, outdata);
return d->encode(bgrdata, outdata);
}

int jpeg_encoder_rk_mpp::encode(const unsigned char* rgbdata, const char* outfilepath) const
int jpeg_encoder_rk_mpp::encode(const unsigned char* bgrdata, const char* outfilepath) const
{
return d->encode(rgbdata, outfilepath);
return d->encode(bgrdata, outfilepath);
}

int jpeg_encoder_rk_mpp::deinit()
Expand Down
4 changes: 2 additions & 2 deletions highgui/src/jpeg_encoder_rk_mpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class jpeg_encoder_rk_mpp

int init(int width, int height, int quality);

int encode(const unsigned char* rgbdata, std::vector<unsigned char>& outdata) const;
int encode(const unsigned char* bgrdata, std::vector<unsigned char>& outdata) const;

int encode(const unsigned char* rgbdata, const char* outfilepath) const;
int encode(const unsigned char* bgrdata, const char* outfilepath) const;

int deinit();

Expand Down

0 comments on commit d95613e

Please sign in to comment.