GithubHelp home page GithubHelp logo

Comments (32)

ilyakurdyukov avatar ilyakurdyukov commented on May 27, 2024 2

add variable is an integer, and it's a difference from unmodified coefficient. So, I don't understand, what you want to tune with that. Multiplying by something here is only gonna make result worse.
If you want to experiment with tuning - I suggest changing:

  1. int range = quantval[i] * 2; this value, maybe change how it derived from quantval[], that is a DCT coefs multiplier values (larger - lower quality).
  2. float bcoef = 2.0f; that is border pixels gain, need more for low quality JPEG images, where you can see 8x8 tiles.
  3. for (iter = 0; iter < 3; iter++) { iterations count, you may also change tuning for range and bcoef depending on current iteration.

from jpeg-quantsmooth.

ilyakurdyukov avatar ilyakurdyukov commented on May 27, 2024 2

Считай это как демонстрацию концепции. Но код для WASM работает как библиотечная функция, принимает буфер в памяти, где записан jpeg файл и возвращает обратно буфер с памятью, где лежит новый файл.

from jpeg-quantsmooth.

ilyakurdyukov avatar ilyakurdyukov commented on May 27, 2024 2

probably can get more benefit for drawing, 2d art, comic, graphic content on current version jpegqs?

You are right, this is good for 2D art. The reason that the standard is limited to 3 iterations is that when you use more iterations for photos, they become unnatural, posterized like a CG drawing. If you need this effect standalone, you can use a program I named gravityblur, which simulates it.

from jpeg-quantsmooth.

ilyakurdyukov avatar ilyakurdyukov commented on May 27, 2024 1

Better if you do it on your own. As I said, additional logic may be required, not just changing some numbers. I can recommend to name these values as compiler defines, and change them from CFLAGS. Program code is very small and compiles quickly.

Need a universal custom tool.

I can't offer a universal tool for now, but now the tuning works quite well. You can try to find which places/variables need tuning, and for which reasons someone need to change them. Because most changes don't do any good, or may only be better only for certain images.

from jpeg-quantsmooth.

ilyakurdyukov avatar ilyakurdyukov commented on May 27, 2024 1

If you find that some changes work better for certain images, then I can think about how these changes can be made automatically. Or to set them from command line. But main idea is to do everything automatically, and tuning is like "sharper/smoother" that user can set by their taste, for all images, not to change for every image.

from jpeg-quantsmooth.

ilyakurdyukov avatar ilyakurdyukov commented on May 27, 2024 1

@Lee-lithium

look like jpeg-quantsmooth is more focus on efficiently and quickly

At first it was, until I implemented the same functionality as in jpeg2png (chroma upscale, at -q6), but in a different way.

As the methods are different, sometimes I see that my chroma upscaling is better, but I seen that in some regions on some images jpeg2png does that better.

Current issues:

  • jpeg2png has overblurring.

  • jpegqs does poor unblocking for very low quality JPEG (jpeg2png does this very well). But for me this is a low-priority issue, because no one uses this quality in practice.

So think about it as jpegqs is focused on performance and high quality (>50%) JPEGs. jpeg2png will help with low-quality JPEGs.

from jpeg-quantsmooth.

zvezdochiot avatar zvezdochiot commented on May 27, 2024 1

@ilyakurdyukov say:

jpegqs does poor unblocking for very low quality JPEG

⚠️ Remark: jpegqs is preferred for scans with text, regardless of quality.

from jpeg-quantsmooth.

zvezdochiot avatar zvezdochiot commented on May 27, 2024

@ilyakurdyukov say:

int range = quantval[i] * 2(2 == gain), float bcoef (border), iter < 3(3 == niter)

All three parameters are significant. Can you carefully enter them in the program parameters? I don’t want to get into your code with my "dirty hands".

default: gain = 2.0f; border = 2.0f; niter = 3;

PS: Yes. I want to get an "arbitrary" result. "Thing in itself" does not suit. Need a universal custom tool.

from jpeg-quantsmooth.

zvezdochiot avatar zvezdochiot commented on May 27, 2024

@ilyakurdyukov say:

Better if you do it on your own.

Ok.

from jpeg-quantsmooth.

zvezdochiot avatar zvezdochiot commented on May 27, 2024

Fixed #5

from jpeg-quantsmooth.

ilyakurdyukov avatar ilyakurdyukov commented on May 27, 2024

int range = quantval[i] * 2; as you see from this line, I guessing that range relation to quantval[i] is linear, but maybe it's not like that (and need power function). Also, maybe range needs min/max limits. So there are unlimited possibilities of what you can tune and how.
It can even look like
int range = (quantval[i] << iter) * mult;
or
int range = (quantval[i] * mult) >> iter;.
So you need lot of experiments to find good solutions.

from jpeg-quantsmooth.

zvezdochiot avatar zvezdochiot commented on May 27, 2024

So you need lot of experiments to find good solutions.

No need. See #5

from jpeg-quantsmooth.

zvezdochiot avatar zvezdochiot commented on May 27, 2024

The issue is not resolved.

from jpeg-quantsmooth.

ilyakurdyukov avatar ilyakurdyukov commented on May 27, 2024

It's not an issue, just improvements. I'll think about tuning, if you don't want to wait - you can experiment with your vision of how you think it should be.

from jpeg-quantsmooth.

ilyakurdyukov avatar ilyakurdyukov commented on May 27, 2024

Anyway, I want to keep my own "vanilla" version, not to accept every modifications. Only if there are really good or needed for many people.

from jpeg-quantsmooth.

zvezdochiot avatar zvezdochiot commented on May 27, 2024

Yes, let it hang. We are in the know. For outsiders, the question is in the process.

from jpeg-quantsmooth.

ilyakurdyukov avatar ilyakurdyukov commented on May 27, 2024

For now, just experiment on your own which constants good for tuning, and which is useless.

from jpeg-quantsmooth.

zvezdochiot avatar zvezdochiot commented on May 27, 2024

Hmm. I don’t need any specific constants. I need all the options.

from jpeg-quantsmooth.

ilyakurdyukov avatar ilyakurdyukov commented on May 27, 2024

@zvezdochiot делай меньше сообщений, мне приходит много уведомлений, напрягает уже их чистить. Закрыл, открыл, "ок" - и на всё уведомления. На добавление смайлов не приходит. На вопросы ответить могу, можешь здесь задавать. А не заводить на всё новый "issue".

Насчёт параметров, изменение констант в коде должно быть обосновано, что это делает результат лучше. Если я указал что можно менять - это не значит, что эти переменные и константы нужно тащить в командную строку для всех. В большинстве случаев результат будет только хуже. Увеличение количества итераций не сделает заметно лучше. Так как с каждой следующей итерацией изменения коэффициентов станут всё меньше, пока не перестанут меняться. Или они упрутся в крайние значения, а изображение станет размытым или слишком плакатным (похожим на рисунок). Вынести константы в командную строку - много знаний и времени не надо, поэтому не надо предлагать эти изменения.

Что бы было интересно для меня - это опыт использования. Если бы ты написал, что для определённой категории изображений понадобилось что-то менять, и это сделало результат лучше. Не пиши слишком часто, как накопится опыт - тогда и поделись им. Если ты нашел, что сделает алгоритм лучше, но для большинства изображений - это более ценно. Если кто-то столкнулся с проблемами при компиляции для определённой системы/архитектуры (OSX например) - то есть улучшение портируемости - это тоже интересно. И что мне интересно, это увидеть использование в плагинах для программ что как-то используют jpeg. Но я не стал бы добавлять себе в репозиторий такие плагины, если не смогу их сам поддерживать, а скорее всего не смогу.

При этом, что там происходит с низким качеством, ниже 50% - не особо интересно, так как такое редко используется. И еще, если сохранить изображение с низким качеством, а потом открыть и сохранить с высоким - то программа не сможет их правильно сгладить, это я не буду считать багом.

Если тебе нужна стабильность и максимальное качество, а время обработки не важно - то используй jpeg2png, у него местами чуть лучше. А у меня цель сделать качественно и быстро, с хорошим балансом между качеством и производительностью. И чтобы настраивалось автоматически, потому что пользователю самостоятельно крутить несколько параметров - это тоже трата времени.

from jpeg-quantsmooth.

zvezdochiot avatar zvezdochiot commented on May 27, 2024

Всё верно говоришь. Но ты имеешь в виду некое изображение. А я имею дело с иллюстрациями PDF. Похожие в общем вещи, но есть определённое различие в понятии "качество". И именно здесь мне нужно больше настроек. Никто кроме "избранных" (как я раньше уже говорил) эти параметры юзать не будет.

from jpeg-quantsmooth.

ilyakurdyukov avatar ilyakurdyukov commented on May 27, 2024

Насчёт PDF - это как раз то, что я рассматриваю как сценарий применения программы. В некоторые форматы документов можно вставлять JPEG, при печати таких документов - на бумаге артефакты становятся весьма заметны, хотя на экране почти не различались. Поэтому софт для печати мог бы использовать мой код для удаления артефактов перед печатью. Графические редакторы и программы для просмотра изображений - могли бы сглаживать JPEG прямо при открытии. Я хотел бы оптимизировать настолько, чтобы время обработки практически не ощущалось. Так как это довольно важно, ждать 10 секунд (как у jpeg2png) на изображение чуть больше среднего при открытии - мало кто захочет. Нужно чтобы это не напрягало. А при печати большого документа, если обрабатывать jpeg2png - получится очень медленно, если изображений много. И опять же, нужно чтобы настраивалось автоматически, если изображений много, то настраивать каждое не вариант.

И лицензию я выбрал такую, что позволяет использовать в закрытом софте, но через библиотеку-плагин с открытым кодом. Так же для того, чтобы те, кто будет использовать её в коммерческом софте - или внесли вклад в развитие проекта (улучшив алгоритм, документацию или исправив какие-то проблемы) или даже мне заплатили за какие-то фичи - например, оптимизацию под специфическую архитектуру или поддержку 12-bit сэмплов, то что никому кроме них не нужно.

from jpeg-quantsmooth.

zvezdochiot avatar zvezdochiot commented on May 27, 2024

Поэтому софт для печати мог бы использовать мой код для удаления артефактов перед печатью.

Тогда концеция не совсем верна. https://github.com/ilyakurdyukov/jpeg-quantsmooth/blob/master/quantsmooth.h надо оформлять в либу. И позиционировать проект как library+tools, а не как tools.

from jpeg-quantsmooth.

Lee-lithium avatar Lee-lithium commented on May 27, 2024

Hello @ilyakurdyukov, Sorry for bother you,

For now I have some drawing, 2d art, comic, graphic content,
those picture save on jpeg q85~94 420,444,
I want reduce jpeg artifacts and get better quality,
so I apply jpeg2png -w 0.0 -i 100 and jpeg-quantsmooth -q 6,
both process result look good, but jpeg2png is slower.

I find some comment about quality from jpeg-quantsmooth repository,
look like jpeg-quantsmooth is more focus on efficiently and quickly,

But on jpeg2png repository, look like jpeg-quantsmooth can prevent overblurring better.
I think jpeg2png overblurring issue still exist on current version.

Could you teach me, if I don't mind speed and want best quality, I should use which implement?
Thank you for create this amazing tool :)

