I444ToI420 and I422ToI420 check U and V pointers and return -1 if NULL.

- Add detect linux kernel version number in util/cpuid

adbrun -- blaze-bin/third_party/libyuv/cpuid
Kernel Version 4.14
Cpu Flags 0x7
Has ARM 0x2

Bug: libyuv:970
Change-Id: I655ed598db3655ca8448be08f1d71fbc328ced66
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5207990
Reviewed-by: Mirko Bonadei <mbonadei@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
Frank Barchard 2024-01-18 13:37:29 -08:00 committed by libyuv LUCI CQ
parent af6ac8265b
commit 5625f42424
4 changed files with 34 additions and 3 deletions

View File

@ -1,6 +1,6 @@
Name: libyuv
URL: https://chromium.googlesource.com/libyuv/libyuv/
Version: 1883
Version: 1884
License: BSD
License File: LICENSE
Shipped: yes

View File

@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1883
#define LIBYUV_VERSION 1884
#endif // INCLUDE_LIBYUV_VERSION_H_

View File

@ -55,7 +55,9 @@ static int I4xxToI420(const uint8_t* src_y,
const int dst_uv_width = SUBSAMPLE(dst_y_width, 1, 1);
const int dst_uv_height = SUBSAMPLE(dst_y_height, 1, 1);
int r;
if (src_uv_width <= 0 || src_uv_height == 0) {
if ((!src_y && dst_y) || !src_u || !src_v || !dst_u || !dst_v ||
src_y_width <= 0 || src_y_height == 0 || src_uv_width <= 0 ||
src_uv_height == 0) {
return -1;
}
if (dst_y) {

View File

@ -12,12 +12,34 @@
#include <stdlib.h>
#include <string.h>
#ifdef __linux__
#include <ctype.h>
#include <sys/utsname.h>
#endif
#include "libyuv/cpu_id.h"
#ifdef __cplusplus
using namespace libyuv;
#endif
#ifdef __linux__
static void KernelVersion(int *version) {
struct utsname buffer;
int i = 0;
version[0] = version[1] = 0;
if (uname(&buffer) == 0) {
char *v = buffer.release;
for (i = 0; *v && i < 2; ++v) {
if (isdigit(*v)) {
version[i++] = (int) strtol(v, &v, 10);
}
}
}
}
#endif
int main(int argc, const char* argv[]) {
int cpu_flags = TestCpuFlag(-1);
int has_arm = TestCpuFlag(kCpuHasARM);
@ -28,6 +50,13 @@ int main(int argc, const char* argv[]) {
(void)argc;
(void)argv;
#ifdef __linux__
{
int kernelversion[2];
KernelVersion(kernelversion);
printf("Kernel Version %d.%d\n", kernelversion[0], kernelversion[1]);
}
#endif
#if defined(__i386__) || defined(__x86_64__) || \
defined(_M_IX86) || defined(_M_X64)
if (has_x86) {