Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8706205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:33:26+00:00 2026-06-13T03:33:26+00:00

I have some PVRTC 4bpp image data that needs to be flipped vertically in-place

  • 0

I have some PVRTC 4bpp image data that needs to be flipped vertically in-place without decompression. The code I have written is mostly working but the flip currently introduces small artefacts and I’m unsure exactly why.

The PVRTC flip code first moves the 8-byte 4×4 compression blocks to their flipped position as calculated by the TwiddleUV() function from PVRTDecompress.cpp in the PowerVR SDK. This part appears to be correct.

Second, the code iterates through all the 8-byte compression blocks reversing the order of the second 4 bytes which contain the 4×4 modulation data stored in 2bpp. The first 4 bytes of the block contains color data which is left unchanged.

This seems to be very close to correct, but it leaves small artefacts in the flipped image that weren’t there in the original and which manifest mostly as small greyish horizontal lines. If the flipping code is run twice then the artefacts go away and the image is unchanged from the original.

Can anyone with some PVRTC experience explain what else needs to be done to flip the compressed image data? I think the problem may be to do with the flipping of modulation data, but my forays into the PVRTC documentation haven’t yielded the answer at this stage.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:33:27+00:00Added an answer on June 13, 2026 at 3:33 am

    To make this a bit easier to understand, you need to know the way PVRTC decodes the data as it’s a bit different to block-based schemes like ETC1 or S3TC/DXTC. For simplicity I’ll only describe the 4bpp variant.

    PVRTC consists of 2 low-resolution 15/16bpp images, A and B, that are 1/4 * 1/4 the resolution of the final texture, along with a full-resolution, but 2bpp modulation image. To ‘logically’ decode a texel, XY, the A and B images are bilinearly upscaled to the target resolution, and then the resulting colours, Axy and Bxy are blended according to the pixel in the modulation image. To make the decoding simpler in hardware, the A and B images are interleaved with the modulation data at the rate of 1 pixel from each with 16 from the modulation data, into 64-bit words.

    Now, the reason it’s not flipping exactly using just bit shuffling is because the 4×4 bilinear upscale is slightly offset from the centres of 4×4 texels (I think the reasons are described in the Graphics Hardware 2003 paper linked from wikipedia). I expect the only thing you could do is actually evaluate each pixel and then after doing the flip of the bilinear colours, work out which of the four possibilities is actually the closest. In a way, it’d be a recompression, but it should be relatively quick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have some data in a sybase image type column that I want to use
I have some code that can convert a single color in a template image
I have some procedural javascript code that I have written for an open-source application
I have some arbitrary pixel data that I want to save as a PNG.
I have some code that will change the background color of a specific label
I have some code here that uses bitsets to store many 1 bit values
Have some text that needs to be replaced, searched around this website for all
I have some code that I am debugging that uses this operator and I'm
I have some code in jQuery that iterate through children in div using each().
I have some values that are stored with core data, and I have opened

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.