Flutter Engine
The Flutter Engine
Classes | Namespaces | Functions
SkJpegEncoderImpl.cpp File Reference
#include "src/encode/SkJpegEncoderImpl.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkColorType.h"
#include "include/core/SkData.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkPixmap.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkStream.h"
#include "include/core/SkYUVAInfo.h"
#include "include/core/SkYUVAPixmaps.h"
#include "include/encode/SkEncoder.h"
#include "include/encode/SkJpegEncoder.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkNoncopyable.h"
#include "include/private/base/SkTemplates.h"
#include "src/base/SkMSAN.h"
#include "src/codec/SkJpegConstants.h"
#include "src/codec/SkJpegPriv.h"
#include "src/encode/SkImageEncoderFns.h"
#include "src/encode/SkImageEncoderPriv.h"
#include "src/encode/SkJPEGWriteUtility.h"
#include "src/image/SkImage_Base.h"
#include <csetjmp>
#include <cstdint>
#include <cstring>
#include <memory>
#include <utility>
#include "jpeglib.h"

Go to the source code of this file.

Classes

class  SkJpegEncoderMgr
 

Namespaces

namespace  SkJpegEncoder
 
namespace  SkJpegMetadataEncoder
 

Functions

static void yuva_copy_row (const SkYUVAPixmaps &src, int row, uint8_t *dst)
 
SK_API bool SkJpegEncoder::Encode (SkWStream *dst, const SkPixmap &src, const Options &options)
 
SK_API bool SkJpegEncoder::Encode (SkWStream *dst, const SkYUVAPixmaps &src, const SkColorSpace *srcColorSpace, const Options &options)
 
SK_API sk_sp< SkDataSkJpegEncoder::Encode (GrDirectContext *ctx, const SkImage *img, const Options &options)
 
SK_API std::unique_ptr< SkEncoderSkJpegEncoder::Make (SkWStream *dst, const SkPixmap &src, const Options &options)
 
SK_API std::unique_ptr< SkEncoderSkJpegEncoder::Make (SkWStream *dst, const SkYUVAPixmaps &src, const SkColorSpace *srcColorSpace, const Options &options)
 
void SkJpegMetadataEncoder::AppendICC (SegmentList &segmentList, const SkJpegEncoder::Options &options, const SkColorSpace *colorSpace)
 
void SkJpegMetadataEncoder::AppendXMPStandard (SegmentList &segmentList, const SkData *xmpMetadata)
 

Function Documentation

◆ yuva_copy_row()

static void yuva_copy_row ( const SkYUVAPixmaps src,
int  row,
uint8_t *  dst 
)
static

Definition at line 186 of file SkJpegEncoderImpl.cpp.

186 {
187 int width = src.plane(0).width();
188 switch (src.yuvaInfo().planeConfig()) {
190 auto [ssWidthU, ssHeightU] = src.yuvaInfo().planeSubsamplingFactors(1);
191 auto [ssWidthV, ssHeightV] = src.yuvaInfo().planeSubsamplingFactors(2);
192 const uint8_t* srcY = reinterpret_cast<const uint8_t*>(src.plane(0).addr(0, row));
193 const uint8_t* srcU =
194 reinterpret_cast<const uint8_t*>(src.plane(1).addr(0, row / ssHeightU));
195 const uint8_t* srcV =
196 reinterpret_cast<const uint8_t*>(src.plane(2).addr(0, row / ssHeightV));
197 for (int col = 0; col < width; ++col) {
198 dst[3 * col + 0] = srcY[col];
199 dst[3 * col + 1] = srcU[col / ssWidthU];
200 dst[3 * col + 2] = srcV[col / ssWidthV];
201 }
202 break;
203 }
205 auto [ssWidthUV, ssHeightUV] = src.yuvaInfo().planeSubsamplingFactors(1);
206 const uint8_t* srcY = reinterpret_cast<const uint8_t*>(src.plane(0).addr(0, row));
207 const uint8_t* srcUV =
208 reinterpret_cast<const uint8_t*>(src.plane(1).addr(0, row / ssHeightUV));
209 for (int col = 0; col < width; ++col) {
210 dst[3 * col + 0] = srcY[col];
211 dst[3 * col + 1] = srcUV[2 * (col / ssWidthUV) + 0];
212 dst[3 * col + 2] = srcUV[2 * (col / ssWidthUV) + 1];
213 }
214 break;
215 }
216 default:
217 break;
218 }
219}
@ kY_U_V
Plane 0: Y, Plane 1: U, Plane 2: V.
@ kY_UV
Plane 0: Y, Plane 1: UV.
dst
Definition: cp.py:12
int32_t width