On 20/02/15 17:16, Vittorio Giovara wrote:
On Fri, Feb 20, 2015 at 11:12 AM, Martin Storsjö <[email protected]> wrote:
On Fri, 20 Feb 2015, Vittorio Giovara wrote:
On Fri, Feb 20, 2015 at 10:59 AM, Diego Biurrun <[email protected]> wrote:
On Fri, Feb 20, 2015 at 04:56:51PM +0100, Luca Barbato wrote:
On 20/02/15 16:50, Diego Biurrun wrote:
On Thu, Feb 19, 2015 at 10:16:29PM -0500, Vittorio Giovara wrote:
--- /dev/null
+++ b/libavcodec/hqx.c
@@ -0,0 +1,632 @@
+static inline void put_blocks(AVFrame *pic, int plane,
+ int x, int y, int ilace,
+ int16_t *block0, int16_t *block1,
+ const uint8_t *quant)
+{
+ hqx_idct_put(
+ (uint16_t *)(pic->data[plane] + x * 2 + y *
pic->linesize[plane]),
+ pic->linesize[plane] * fields, block0, quant);
+ hqx_idct_put(
+ (uint16_t *)(pic->data[plane] + x * 2 + y *
pic->linesize[plane]),
+ pic->linesize[plane] * fields, block1, quant);
IMO an ugly way to break lines...
an option is
uint16_t *p = pic->data[plane] + x * 2 + y * pic->linesize[plane];
That even saves some of the duplication, perfect.
... except that you need to cast it with (uint16_t *) to avoid a
warning and that brings it past 80 columns, which calls for ugly
breaks again :<
Then ignore the 80-col "rule" (which is more like a guideline) for this
line. I much rather read sensible code with an occasional 85 char line, than
code that has been abused just to fit below 80. Even if it's >80, 85 chars
still is nicer than 150.
I found a solution that should make everyone happy :)
How about this:
static inline void put_blocks(AVFrame *pic, int plane,
int x, int y, int ilace,
int16_t *block0, int16_t *block1,
const uint8_t *quant)
{
int fields = ilace ? 2 : 1;
int lsize = pic->linesize[plane];
uint16_t *p;
p = (uint16_t *)(pic->data[plane] + x * 2 + y * lsize);
hqx_idct_put(p, pic->linesize[plane] * fields, block0, quant);
p = (uint16_t *)(pic->data[plane] + x * 2 + (y + (ilace ? 1 : 8)) * lsize);
hqx_idct_put(p, pic->linesize[plane] * fields, block1, quant);
}
OCD
uint8_t p = pic->data[plane] + x * 2;
hqx_idct_put((uint16_t)(p + y * lsize), ...
hqx_idct_put((uint16_t)(p + (y + (ilace ? 1 : 8)) * lsize, ...
Not that probably would make a difference in speed.
lu
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel