Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
b056439233 | |||
b1cfb09982 | |||
86903c93aa |
32
avs2bdnxml.c
32
avs2bdnxml.c
@ -160,6 +160,7 @@
|
||||
#include "sup.h"
|
||||
#include "ass.h"
|
||||
#include "abstract_lists.h"
|
||||
#include <emmintrin.h> // 包含SSE指令集的头文件
|
||||
|
||||
/* AVIS input code taken from muxers.c from the x264 project (GPLv2 or later).
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
@ -545,10 +546,33 @@ int detect_sse2 ()
|
||||
|
||||
int is_identical (stream_info_t *s_info, char *img, char *img_old)
|
||||
{
|
||||
if (detect_sse2())
|
||||
return asm_is_identical_sse2(s_info, img, img_old);
|
||||
else
|
||||
return is_identical_c(s_info, img, img_old);
|
||||
|
||||
// 按128位加载两个图像数据
|
||||
__m128i* ptr1 = (__m128i*)img;
|
||||
__m128i* ptr2 = (__m128i*)img_old;
|
||||
|
||||
// 计算比较的次数(以128位为单位)
|
||||
int num_iterations = size / 16;
|
||||
|
||||
// 逐一比较图像数据,使用SSE指令进行并行比较
|
||||
for (int i = 0; i < num_iterations; ++i) {
|
||||
__m128i xmm1 = _mm_load_si128(ptr1 + i); // 加载128位数据
|
||||
__m128i xmm2 = _mm_load_si128(ptr2 + i); // 加载128位数据
|
||||
|
||||
// 比较两个128位数据是否相等
|
||||
__m128i cmp_result = _mm_cmpeq_epi8(xmm1, xmm2);
|
||||
|
||||
// 判断比较结果是否全为1
|
||||
int result_mask = _mm_movemask_epi8(cmp_result);
|
||||
|
||||
// 如果存在不相等的元素,返回0
|
||||
if (result_mask != 0xFFFF) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果所有元素都相等,返回1
|
||||
return 1;
|
||||
}
|
||||
|
||||
int is_empty (stream_info_t *s_info, char *img)
|
||||
|
Loading…
Reference in New Issue
Block a user