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

Function rescale

libavcodec/gdv.c:132–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, int scale_h)
133{
134 int j, y;
135
136 if ((gdv->scale_v == scale_v) && (gdv->scale_h == scale_h)) {
137 return;
138 }
139
140 if (gdv->scale_v) {
141 for (j = 0; j < h; j++) {
142 int y = h - j - 1;
143 uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
144 uint8_t *src1 = dst + PREAMBLE_SIZE + (y>>!!gdv->scale_h) * (w>>1);
145
146 scaleup_rev(dst1, src1, w);
147 }
148 } else if (gdv->scale_h) {
149 for (j = 0; j < h; j++) {
150 int y = h - j - 1;
151 uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
152 uint8_t *src1 = dst + PREAMBLE_SIZE + (y>>1) * w;
153 memcpy(dst1, src1, w);
154 }
155 }
156
157 if (scale_h && scale_v) {
158 for (y = 0; y < (h>>1); y++) {
159 uint8_t *dst1 = dst + PREAMBLE_SIZE + y * (w>>1);
160 uint8_t *src1 = dst + PREAMBLE_SIZE + y*2 * w;
161 scaledown(dst1, src1, w>>1);
162 }
163 } else if (scale_h) {
164 for (y = 0; y < (h>>1); y++) {
165 uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
166 uint8_t *src1 = dst + PREAMBLE_SIZE + y*2 * w;
167 memcpy(dst1, src1, w);
168 }
169 } else if (scale_v) {
170 for (y = 0; y < h; y++) {
171 uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
172 scaledown(dst1, dst1, w>>1);
173 }
174 }
175
176 gdv->scale_v = scale_v;
177 gdv->scale_h = scale_h;
178}
179
180static int read_bits2(Bits8 *bits, GetByteContext *gb)
181{

Callers 1

gdv_decode_frameFunction · 0.70

Calls 2

scaleup_revFunction · 0.85
scaledownFunction · 0.85

Tested by

no test coverage detected