mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
Accept negative values to mirror
BUG=220 TEST=out\Debug\convert.exe faces_1280x720_ARGB.raw -s 1280 -720 faces_640x360_P420.yuv Review URL: https://webrtc-codereview.appspot.com/1376004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@681 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
e25f991327
commit
95c29d53f2
@ -1,6 +1,6 @@
|
|||||||
Name: libyuv
|
Name: libyuv
|
||||||
URL: http://code.google.com/p/libyuv/
|
URL: http://code.google.com/p/libyuv/
|
||||||
Version: 680
|
Version: 681
|
||||||
License: BSD
|
License: BSD
|
||||||
License File: LICENSE
|
License File: LICENSE
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,6 @@
|
|||||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||||
#define INCLUDE_LIBYUV_VERSION_H_
|
#define INCLUDE_LIBYUV_VERSION_H_
|
||||||
|
|
||||||
#define LIBYUV_VERSION 680
|
#define LIBYUV_VERSION 681
|
||||||
|
|
||||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||||
|
|||||||
@ -34,6 +34,10 @@ int num_skip_org = 0; // Number of frames to skip in original.
|
|||||||
int num_frames = 0; // Number of frames to convert.
|
int num_frames = 0; // Number of frames to convert.
|
||||||
int filter = 1; // Bilinear filter for scaling.
|
int filter = 1; // Bilinear filter for scaling.
|
||||||
|
|
||||||
|
static __inline uint32 Abs(int32 v) {
|
||||||
|
return v >= 0 ? v : -v;
|
||||||
|
}
|
||||||
|
|
||||||
// Parse PYUV format. ie name.1920x800_24Hz_P420.yuv
|
// Parse PYUV format. ie name.1920x800_24Hz_P420.yuv
|
||||||
bool ExtractResolutionFromFilename(const char* name,
|
bool ExtractResolutionFromFilename(const char* name,
|
||||||
int* width_ptr,
|
int* width_ptr,
|
||||||
@ -57,7 +61,8 @@ void PrintHelp(const char * program) {
|
|||||||
printf(" -s <width> <height> .... specify source resolution. "
|
printf(" -s <width> <height> .... specify source resolution. "
|
||||||
"Optional if name contains\n"
|
"Optional if name contains\n"
|
||||||
" resolution (ie. "
|
" resolution (ie. "
|
||||||
"name.1920x800_24Hz_P420.yuv)\n");
|
"name.1920x800_24Hz_P420.yuv)\n"
|
||||||
|
" Negative value mirrors.\n");
|
||||||
printf(" -d <width> <height> .... specify destination resolution.\n");
|
printf(" -d <width> <height> .... specify destination resolution.\n");
|
||||||
printf(" -f <filter> ............ 0 = point, 1 = bilinear (default).\n");
|
printf(" -f <filter> ............ 0 = point, 1 = bilinear (default).\n");
|
||||||
printf(" -skip <src_argb> ....... Number of frame to skip of src_argb\n");
|
printf(" -skip <src_argb> ....... Number of frame to skip of src_argb\n");
|
||||||
@ -118,7 +123,7 @@ void ParseOptions(int argc, const char* argv[]) {
|
|||||||
bool rec_res_avail = ExtractResolutionFromFilename(argv[fileindex_rec],
|
bool rec_res_avail = ExtractResolutionFromFilename(argv[fileindex_rec],
|
||||||
&rec_width,
|
&rec_width,
|
||||||
&rec_height);
|
&rec_height);
|
||||||
if (image_width <= 0 || image_height <= 0) {
|
if (image_width == 0 || image_height == 0) {
|
||||||
if (org_res_avail) {
|
if (org_res_avail) {
|
||||||
image_width = org_width;
|
image_width = org_width;
|
||||||
image_height = org_height;
|
image_height = org_height;
|
||||||
@ -130,13 +135,13 @@ void ParseOptions(int argc, const char* argv[]) {
|
|||||||
PrintHelp(argv[0]);
|
PrintHelp(argv[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dst_width <= 0 || dst_height <= 0) {
|
if (dst_width == 0 || dst_height == 0) {
|
||||||
if (rec_res_avail) {
|
if (rec_res_avail) {
|
||||||
dst_width = rec_width;
|
dst_width = rec_width;
|
||||||
dst_height = rec_height;
|
dst_height = rec_height;
|
||||||
} else {
|
} else {
|
||||||
dst_width = image_width;
|
dst_width = Abs(image_width);
|
||||||
dst_height = image_height;
|
dst_height = Abs(image_height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,7 +172,7 @@ int main(int argc, const char* argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const int org_size = image_width * image_height * 4; // ARGB
|
const int org_size = Abs(image_width) * Abs(image_height) * 4; // ARGB
|
||||||
const int dst_size = dst_width * dst_height * 4; // ARGB scaled
|
const int dst_size = dst_width * dst_height * 4; // ARGB scaled
|
||||||
const int y_size = dst_width * dst_height;
|
const int y_size = dst_width * dst_height;
|
||||||
const int uv_size = (dst_width + 1) / 2 * (dst_height + 1) / 2;
|
const int uv_size = (dst_width + 1) / 2 * (dst_height + 1) / 2;
|
||||||
@ -212,7 +217,7 @@ int main(int argc, const char* argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
for (int cur_rec = 0; cur_rec < num_rec; ++cur_rec) {
|
for (int cur_rec = 0; cur_rec < num_rec; ++cur_rec) {
|
||||||
libyuv::ARGBScale(ch_org, image_width * 4,
|
libyuv::ARGBScale(ch_org, Abs(image_width) * 4,
|
||||||
image_width, image_height,
|
image_width, image_height,
|
||||||
ch_dst, dst_width * 4,
|
ch_dst, dst_width * 4,
|
||||||
dst_width, dst_height,
|
dst_width, dst_height,
|
||||||
|
|||||||
@ -172,7 +172,7 @@ void ParseOptions(int argc, const char* argv[]) {
|
|||||||
fprintf(stderr, "Number of frames incorrect\n");
|
fprintf(stderr, "Number of frames incorrect\n");
|
||||||
PrintHelp(argv[0]);
|
PrintHelp(argv[0]);
|
||||||
}
|
}
|
||||||
if (image_width <= 0 || image_height <= 0) {
|
if (image_width == 0 || image_height == 0) {
|
||||||
int org_width, org_height;
|
int org_width, org_height;
|
||||||
int rec_width, rec_height;
|
int rec_width, rec_height;
|
||||||
bool org_res_avail = ExtractResolutionFromFilename(argv[fileindex_org],
|
bool org_res_avail = ExtractResolutionFromFilename(argv[fileindex_org],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user