#4 (comment)
Если тебе нужна стабильность и максимальное качество, а время обработки не важно -
то используй jpeg2png, у него местами чуть лучше. А у меня цель сделать качественно и быстро,
с хорошим балансом между качеством и производительностью. И чтобы настраивалось автоматически,
потому что пользователю самостоятельно крутить несколько параметров - это тоже трата времени.

victorvde/jpeg2png#10
As the author of a similar project, I also encountered this effect,
but found a method to prevent overblurring. I tried to apply same method to jpeg2png.

from jpeg-quantsmooth.

Lee-lithium avatar Lee-lithium commented on May 27, 2024

@ilyakurdyukov, @zvezdochiot
I understand, Thank you for your Help :)

A little curious, current version jpegqs is really fast,
If I increase number of iterations(--niter) to 5 and use --quality 6,
probably can get more benefit for drawing, 2d art, comic, graphic content on current version jpegqs?

from jpeg-quantsmooth.

Lee-lithium avatar Lee-lithium commented on May 27, 2024

ilyakurdyukov
Thank you for your reply :)

If don't mind reduce efficient, which iteration value can get best quality
and don't get worse(over blurry) for 2D art content?

from jpeg-quantsmooth.

zvezdochiot avatar zvezdochiot commented on May 27, 2024

