SDWebImage / SDWebImage/SDWebImageWebPCoder
Skipping frames for Animated WebP
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Objective-C
- Star
- 277
- Fork
- 101
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
It would be good to have an option to skip frames for animated webP.
If I have a thumbnail trying to render an animated wepb image with 120 frames it could be good to render only 30 frames, to preserve speed and memory.
Maybe not the first 30 frames but skipping frames in a loop: the animation will not be very smooth obviously.
A simple, not nice looking solution to skip half of the frames:
SDImageWebPCoder.m
line 264
Adding a skipper in the loop and duplicating the duration
int skipper = 0;
do {
skipper++;
if ((skipper %2) == 0) {
continue;
}
@autoreleasepool {
CGImageRef imageRef = [self sd_drawnWebpImageWithCanvas:canvas iterator:iter colorSpace:colorSpace scaledSize:scaledSize];
if (!imageRef) {
continue;
}
#if SD_UIKIT || SD_WATCH
UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:UIImageOrientationUp];
#else
UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:kCGImagePropertyOrientationUp];
#endif
CGImageRelease(imageRef);
NSTimeInterval duration = [self sd_frameDurationWithIterator:iter];
SDImageFrame *frame = [SDImageFrame frameWithImage:image duration:(duration*2)];
[frames addObject:frame];
}
} while (WebPDemuxNextFrame(&iter));
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu trong SDImageWebPCoder.m, khoảng dòng 264, nơi các frame WebP động được giải mã và thời lượng được thu thập. Xác định cách một tùy chọn bỏ qua frame theo cơ chế opt-in nên được cung cấp và duy trì trên các nền tảng Apple được hỗ trợ, sau đó kiểm tra số lượng frame thu được và thời gian của hoạt ảnh bằng một fixture WebP động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- objective-c
- Lĩnh vực
- mobile-dev
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100