Go to the documentation of this file.
34 int run_index = sc->run_index;
42 if (
c->bytestream_end -
c->bytestream <
w * 35) {
53 if (sc->slice_coding_mode == 1) {
54 for (x = 0; x <
w; x++) {
65 for (x = 0; x <
w; x++) {
110 ff_dlog(logctx,
"count:%d index:%d, mode:%d, x:%d pos:%d\n",
111 run_count, run_index, run_mode, x,
128 sc->run_index = run_index;
134 const uint8_t *
src[4],
138 int transparency =
f->transparency;
140 for (
int p = 0; p<3 + transparency; p++)
141 memset(sc->fltmap[p], 0, 65536 *
sizeof(**sc->fltmap));
143 for (y = 0; y <
h; y++) {
144 for (x = 0; x <
w; x++) {
147 if (
sizeof(
TYPE) == 4 || transparency) {
148 g = *((
const uint16_t *)(
src[0] + x*2 +
stride[0]*y));
149 b = *((
const uint16_t *)(
src[1] + x*2 +
stride[1]*y));
150 r = *((
const uint16_t *)(
src[2] + x*2 +
stride[2]*y));
152 a = *((
const uint16_t *)(
src[3] + x*2 +
stride[3]*y));
154 b = *((
const uint16_t *)(
src[0] + x*2 +
stride[0]*y));
155 g = *((
const uint16_t *)(
src[1] + x*2 +
stride[1]*y));
156 r = *((
const uint16_t *)(
src[2] + x*2 +
stride[2]*y));
159 sc->fltmap[0][
g] = 1;
160 sc->fltmap[1][
b] = 1;
161 sc->fltmap[2][
r] = 1;
163 sc->fltmap[3][
a] = 1;
169 const uint8_t *
src[4],
170 int w,
int h,
const int stride[4],
int ac)
173 const int ring_size =
f->context_model ? 3 : 2;
176 int lbd =
f->bits_per_raw_sample <= 8;
177 int packed = !
src[1];
179 int transparency =
f->transparency;
180 int packed_size = (3 + transparency)*2;
187 (
w + 6) *
sizeof(*
RENAME(sc->sample_buffer)));
189 for (y = 0; y <
h; y++) {
194 for (x = 0; x <
w; x++) {
197 unsigned v = *((
const uint32_t*)(
src[0] + x*4 +
stride[0]*y));
200 r = (v >> 16) & 0xFF;
203 const uint16_t *p = ((
const uint16_t*)(
src[0] + x*packed_size +
stride[0]*y));
209 }
else if (
sizeof(
TYPE) == 4 || transparency) {
210 g = *((
const uint16_t *)(
src[0] + x*2 +
stride[0]*y));
211 b = *((
const uint16_t *)(
src[1] + x*2 +
stride[1]*y));
212 r = *((
const uint16_t *)(
src[2] + x*2 +
stride[2]*y));
214 a = *((
const uint16_t *)(
src[3] + x*2 +
stride[3]*y));
216 b = *((
const uint16_t *)(
src[0] + x*2 +
stride[0]*y));
217 g = *((
const uint16_t *)(
src[1] + x*2 +
stride[1]*y));
218 r = *((
const uint16_t *)(
src[2] + x*2 +
stride[2]*y));
222 g = sc->fltmap[0][
g];
223 b = sc->fltmap[1][
b];
224 r = sc->fltmap[2][
r];
226 a = sc->fltmap[3][
a];
229 if (sc->slice_coding_mode != 1) {
232 g += (
b * sc->slice_rct_by_coef +
r * sc->slice_rct_ry_coef) >> 2;
242 for (p = 0; p < 3 + transparency; p++) {
static void RENAME() load_rgb_frame(FFV1Context *f, FFV1SliceContext *sc, const uint8_t *src[4], int w, int h, const int stride[4])
static av_always_inline int RENAME() encode_line(FFV1Context *f, FFV1SliceContext *sc, void *logctx, int w, TYPE *sample[3], int plane_index, int bits, int ac, int pass1)
static av_always_inline av_flatten void put_symbol_inline(RangeCoder *c, uint8_t *state, int v, int is_signed, uint64_t rc_stat[256][2], uint64_t rc_stat2[32][2])
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
static av_always_inline void predict(PredictorState *ps, int *coef, int output_enable)
uint8_t(* state)[CONTEXT_SIZE]
static int ring_size(RingBuffer *ring)
static int put_bytes_left(const PutBitContext *s, int round_up)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline int fold(int diff, int bits)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option keep it simple and lowercase description are in without and describe what they for example set the foo of the bar offset is the offset of the field in your context
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
static void put_vlc_symbol(PutBitContext *pb, VlcState *const state, int v, int bits)
#define i(width, name, range_min, range_max)
static int put_bits_count(PutBitContext *s)
static int RENAME() encode_rgb_frame(FFV1Context *f, FFV1SliceContext *sc, const uint8_t *src[4], int w, int h, const int stride[4], int ac)
const uint8_t ff_log2_run[41]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void ff_ffv1_compute_bits_per_plane(const FFV1Context *f, FFV1SliceContext *sc, int bits[4], int *offset, int mask[4], int bits_per_raw_sample)
#define AV_CODEC_FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.