@Lee-lithium say:

best quality

??? %X

from jpeg-quantsmooth.

ilyakurdyukov avatar ilyakurdyukov commented on May 27, 2024

Too many iterations can cause some artifacts like bright/dark points and too sharp edges. You definitely see some artifacts at -n100, which is the maximum for iterations. 5-10 iterations should be enough for 2D art.

Here is an interesting example of 2D art to experiment with, which is also very difficult for jpeg2png.

from jpeg-quantsmooth.

Lee-lithium avatar Lee-lithium commented on May 27, 2024

ilyakurdyukov
Thank you for your reply :)

I compare -n 5 and -n 10 on same picture(jpeg q91 444),
but it's hard say which result is better,
some area -n 10 is better than -n 5, but some area -n 5 is better than -n 10,
I guess I need test other value(-n 6,7,8,9).

Probably need reference jpeg estimate quality,
apply different iteration value for different estimate quality?
This is a good idea for 2D art?

jpeg q85 apply -n 10
jpeg q91 apply -n 5
jpeg q96 apply -n 3

@zvezdochiot

I think best quality mean 100% or 99.9% quality,
or reach jpegqs quality best practices and don't get worse(over blurry),
like jpegqs -q 6 -n 3(default) is quality best practices for photo content.

from jpeg-quantsmooth.

