MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / encode_strip

Function encode_strip

libavcodec/tiffenc.c:150–179  ·  view source on GitHub ↗

* Encode one strip in tiff file * * @param s Tiff context * @param src Input buffer * @param dst Output buffer * @param n Size of input buffer * @param compr Compression method * @return Number of output bytes. If an output error is encountered, -1 returned */

Source from the content-addressed store, hash-verified

148 * @return Number of output bytes. If an output error is encountered, -1 returned
149 */
150static int encode_strip(TiffEncoderContext * s, const int8_t * src,
151 uint8_t * dst, int n, int compr)
152{
153
154 switch (compr) {
155#if CONFIG_ZLIB
156 case TIFF_DEFLATE:
157 case TIFF_ADOBE_DEFLATE:
158 {
159 unsigned long zlen = s->buf_size - (*s->buf - s->buf_start);
160 if (compress(dst, &zlen, src, n) != Z_OK) {
161 av_log(s->avctx, AV_LOG_ERROR, "Compressing failed\n");
162 return -1;
163 }
164 return zlen;
165 }
166#endif
167 case TIFF_RAW:
168 if (check_size(s, n))
169 return -1;
170 memcpy(dst, src, n);
171 return n;
172 case TIFF_PACKBITS:
173 return ff_rle_encode(dst, s->buf_size - (*s->buf - s->buf_start), src, 1, n, 2, 0xff, -1, 0);
174 case TIFF_LZW:
175 return ff_lzw_encode(s->lzws, src, n);
176 default:
177 return -1;
178 }
179}
180
181static void pack_yuv(TiffEncoderContext * s, uint8_t * dst, int lnum)
182{

Callers 1

encode_frameFunction · 0.85

Calls 4

av_logFunction · 0.85
check_sizeFunction · 0.85
ff_rle_encodeFunction · 0.85
ff_lzw_encodeFunction · 0.85

Tested by

no test coverage detected