mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
xface: reduce stack usage by directly storing 2 bytes data instead of pointers.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
This commit is contained in:
parent
dfc6f56c5a
commit
cad3148ea3
@ -74,7 +74,7 @@ static int all_white(char *bitmap, int w, int h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const ProbRange *prob_ranges[XFACE_PIXELS*2];
|
ProbRange prob_ranges[XFACE_PIXELS*2];
|
||||||
int prob_ranges_idx;
|
int prob_ranges_idx;
|
||||||
} ProbRangesQueue;
|
} ProbRangesQueue;
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ static inline int pq_push(ProbRangesQueue *pq, const ProbRange *p)
|
|||||||
{
|
{
|
||||||
if (pq->prob_ranges_idx >= XFACE_PIXELS * 2 - 1)
|
if (pq->prob_ranges_idx >= XFACE_PIXELS * 2 - 1)
|
||||||
return -1;
|
return -1;
|
||||||
pq->prob_ranges[pq->prob_ranges_idx++] = p;
|
pq->prob_ranges[pq->prob_ranges_idx++] = *p;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ static int xface_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
|||||||
const AVFrame *frame, int *got_packet)
|
const AVFrame *frame, int *got_packet)
|
||||||
{
|
{
|
||||||
XFaceContext *xface = avctx->priv_data;
|
XFaceContext *xface = avctx->priv_data;
|
||||||
ProbRangesQueue pq = {{ 0 }, 0};
|
ProbRangesQueue pq = {{{ 0 }}, 0};
|
||||||
uint8_t bitmap_copy[XFACE_PIXELS];
|
uint8_t bitmap_copy[XFACE_PIXELS];
|
||||||
BigInt b = {0};
|
BigInt b = {0};
|
||||||
int i, j, k, ret = 0;
|
int i, j, k, ret = 0;
|
||||||
@ -193,7 +193,7 @@ static int xface_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
|||||||
encode_block(xface->bitmap + XFACE_WIDTH * 32 + 32, 16, 16, 0, &pq);
|
encode_block(xface->bitmap + XFACE_WIDTH * 32 + 32, 16, 16, 0, &pq);
|
||||||
|
|
||||||
while (pq.prob_ranges_idx > 0)
|
while (pq.prob_ranges_idx > 0)
|
||||||
push_integer(&b, pq.prob_ranges[--pq.prob_ranges_idx]);
|
push_integer(&b, &pq.prob_ranges[--pq.prob_ranges_idx]);
|
||||||
|
|
||||||
/* write the inverted big integer in b to intbuf */
|
/* write the inverted big integer in b to intbuf */
|
||||||
i = 0;
|
i = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user