zvezdochiot avatar zvezdochiot commented on May 27, 2024

@Lee-lithium say:

I think best quality

We do not deal with any "qualities". We are engaged in graphic filters. In this case, dct-coefficients and the patterns of their calculations are used for filtering.

from jpeg-quantsmooth.

ilyakurdyukov avatar ilyakurdyukov commented on May 27, 2024

@zvezdochiot

We do not deal with any "qualities". We are engaged in graphic filters. In this case, dct-coefficients and the patterns of their calculations are used for filtering.

This isn't filtering, it is choosing the smoothest possible input. Quality levels 0-2 are actual filtering (cheaper and faster method, it's not bad as you might think), then reverse and limiting the coefficients to the possible range.

from jpeg-quantsmooth.

zvezdochiot avatar zvezdochiot commented on May 27, 2024
@ilyakurdyukov Илья, я тупо не могу серьёзно вести беседу о каких то "качествах". Ну это же бред сивой кобылы. Да, это не просто фильтр, а использование закономерностей самого jpeg. Но всё-равно это фильтр. Что означает в данном случае "best quality", для меня "загадка".

from jpeg-quantsmooth.

Lee-lithium avatar Lee-lithium commented on May 27, 2024

Hello @ilyakurdyukov, @zvezdochiot

I'm sorry about use misleading word, my english isn't very good,
so I think I didn't choose a correct word to express my question.

I think my goal is
find a specific iteration value let jpegqs more effort,
get better restoration and increase appeal for 2d art,
and don't get worse(over blurry, artifacts).

Thank you for teach me :)

from jpeg-quantsmooth.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.