Skipping frames for Animated WebP

オープン
#61 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
objective-c
領域
mobile-dev

調査の方向性

アニメーション WebP フレームがデコードされ、再生時間が収集される SDImageWebPCoder.m の 264 行目付近から始めます。対応する Apple プラットフォーム全体で、フレームスキップのオプトインオプションをどのように公開し維持すべきかを判断し、その後、アニメーション WebP の fixture を使って、結果として得られるフレーム数とアニメーションのタイミングを確認します。

索引モデルが issue の本文から書いたものです。

説明

enhancement

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));
主要言語
Objective-C
スター
277
フォーク
101
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

SDWebImage/SDWebImageWebPCoder のほかの issue

SDWebImage/SDWebImageWebPCoder の issue をすべて見る

似ている issue

Objective-C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。